moto 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/assert.rb +32 -28
  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: a25d2e5d613094651fd59ffc0e1fa6bbc0189e57
4
- data.tar.gz: 1d40b56243d9de4d0ccaf829af8ccdbba3e852a3
3
+ metadata.gz: bf48b861993cd786e2c5b00c0db3b03487b039a7
4
+ data.tar.gz: 534ab46d6f0d346856b9ab68f415ed6cfd168360
5
5
  SHA512:
6
- metadata.gz: c2d8f57db8ea59908b824dda97930c4c26aa36bea4fcf0722cc81a929cfbcdd1b4fb960107474493e8244c15fe8f8b7c14007acfe035a9e1434e23603987ee6e
7
- data.tar.gz: c59f472bbcd38fadbdac0b57be214c90e5a062bf4b51f2a8d0f06b2cef70f3ab528c4bab9aa32464c2bab8af22048c4b8305b9757e004de572bf44a4b2f90478
6
+ metadata.gz: 4a5e0b9faf31928964213633ad46b7f95b3e00a2f42c4c4981f629e529cdbfe108c895f05b848279c7cbde7a49e0a3af0075c1ecc3bc76b507892b242c56154a
7
+ data.tar.gz: c6ba59d4bf795d99860dc55e5ad806e90e448d087aa6745aca5abc08fcd2fc66ec03527fb460cc940837cf60c48bf42a3bd1cfaaf02dedb7a42d2a4691ef2ae5
data/lib/assert.rb CHANGED
@@ -1,28 +1,32 @@
1
- module Moto
2
- module Assert
3
-
4
- def assert_equal(a, b)
5
- assert(a==b, "Arguments should be equal: #{a} != #{b}.")
6
- end
7
-
8
- def assert_true(b)
9
- assert(b, "Logical condition not met, expecting true, given false.")
10
- end
11
-
12
- def assert(condition, message)
13
- unless condition
14
-
15
- line_number = if @context.current_test.evaled
16
- caller.select{ |l| l.match(/\(eval\):\d*:in `run'/) }.first[/\d+/].to_i - 1 # -1 because of added method header in generated class
17
- else
18
- line_number = caller.select{ |l| l.match(/#{@context.current_test.static_path}:\d*:in `run'/) }.first[/\d+/].to_i - 1
19
- end
20
-
21
- full_message = "ASSERTION FAILED in line #{line_number}: #{message}"
22
- @context.runner.result.add_failure(self, full_message)
23
- logger.error(full_message)
24
- end
25
- end
26
-
27
- end
28
- end
1
+ module Moto
2
+ module Assert
3
+
4
+ def assert_equal(a, b)
5
+ assert(a==b, "Arguments should be equal: #{a} != #{b}.")
6
+ end
7
+
8
+ def assert_true(b)
9
+ assert(b, "Logical condition not met, expecting true, given false.")
10
+ end
11
+
12
+ def assert_false(b)
13
+ assert(!b, "Logical condition not met, expecting false, given true.")
14
+ end
15
+
16
+ def assert(condition, message)
17
+ unless condition
18
+
19
+ line_number = if @context.current_test.evaled
20
+ caller.select{ |l| l.match(/\(eval\):\d*:in `run'/) }.first[/\d+/].to_i - 1 # -1 because of added method header in generated class
21
+ else
22
+ line_number = caller.select{ |l| l.match(/#{@context.current_test.static_path}:\d*:in `run'/) }.first[/\d+/].to_i - 1
23
+ end
24
+
25
+ full_message = "ASSERTION FAILED in line #{line_number}: #{message}"
26
+ @context.runner.result.add_failure(self, full_message)
27
+ logger.error(full_message)
28
+ end
29
+ end
30
+
31
+ end
32
+ end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Moto
2
- VERSION = '0.0.20'
2
+ VERSION = '0.0.21'
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: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartek Wilczek
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-01-20 00:00:00.000000000 Z
13
+ date: 2016-01-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport