Class: Spec::Matchers::BeSameAs
- Inherits:
-
Be
show all
- Defined in:
- lib/spec/matchers/be.rb
Instance Method Summary
collapse
Methods included from Pretty
#_pretty_print, #split_words, #to_sentence
Constructor Details
#initialize(*args, &block) ⇒ BeSameAs
Returns a new instance of BeSameAs.
182
183
184
185
|
# File 'lib/spec/matchers/be.rb', line 182
def initialize(*args, &block)
@expected = args.shift
@args = args
end
|
Instance Method Details
#description ⇒ Object
200
201
202
|
# File 'lib/spec/matchers/be.rb', line 200
def description
"be #{expected_to_sentence}#{args_to_sentence}"
end
|
#failure_message_for_should ⇒ Object
192
193
194
|
# File 'lib/spec/matchers/be.rb', line 192
def failure_message_for_should
"expected #{@expected}, got #{@actual.inspect}"
end
|
#failure_message_for_should_not ⇒ Object
196
197
198
|
# File 'lib/spec/matchers/be.rb', line 196
def failure_message_for_should_not
"expected not #{@expected}, got #{@actual.inspect}"
end
|
#matches?(actual) ⇒ Boolean
187
188
189
190
|
# File 'lib/spec/matchers/be.rb', line 187
def matches?(actual)
@actual = actual
@actual.equal?(@expected)
end
|