Update HaveText & HaveTitle to silence deprecations on RSpec3
This commit is contained in:
parent
60683d9054
commit
2121ff12fb
|
@ -51,16 +51,20 @@ module Capybara
|
||||||
@actual.has_no_text?(type, content, options)
|
@actual.has_no_text?(type, content, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def failure_message_for_should
|
def failure_message
|
||||||
message = Capybara::Helpers.failure_message(description, options)
|
message = Capybara::Helpers.failure_message(description, options)
|
||||||
message << " in #{format(@actual.text(type))}"
|
message << " in #{format(@actual.text(type))}"
|
||||||
message
|
message
|
||||||
end
|
end
|
||||||
|
|
||||||
def failure_message_for_should_not
|
def failure_message_when_negated
|
||||||
failure_message_for_should.sub(/(to find)/, 'not \1')
|
failure_message.sub(/(to find)/, 'not \1')
|
||||||
end
|
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
|
def description
|
||||||
"text #{format(content)}"
|
"text #{format(content)}"
|
||||||
end
|
end
|
||||||
|
@ -88,14 +92,18 @@ module Capybara
|
||||||
@actual.has_no_title?(title)
|
@actual.has_no_title?(title)
|
||||||
end
|
end
|
||||||
|
|
||||||
def failure_message_for_should
|
def failure_message
|
||||||
"expected there to be title #{title.inspect} in #{@actual.title.inspect}"
|
"expected there to be title #{title.inspect} in #{@actual.title.inspect}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def failure_message_for_should_not
|
def failure_message_when_negated
|
||||||
"expected there not to be title #{title.inspect} in #{@actual.title.inspect}"
|
"expected there not to be title #{title.inspect} in #{@actual.title.inspect}"
|
||||||
end
|
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
|
def description
|
||||||
"have title #{title.inspect}"
|
"have title #{title.inspect}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue