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:
commit
f18637bf90
1 changed files with 13 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue