matest 1.6.9 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef6c11d42eabb319915160abb327bf2bd1f3489c
4
- data.tar.gz: f418b7b4f472b7a20c69a36b5a5832507a738f9c
3
+ metadata.gz: 5c7b101e40bda15067b116796ccb0060a9f6b607
4
+ data.tar.gz: d85e60ef5c8febc5576dd564b3573a3a5b1aaf06
5
5
  SHA512:
6
- metadata.gz: 40976fb568f3768631f893bc0a9fc3ac6fdec6845ac802051bf1232b4440867a295cc4101937e644694ef2837f707c0a23e550d9a6bfb8ce3e27944be3b08108
7
- data.tar.gz: f1f8a33f724758b22428e6eaf729942a7696da5008ad95fbf8d22b6d84ceb900162fe655b5f614f40dbec8722f01db2de2816374e9ada6ac0ff5341713a46b0d
6
+ metadata.gz: 4126278afdc314d82a5c72664e55e7b184da2287a37103f49cf0ef7bb701e246f1702568b3dd9ce1c89c74c9d11ae73a1f13f91b81f4738ef4e9d8061b3cec41
7
+ data.tar.gz: ec48e865d456f5b58c1bf0cd5000b8a469bccdfa4e81c54c8a86edb4b736b0d8f8699fb0350b90092c5e2182ab3ff036cf551249d3dce37acd1653e1d28dfb82
@@ -1,5 +1,6 @@
1
1
  module Matest
2
2
  class Example
3
+ attr_reader :code
3
4
  def initialize(example_block, description, lets)
4
5
  @example_block__for_internal_use = ExampleBlock.new(example_block)
5
6
  @description__for_internal_use = description
@@ -81,12 +81,14 @@ module Matest
81
81
  end
82
82
  end
83
83
 
84
- def print_subexpression(code, status)
85
- just_before_assertion = status.example.just_before_assertion
86
- result = Evaluator.new(just_before_assertion, just_before_assertion.before_assertion_block).eval_string(code)
84
+ def print_subexpression(subexpression, status)
85
+ just_before_assertion = status.example.just_before_assertion.code
86
+ code = just_before_assertion + subexpression
87
+
88
+ result = Evaluator.new(just_before_assertion, proc{}).eval_string(code)
87
89
  if result.class != Matest::EvalErr
88
90
  explanation = []
89
- explanation << expression(" #{code}")
91
+ explanation << expression(" #{subexpression}")
90
92
  explanation << "\n"
91
93
  explanation << value(" # => #{result}")
92
94
  puts explanation.join
@@ -96,7 +98,6 @@ module Matest
96
98
  The assertion couldn't be explained.
97
99
  The error message was:
98
100
  #{result}
99
- Make sure you are not calling any local vaiables on your code assertion.
100
101
  CODE
101
102
  puts error(code)
102
103
  false
@@ -1,3 +1,3 @@
1
1
  module Matest
2
- VERSION = "1.6.9"
2
+ VERSION = "1.7.0"
3
3
  end
@@ -0,0 +1,17 @@
1
+ require "spec_helper"
2
+
3
+ scope do
4
+ spec "it explains local variables on failure" do
5
+ a = 5
6
+ b = 6
7
+
8
+ a + b == 10
9
+ end
10
+
11
+ spec "it explains local variables on non natural" do
12
+ a = 5
13
+ b = 6
14
+
15
+ a + rand(b)
16
+ end
17
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.9
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Federico Iachetti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-17 00:00:00.000000000 Z
11
+ date: 2015-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,6 +100,7 @@ files:
100
100
  - matest.gemspec
101
101
  - spec/matest_spec.rb
102
102
  - spec/matest_specs/aliases_spec.rb
103
+ - spec/matest_specs/explanation_spec.rb
103
104
  - spec/matest_specs/failing_spec.rb
104
105
  - spec/matest_specs/matchers_spec.rb
105
106
  - spec/matest_specs/nested_scopes_spec.rb
@@ -130,13 +131,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
131
  version: '0'
131
132
  requirements: []
132
133
  rubyforge_project:
133
- rubygems_version: 2.4.6
134
+ rubygems_version: 2.4.8
134
135
  signing_key:
135
136
  specification_version: 4
136
137
  summary: Tests gasoleros (cheap tests).
137
138
  test_files:
138
139
  - spec/matest_spec.rb
139
140
  - spec/matest_specs/aliases_spec.rb
141
+ - spec/matest_specs/explanation_spec.rb
140
142
  - spec/matest_specs/failing_spec.rb
141
143
  - spec/matest_specs/matchers_spec.rb
142
144
  - spec/matest_specs/nested_scopes_spec.rb