transpec 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/transpec/context.rb +10 -12
- data/lib/transpec/rewriter.rb +1 -0
- data/lib/transpec/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/transpec/context_spec.rb +1 -1
- data/spec/transpec/rewriter_spec.rb +12 -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: beba3d9ff0b918b0a1cddea7745022270fdfb5ee
|
4
|
+
data.tar.gz: 014a462a96ef9bbed89c5fc27be89cdddea42e4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 477b28e6fddc2cdad7b215339510cda28f6c826f721bef67388518e4640dbc82b98f6047ce425cce826aae04e3c99096407b493cb17e109a54920377539d2050
|
7
|
+
data.tar.gz: e0d529dc8bf9e6159ecbb4d8d16e0c2a12001c080ad155d572c83f05b186a7234144108fa97a2371e92c576ef292c6a818e76160226d5ab0a817b104b6c142d2
|
data/CHANGELOG.md
CHANGED
data/lib/transpec/context.rb
CHANGED
@@ -64,24 +64,14 @@ module Transpec
|
|
64
64
|
|
65
65
|
def non_monkey_patch_expectation_available?
|
66
66
|
return @expectation_available if instance_variable_defined?(:@expectation_available)
|
67
|
-
|
68
|
-
return @expectation_available = true if scopes == [:def]
|
69
|
-
|
70
|
-
@expectation_available = NON_MONKEY_PATCH_EXPECTATION_AVAILABLE_CONTEXT.any? do |suffix|
|
71
|
-
scopes.end_with?(suffix)
|
72
|
-
end
|
67
|
+
@expectation_available = match_scopes(NON_MONKEY_PATCH_EXPECTATION_AVAILABLE_CONTEXT)
|
73
68
|
end
|
74
69
|
|
75
70
|
alias_method :expect_to_matcher_available?, :non_monkey_patch_expectation_available?
|
76
71
|
|
77
72
|
def non_monkey_patch_mock_available?
|
78
73
|
return @mock_available if instance_variable_defined?(:@mock_available)
|
79
|
-
|
80
|
-
return @mock_available = true if scopes == [:def]
|
81
|
-
|
82
|
-
@mock_available = NON_MONKEY_PATCH_MOCK_AVAILABLE_CONTEXT.any? do |suffix|
|
83
|
-
scopes.end_with?(suffix)
|
84
|
-
end
|
74
|
+
@mock_available = match_scopes(NON_MONKEY_PATCH_MOCK_AVAILABLE_CONTEXT)
|
85
75
|
end
|
86
76
|
|
87
77
|
alias_method :expect_to_receive_available?, :non_monkey_patch_mock_available?
|
@@ -140,6 +130,14 @@ module Transpec
|
|
140
130
|
:each_before_after
|
141
131
|
end
|
142
132
|
|
133
|
+
def match_scopes(scope_suffixes)
|
134
|
+
return true if scopes == [:def]
|
135
|
+
|
136
|
+
scope_suffixes.any? do |suffix|
|
137
|
+
scopes.end_with?(suffix)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
143
141
|
module ArrayExtension
|
144
142
|
def end_with?(*args)
|
145
143
|
tail = args.flatten
|
data/lib/transpec/rewriter.rb
CHANGED
data/lib/transpec/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -13,6 +13,8 @@ RSpec.configure do |config|
|
|
13
13
|
config.color_enabled = true
|
14
14
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
15
15
|
|
16
|
+
config.filter_run_excluding :skip_on_jruby if RUBY_ENGINE == 'jruby'
|
17
|
+
|
16
18
|
config.before(:all) do
|
17
19
|
require 'rainbow'
|
18
20
|
Sickill::Rainbow.enabled = false
|
@@ -15,6 +15,7 @@ module Transpec
|
|
15
15
|
|
16
16
|
before do
|
17
17
|
File.write(file_path, 'This is a spec')
|
18
|
+
File.utime(0, 0, file_path)
|
18
19
|
rewriter.stub(:rewrite).and_return('This is the rewritten spec')
|
19
20
|
end
|
20
21
|
|
@@ -22,6 +23,17 @@ module Transpec
|
|
22
23
|
rewriter.rewrite_file!(file_path)
|
23
24
|
File.read(file_path).should == 'This is the rewritten spec'
|
24
25
|
end
|
26
|
+
|
27
|
+
context 'when the source does not need rewrite' do
|
28
|
+
before do
|
29
|
+
rewriter.stub(:rewrite).and_return('This is a spec')
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'does not touch the file' do
|
33
|
+
rewriter.rewrite_file!(file_path)
|
34
|
+
File.mtime(file_path).should == Time.at(0)
|
35
|
+
end
|
36
|
+
end
|
25
37
|
end
|
26
38
|
|
27
39
|
describe '#rewrite' do
|
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.5
|
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-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|