Class: Catechism::SubjectWrapper

Inherits:
Struct
  • Object
show all
Defined in:
lib/catechism/subject_wrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#negatedObject (readonly)

Returns the value of attribute negated.



6
7
8
# File 'lib/catechism/subject_wrapper.rb', line 6

def negated
  @negated
end

#subjectObject

Returns the value of attribute subject

Returns:

  • (Object)

    the current value of subject



5
6
7
# File 'lib/catechism/subject_wrapper.rb', line 5

def subject
  @subject
end

Instance Method Details

#notObject



27
28
29
30
# File 'lib/catechism/subject_wrapper.rb', line 27

def not
  @negated = true
  self
end

#to_be_nilObject



13
14
15
16
# File 'lib/catechism/subject_wrapper.rb', line 13

def to_be_nil
  matcher = Catechism::Matchers::Equal.new(subject, nil, negated)
  raise matcher.failure_message unless matcher.valid?
end

#to_equal(expected) ⇒ Object



8
9
10
11
# File 'lib/catechism/subject_wrapper.rb', line 8

def to_equal(expected)
  matcher = Catechism::Matchers::Equal.new(subject, expected, negated)
  raise matcher.failure_message unless matcher.valid?
end

#to_raise_errorObject



18
19
20
21
# File 'lib/catechism/subject_wrapper.rb', line 18

def to_raise_error
  matcher = Catechism::Matchers::RaiseError.new(subject, negated)
  raise matcher.failure_message unless matcher.valid?
end

#to_send(method_name) ⇒ Object



23
24
25
# File 'lib/catechism/subject_wrapper.rb', line 23

def to_send(method_name)
  Catechism::Matchers::Send.new(subject, method_name, negated)
end