Class: Spec::Rails::Matchers::IncludeText
- Defined in:
- lib/vendor/plugins/rspec-rails/lib/spec/rails/matchers/include_text.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(expected) ⇒ IncludeText
constructor
A new instance of IncludeText.
- #matches?(response_or_text) ⇒ Boolean
Constructor Details
#initialize(expected) ⇒ IncludeText
Returns a new instance of IncludeText.
7 8 9 |
# File 'lib/vendor/plugins/rspec-rails/lib/spec/rails/matchers/include_text.rb', line 7 def initialize(expected) @expected = expected end |
Instance Method Details
#description ⇒ Object
24 25 26 |
# File 'lib/vendor/plugins/rspec-rails/lib/spec/rails/matchers/include_text.rb', line 24 def description "include text #{expected.inspect}" end |
#failure_message_for_should ⇒ Object
16 17 18 |
# File 'lib/vendor/plugins/rspec-rails/lib/spec/rails/matchers/include_text.rb', line 16 def "expected to find #{expected.inspect} in #{actual.inspect}" end |
#failure_message_for_should_not ⇒ Object
20 21 22 |
# File 'lib/vendor/plugins/rspec-rails/lib/spec/rails/matchers/include_text.rb', line 20 def "expected not to include text #{expected.inspect}" end |
#matches?(response_or_text) ⇒ Boolean
11 12 13 14 |
# File 'lib/vendor/plugins/rspec-rails/lib/spec/rails/matchers/include_text.rb', line 11 def matches?(response_or_text) @actual = response_or_text.respond_to?(:body) ? response_or_text.body : response_or_text return actual.include?(expected) end |