transpec 0.2.1 → 0.2.2

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: 4d602d29834b9ea79fc7bc396d76bfc450958491
4
- data.tar.gz: 9bdc9410fd4eb71537ce875d30d74012ba657423
3
+ metadata.gz: 23e8df69cf26a5fe92e93cb0817062746ab6ceaa
4
+ data.tar.gz: 615b879c9b613ff061b6e2cbc2268eb2b77f229e
5
5
  SHA512:
6
- metadata.gz: 3dcf40c9f6f8572a5d8e52c29e3e1129fb838ae8a9f156416a3aeff098e4e96e0c2875c311a235596f3d7c97aea39815cdfc20e5a02b7000c34f4b13d5d59239
7
- data.tar.gz: 30c6807002ede033c51db526f201863c787c1926250c6ada8e9d34457e192c8ede222b6c2fb4f9a26cdc36558169406b1d8582c42a9d3e7a56cd7a75da46b811
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
@@ -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
@@ -5,7 +5,7 @@ module Transpec
5
5
  module Version
6
6
  MAJOR = 0
7
7
  MINOR = 2
8
- PATCH = 1
8
+ PATCH = 2
9
9
 
10
10
  def self.to_s
11
11
  [MAJOR, MINOR, PATCH].join('.')
@@ -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.1
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-06 00:00:00.000000000 Z
11
+ date: 2013-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser