transpec 0.2.1 → 0.2.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/transpec/rewriter.rb +4 -0
- data/lib/transpec/syntax/rspec_configure.rb +3 -1
- data/lib/transpec/version.rb +1 -1
- data/spec/transpec/rewriter_spec.rb +10 -0
- data/spec/transpec/syntax/rspec_configure_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23e8df69cf26a5fe92e93cb0817062746ab6ceaa
|
4
|
+
data.tar.gz: 615b879c9b613ff061b6e2cbc2268eb2b77f229e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d6bd922cb89047a78a052b933dedb9aa720136603e06a2e63ee9da37b2b81807dccad7defb05d7d09b2ec42601ce01681c3d0ef633981cc64dc9c7b1475cee3
|
7
|
+
data.tar.gz: d2a37cf90928208e85486b5de0b5f8d40603f0239a7591586cdeca69637ce553e2ff71aad28811d3f871ceefd69ef1201605b94a77dbe544cd2ccaed5f6308b9
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## Master
|
4
4
|
|
5
|
+
## v0.2.2
|
6
|
+
|
7
|
+
* Fix a crash on syntax configuration with variable in `RSpec.configure` (e.g. `RSpec.configure { |config| config.expect_with { |c| c.syntax = some_syntax } }`)
|
8
|
+
|
5
9
|
## v0.2.1
|
6
10
|
|
7
11
|
* Fix a crash on operator matcher that have `__FILE__` in its arguments
|
data/lib/transpec/rewriter.rb
CHANGED
@@ -152,12 +152,16 @@ module Transpec
|
|
152
152
|
def need_to_modify_expectation_syntax_configuration?(rspec_configure)
|
153
153
|
return false unless @configuration.convert_to_expect_to_matcher?
|
154
154
|
rspec_configure.expectation_syntaxes == [:should]
|
155
|
+
rescue Syntax::RSpecConfigure::UnknownSyntaxError
|
156
|
+
false
|
155
157
|
end
|
156
158
|
|
157
159
|
def need_to_modify_mock_syntax_configuration?(rspec_configure)
|
158
160
|
return false if !@configuration.convert_to_expect_to_receive? &&
|
159
161
|
!@configuration.convert_to_allow_to_receive?
|
160
162
|
rspec_configure.mock_syntaxes == [:should]
|
163
|
+
rescue Syntax::RSpecConfigure::UnknownSyntaxError
|
164
|
+
false
|
161
165
|
end
|
162
166
|
|
163
167
|
class OverlappedRewriteError < StandardError; end
|
@@ -27,7 +27,7 @@ module Transpec
|
|
27
27
|
child_node.children.first
|
28
28
|
end
|
29
29
|
else
|
30
|
-
fail
|
30
|
+
fail UnknownSyntaxError, "Unknown syntax specification: #{syntaxes_node}"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -108,6 +108,8 @@ module Transpec
|
|
108
108
|
|
109
109
|
add_framework_configuration :expectation, :expect_with
|
110
110
|
add_framework_configuration :mock, :mock_with
|
111
|
+
|
112
|
+
class UnknownSyntaxError < StandardError; end
|
111
113
|
end
|
112
114
|
end
|
113
115
|
end
|
data/lib/transpec/version.rb
CHANGED
@@ -526,6 +526,16 @@ module Transpec
|
|
526
526
|
end
|
527
527
|
end
|
528
528
|
end
|
529
|
+
|
530
|
+
context "and RSpecConfigure##{syntaxes_reader} raises UnknownSyntaxError" do
|
531
|
+
before do
|
532
|
+
rspec_configure.stub(syntaxes_reader).and_raise(Syntax::RSpecConfigure::UnknownSyntaxError)
|
533
|
+
end
|
534
|
+
|
535
|
+
it 'returns false' do
|
536
|
+
should be_false
|
537
|
+
end
|
538
|
+
end
|
529
539
|
end
|
530
540
|
|
531
541
|
describe '#need_to_modify_expectation_syntax_configuration?' do
|
@@ -59,6 +59,22 @@ module Transpec
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
+
context 'when the syntax is specified indirectly with method or variable' do
|
63
|
+
let(:source) do
|
64
|
+
<<-END
|
65
|
+
RSpec.configure do |config|
|
66
|
+
config.#{config_block_method} :rspec do |c|
|
67
|
+
c.syntax = some_syntax
|
68
|
+
end
|
69
|
+
end
|
70
|
+
END
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'raises error' do
|
74
|
+
-> { subject }.should raise_error(RSpecConfigure::UnknownSyntaxError)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
62
78
|
context "when RSpec::Core::Configuration##{config_block_method} block does not exist" do
|
63
79
|
let(:source) do
|
64
80
|
<<-END
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transpec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Nakayama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|