1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Merge pull request #1219 from jdelStrother/rspec3

Update HaveText to silence deprecations on RSpec3
This commit is contained in:
Jonas Nicklas 2014-01-06 07:00:18 -08:00
commit f18637bf90

View file

@ -51,16 +51,20 @@ module Capybara
@actual.has_no_text?(type, content, options)
end
def failure_message_for_should
def failure_message
message = Capybara::Helpers.failure_message(description, options)
message << " in #{format(@actual.text(type))}"
message
end
def failure_message_for_should_not
failure_message_for_should.sub(/(to find)/, 'not \1')
def failure_message_when_negated
failure_message.sub(/(to find)/, 'not \1')
end
# RSpec 2 compatibility:
alias_method :failure_message_for_should, :failure_message
alias_method :failure_message_for_should_not, :failure_message_when_negated
def description
"text #{format(content)}"
end
@ -88,14 +92,18 @@ module Capybara
@actual.has_no_title?(title)
end
def failure_message_for_should
def failure_message
"expected there to be title #{title.inspect} in #{@actual.title.inspect}"
end
def failure_message_for_should_not
def failure_message_when_negated
"expected there not to be title #{title.inspect} in #{@actual.title.inspect}"
end
# RSpec 2 compatibility:
alias_method :failure_message_for_should, :failure_message
alias_method :failure_message_for_should_not, :failure_message_when_negated
def description
"have title #{title.inspect}"
end