Class: MotionSpec::Matcher::BeA
- Defined in:
- lib/motion-spec/matcher/be_a.rb
Instance Method Summary collapse
- #fail!(subject, negated) ⇒ Object
-
#initialize(test_class) ⇒ BeA
constructor
A new instance of BeA.
- #matches?(subject) ⇒ Boolean
Constructor Details
#initialize(test_class) ⇒ BeA
Returns a new instance of BeA.
5 6 7 |
# File 'lib/motion-spec/matcher/be_a.rb', line 5 def initialize(test_class) @test_class = test_class end |
Instance Method Details
#fail!(subject, negated) ⇒ Object
15 16 17 18 |
# File 'lib/motion-spec/matcher/be_a.rb', line 15 def fail!(subject, negated) = FailMessageRenderer.(negated, subject, @test_class) fail FailedExpectation.new() end |
#matches?(subject) ⇒ Boolean
9 10 11 12 13 |
# File 'lib/motion-spec/matcher/be_a.rb', line 9 def matches?(subject) comparison_object = subject.is_a?(Class) ? subject : subject.class comparison_object.ancestors.include? @test_class end |