rspec-expectations icon indicating copy to clipboard operation
rspec-expectations copied to clipboard

Namespace code block to work around name collisions

Open maxmeyer opened this issue 10 years ago • 7 comments

@myronmarston @JonRowe Does it make sense to have some like this:

Then /^the following files should (not )?exist:$/ do |negated, files|
  files = files.rows.flatten

  RSpec::Matchers.scope do
    if negated
      expect(files).not_to include an_existing_file
    else
      expect(files).to all be_an_existing_file
    end
  end
end

to make a method resolved to RSpec''s one instead some other conflicting method, e.g. from Capybara?

Referencing jnicklas/capybara#1396, jnicklas/capybara#1547, jnicklas/capybara#1526 here.

maxmeyer avatar Jul 15 '15 15:07 maxmeyer