moto 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/test/base.rb +39 -8
  3. data/lib/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fce3539f78fcbeb9b1fcf873a8b49c67a6748815
4
- data.tar.gz: c0f573b45106c4b87d020087aca594325080492b
3
+ metadata.gz: 57aa2be0d77b80283f984a81699cf48d04b982d3
4
+ data.tar.gz: c1493c9833a9feaa83a1ce4fb257365bb759d472
5
5
  SHA512:
6
- metadata.gz: fca1c97fc516b98f36b63e176c0b744e861e6258290cdf6c9cc7f7d5b604357a1b59834b4c52385fa79a9e6ea4ea2eae8f08fe32a88a1a6c50b99910e67e1d1d
7
- data.tar.gz: 14dc36ce4501596219d1ed1a887e967d28858062ff34fbf984f804d7a7cc9c81d4363edd85b928df1c0b6d46febea1c4af0c05121838bdccdc2276e6b4229dce
6
+ metadata.gz: 9829b8ed8027069b1114e84126bc6467e805c82bf307d402440465636382561bdfe80d87d22de77ee9cb4285461f78287b660b190f96304d906f71b88983f976
7
+ data.tar.gz: 6cf34d8914f4016eff4382968b225ecf4dea20b033c8fe948ee42b44d27bcc9f048e343dee5a4bdabcb907313caae196a6f3cd41f845c524e44dae71f083dc8b
@@ -119,17 +119,48 @@ module Moto
119
119
  raise Exceptions::TestForcedPassed.new msg
120
120
  end
121
121
 
122
- # Checks if result of condition equals to True
123
- def assert(condition, message)
124
- if !condition
125
- line_number = caller.select { |l| l.match(/#{static_path}:\d*:in `run'/) }.first[/\d+/].to_i
126
-
127
- status.log_failure("ASSERTION FAILED in line #{line_number}: #{message}")
128
- logger.error(message)
129
- env
122
+ # Checks for equality of both values using operator ==
123
+ #
124
+ # @param [Object] value1
125
+ # @param [Object] value2
126
+ # @param [String] failure_message Will be logged/displayed when assertion fails.
127
+ # Substrings '$1' and '$2' (without quotes) found in string will be replaced,
128
+ # respectively, with value1.to_s and value2.to_s
129
+ def assert_equal(value1, value2, failure_message = "Arguments should be equal: $1 != $2")
130
+ if value1 != value2
131
+ report_failed_assertion(failure_message.gsub('$1', value1.to_s).gsub('$2', value2.to_s))
130
132
  end
131
133
  end
132
134
 
135
+ # Checks if passed value is equal to True
136
+ #
137
+ # @param [Object] value
138
+ # @param [String] failure_message Will be logged/displayed when assertion fails.
139
+ # Substring '$1' (without quotes) found in string will be replaced with value.to_s
140
+ def assert_true(value, failure_message = "Logical condition not met, expecting true, given $1")
141
+ if !value
142
+ report_failed_assertion(failure_message.gsub('$1', value.to_s))
143
+ end
144
+ end
145
+ alias_method :assert, :assert_true
146
+
147
+ # Checks if passed value is equal to False
148
+ #
149
+ # @param [Object] value
150
+ # @param [String] failure_message Will be logged/displayed when assertion fails.
151
+ # Substring '$1' (without quotes) found in string will be replaced with value.to_s
152
+ def assert_false(value, failure_message = "Logical condition not met, expecting false, given $1")
153
+ if value
154
+ report_failed_assertion(failure_message.gsub('$1', value.to_s))
155
+ end
156
+ end
157
+
158
+ def report_failed_assertion(failure_message)
159
+ line_number = caller.select { |l| l.match(/#{static_path}:\d*:in `run'/) }.first[/\d+/].to_i
160
+ status.log_failure("ASSERTION FAILED in line #{line_number}: #{failure_message}")
161
+ logger.error(message)
162
+ end
163
+
133
164
  # @return [Hash] Configuration for selected environment + current thread combination
134
165
  def env
135
166
  Moto::Lib::Config.environment_config
@@ -1,3 +1,3 @@
1
1
  module Moto
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartek Wilczek
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  requirements: []
121
121
  rubyforge_project:
122
- rubygems_version: 2.6.14
122
+ rubygems_version: 2.5.2.1
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: Moto - yet another testing framework