Class: Assert::ActualValue

Inherits:
Object
  • Object
show all
Includes:
MuchNotGiven
Defined in:
lib/assert/actual_value.rb

Instance Method Summary collapse

Constructor Details

#initialize(value = self.class.not_given, context:, &value_block) ⇒ ActualValue

Returns a new instance of ActualValue.


11
12
13
14
# File 'lib/assert/actual_value.rb', line 11

def initialize(value = self.class.not_given, context:, &value_block)
  @value = self.class.given?(value) ? value : value_block
  @context = context
end

Instance Method Details

#changes(*args) ⇒ Object


32
33
34
# File 'lib/assert/actual_value.rb', line 32

def changes(*args)
  @context.assert_changes(*args, &@value)
end

#does_not_change(*args) ⇒ Object


36
37
38
# File 'lib/assert/actual_value.rb', line 36

def does_not_change(*args)
  @context.assert_not_changes(*args, &@value)
end

#does_not_equal(expected_value, *args) ⇒ Object Also known as: is_not_equal_to


85
86
87
# File 'lib/assert/actual_value.rb', line 85

def does_not_equal(expected_value, *args)
  @context.assert_not_equal(expected_value, @value, *args)
end

#does_not_include(object, *args) ⇒ Object


110
111
112
# File 'lib/assert/actual_value.rb', line 110

def does_not_include(object, *args)
  @context.assert_not_includes(object, @value, *args)
end

#does_not_match(expected_regex, *args) ⇒ Object


94
95
96
# File 'lib/assert/actual_value.rb', line 94

def does_not_match(expected_regex, *args)
  @context.assert_not_match(expected_regex, @value, *args)
end

#does_not_raise(*expected_exceptions) ⇒ Object


28
29
30
# File 'lib/assert/actual_value.rb', line 28

def does_not_raise(*expected_exceptions)
  @context.assert_nothing_raised(*expected_exceptions, &@value)
end

#does_not_respond_to(expected_method_name, *args) ⇒ Object


66
67
68
# File 'lib/assert/actual_value.rb', line 66

def does_not_respond_to(expected_method_name, *args)
  @context.assert_not_responds_to(expected_method_name, @value, *args)
end

#does_not_return_true(*args) ⇒ Object


20
21
22
# File 'lib/assert/actual_value.rb', line 20

def does_not_return_true(*args)
  @context.assert_not_block(*args, &@value)
end

#equals(expected_value, *args) ⇒ Object Also known as: is_equal_to


80
81
82
# File 'lib/assert/actual_value.rb', line 80

def equals(expected_value, *args)
  @context.assert_equal(expected_value, @value, *args)
end

#includes(object, *args) ⇒ Object


106
107
108
# File 'lib/assert/actual_value.rb', line 106

def includes(object, *args)
  @context.assert_includes(object, @value, *args)
end

#is_a(expected_class, *args) ⇒ Object Also known as: is_a_kind_of, is_kind_of


40
41
42
# File 'lib/assert/actual_value.rb', line 40

def is_a(expected_class, *args)
  @context.assert_is_a(expected_class, @value, *args)
end

#is_a_file(*args) ⇒ Object


138
139
140
# File 'lib/assert/actual_value.rb', line 138

def is_a_file(*args)
  @context.assert_file_exists(@value, *args)
end

#is_an_instance_of(expected_class, *args) ⇒ Object Also known as: is_instance_of


52
53
54
# File 'lib/assert/actual_value.rb', line 52

def is_an_instance_of(expected_class, *args)
  @context.assert_instance_of(expected_class, @value, *args)
end

#is_empty(*args) ⇒ Object


98
99
100
# File 'lib/assert/actual_value.rb', line 98

def is_empty(*args)
  @context.assert_empty(@value, *args)
end

#is_false(*args) ⇒ Object


130
131
132
# File 'lib/assert/actual_value.rb', line 130

def is_false(*args)
  @context.assert_false(@value, *args)
end

#is_nil(*args) ⇒ Object


114
115
116
# File 'lib/assert/actual_value.rb', line 114

def is_nil(*args)
  @context.assert_nil(@value, *args)
end

#is_not_a(expected_class, *args) ⇒ Object Also known as: is_not_a_kind_of, is_not_kind_of


46
47
48
# File 'lib/assert/actual_value.rb', line 46

def is_not_a(expected_class, *args)
  @context.assert_is_not_a(expected_class, @value, *args)
end

#is_not_a_file(*args) ⇒ Object


142
143
144
# File 'lib/assert/actual_value.rb', line 142

def is_not_a_file(*args)
  @context.assert_not_file_exists(@value, *args)
end

#is_not_an_instance_of(expected_class, *args) ⇒ Object Also known as: is_not_instance_of


57
58
59
# File 'lib/assert/actual_value.rb', line 57

def is_not_an_instance_of(expected_class, *args)
  @context.assert_not_instance_of(expected_class, @value, *args)
end

#is_not_empty(*args) ⇒ Object


102
103
104
# File 'lib/assert/actual_value.rb', line 102

def is_not_empty(*args)
  @context.assert_not_empty(@value, *args)
end

#is_not_false(*args) ⇒ Object


134
135
136
# File 'lib/assert/actual_value.rb', line 134

def is_not_false(*args)
  @context.assert_not_false(@value, *args)
end

#is_not_nil(*args) ⇒ Object


118
119
120
# File 'lib/assert/actual_value.rb', line 118

def is_not_nil(*args)
  @context.assert_not_nil(@value, *args)
end

#is_not_the_same_as(expected_object, *args) ⇒ Object Also known as: is_not


75
76
77
# File 'lib/assert/actual_value.rb', line 75

def is_not_the_same_as(expected_object, *args)
  @context.assert_not_same(expected_object, @value, *args)
end

#is_not_true(*args) ⇒ Object


126
127
128
# File 'lib/assert/actual_value.rb', line 126

def is_not_true(*args)
  @context.assert_not_true(@value, *args)
end

#is_the_same_as(expected_object, *args) ⇒ Object Also known as: is


70
71
72
# File 'lib/assert/actual_value.rb', line 70

def is_the_same_as(expected_object, *args)
  @context.assert_same(expected_object, @value, *args)
end

#is_true(*args) ⇒ Object


122
123
124
# File 'lib/assert/actual_value.rb', line 122

def is_true(*args)
  @context.assert_true(@value, *args)
end

#matches(expected_regex, *args) ⇒ Object


90
91
92
# File 'lib/assert/actual_value.rb', line 90

def matches(expected_regex, *args)
  @context.assert_match(expected_regex, @value, *args)
end

#raises(*expected_exceptions) ⇒ Object


24
25
26
# File 'lib/assert/actual_value.rb', line 24

def raises(*expected_exceptions)
  @context.assert_raises(*expected_exceptions, &@value)
end

#responds_to(expected_method_name, *args) ⇒ Object


62
63
64
# File 'lib/assert/actual_value.rb', line 62

def responds_to(expected_method_name, *args)
  @context.assert_responds_to(expected_method_name, @value, *args)
end

#returns_true(*args) ⇒ Object


16
17
18
# File 'lib/assert/actual_value.rb', line 16

def returns_true(*args)
  @context.assert_block(*args, &@value)
end