generator_spec 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +8 -3
- data/Gemfile +5 -0
- data/README.md +1 -1
- data/generator_spec.gemspec +1 -1
- data/lib/generator_spec.rb +1 -3
- data/lib/generator_spec/version.rb +1 -1
- data/spec/generator_spec/generator_example_group_spec.rb +1 -1
- data/spec/generator_spec/matcher_spec.rb +11 -11
- data/spec/generator_spec/test_case_spec.rb +6 -4
- data/spec/support/helpers.rb +2 -10
- data/spec/support/matchers.rb +1 -1
- metadata +18 -26
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b7e9059728e32e462c0ba6f3d27c2ff641f958d8
|
4
|
+
data.tar.gz: 0256f4c0a7b39b431723ed4291f5e3b31a13eb9b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 88e68ec9f6ae5c4b0ce18a68c6daabbf0bc65a15b325795dac059498b9bfe6cef524a64ad516c58012e2cec579bc94fa8e87cecd5d37be6bee58d0e7ee711ec4
|
7
|
+
data.tar.gz: 3100f8a199176d304187d3e61ce3f5194f7654d95bb466f7c086e7fdcea0f81c9080447c767ce54fb078ad0aadbdff651c5933d981bdbc2a0218ef433ccc01d0
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Generator Spec
|
1
|
+
# Generator Spec [![Build Status](https://travis-ci.org/stevehodgkiss/generator_spec.svg?branch=master)](https://travis-ci.org/stevehodgkiss/generator_spec)
|
2
2
|
|
3
3
|
Test Rails generators with RSpec using the standard Rails::Generators::TestCase assertion methods.
|
4
4
|
|
data/generator_spec.gemspec
CHANGED
data/lib/generator_spec.rb
CHANGED
@@ -6,7 +6,5 @@ RSpec::configure do |c|
|
|
6
6
|
Regexp.compile(parts.join('[\\\/]') + '[\\\/]')
|
7
7
|
end
|
8
8
|
|
9
|
-
c.include GeneratorSpec::GeneratorExampleGroup, :type => :generator, :
|
10
|
-
:file_path => c.escaped_path(%w[spec lib generators])
|
11
|
-
}
|
9
|
+
c.include GeneratorSpec::GeneratorExampleGroup, :type => :generator, :file_path => c.escaped_path(%w[spec lib generators])
|
12
10
|
end
|
@@ -15,7 +15,7 @@ describe TestGenerator, 'using custom matcher' do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
specify do
|
18
|
-
destination_root.
|
18
|
+
expect(destination_root).to have_structure {
|
19
19
|
no_file 'test.rb'
|
20
20
|
directory 'config' do
|
21
21
|
directory 'initializers' do
|
@@ -37,7 +37,7 @@ describe TestGenerator, 'using custom matcher' do
|
|
37
37
|
|
38
38
|
it 'fails when it doesnt match' do
|
39
39
|
expect {
|
40
|
-
destination_root.
|
40
|
+
expect(destination_root).to have_structure {
|
41
41
|
directory 'db' do
|
42
42
|
directory 'migrate' do
|
43
43
|
no_file '123_create_tests.rb'
|
@@ -145,7 +145,7 @@ module GeneratorSpec
|
|
145
145
|
describe Directory do
|
146
146
|
describe '#location' do
|
147
147
|
it 'equals the full path' do
|
148
|
-
Directory.new('test').location('test_2').
|
148
|
+
expect(Directory.new('test').location('test_2')).to eq('test/test_2')
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
@@ -155,7 +155,7 @@ module GeneratorSpec
|
|
155
155
|
dir = Directory.new 'test' do
|
156
156
|
directory 'dir'
|
157
157
|
end
|
158
|
-
dir.tree['dir'].
|
158
|
+
expect(dir.tree['dir']).to eq(false)
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
@@ -166,8 +166,8 @@ module GeneratorSpec
|
|
166
166
|
directory 'test_2'
|
167
167
|
end
|
168
168
|
end
|
169
|
-
dir.tree['dir'].
|
170
|
-
dir.tree['dir'].tree['test_2'].
|
169
|
+
expect(dir.tree['dir']).to be_an_instance_of(Directory)
|
170
|
+
expect(dir.tree['dir'].tree['test_2']).to eq(false)
|
171
171
|
end
|
172
172
|
end
|
173
173
|
end
|
@@ -177,7 +177,7 @@ module GeneratorSpec
|
|
177
177
|
dir = Directory.new 'test' do
|
178
178
|
file 'test_file'
|
179
179
|
end
|
180
|
-
dir.tree['test_file'].
|
180
|
+
expect(dir.tree['test_file']).to be_an_instance_of(File)
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
@@ -186,8 +186,8 @@ module GeneratorSpec
|
|
186
186
|
dir = Directory.new 'test' do
|
187
187
|
migration 'test_file'
|
188
188
|
end
|
189
|
-
dir.tree['test_file'].
|
190
|
-
dir.tree['test_file'].instance_variable_get('@name').
|
189
|
+
expect(dir.tree['test_file']).to be_an_instance_of(Migration)
|
190
|
+
expect(dir.tree['test_file'].instance_variable_get('@name')).to eq('test/test_file')
|
191
191
|
end
|
192
192
|
end
|
193
193
|
|
@@ -287,11 +287,11 @@ module GeneratorSpec
|
|
287
287
|
|
288
288
|
it 'returns true on no failures' do
|
289
289
|
write_directory(TMP_ROOT.join('test/test_dir'))
|
290
|
-
root.matches?(TMP_ROOT).
|
290
|
+
expect(root.matches?(TMP_ROOT)).to be_truthy
|
291
291
|
end
|
292
292
|
|
293
293
|
it 'returns false on failures' do
|
294
|
-
root.matches?(TMP_ROOT).
|
294
|
+
expect(root.matches?(TMP_ROOT)).to be_falsey
|
295
295
|
end
|
296
296
|
end
|
297
297
|
end
|
@@ -7,20 +7,22 @@ end
|
|
7
7
|
describe GeneratorSpec::TestCase do
|
8
8
|
before do
|
9
9
|
@klass = Class.new do
|
10
|
-
self.
|
10
|
+
def self.described_class
|
11
|
+
TestClass
|
12
|
+
end
|
11
13
|
include GeneratorSpec::TestCase
|
12
14
|
end
|
13
15
|
@klass.test_case_instance = double
|
14
16
|
end
|
15
17
|
|
16
18
|
it 'passes unknown messages on to test_case_instance' do
|
17
|
-
@klass.test_case_instance.
|
19
|
+
expect(@klass.test_case_instance).to receive(:assert_file).with('test')
|
18
20
|
@klass.new.assert_file('test')
|
19
21
|
end
|
20
22
|
|
21
23
|
it 'handles respond_to accordingly' do
|
22
|
-
@klass.test_case_instance.
|
23
|
-
@klass.new.respond_to?(:assert_no_file).
|
24
|
+
expect(@klass.test_case_instance).to receive(:respond_to?).with(:assert_no_file).and_return(true)
|
25
|
+
expect(@klass.new.respond_to?(:assert_no_file)).to be_truthy
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
data/spec/support/helpers.rb
CHANGED
@@ -2,19 +2,11 @@
|
|
2
2
|
module Helpers
|
3
3
|
def stub_metadata(additional_metadata)
|
4
4
|
stub_metadata = metadata_with(additional_metadata)
|
5
|
-
RSpec::Core::ExampleGroup.
|
5
|
+
allow(RSpec::Core::ExampleGroup).to receive(:metadata) { stub_metadata }
|
6
6
|
end
|
7
7
|
|
8
8
|
def metadata_with(additional_metadata)
|
9
|
-
|
10
|
-
m.process("example group")
|
11
|
-
|
12
|
-
group_metadata = additional_metadata.delete(:example_group)
|
13
|
-
if group_metadata
|
14
|
-
m[:example_group].merge!(group_metadata)
|
15
|
-
end
|
16
|
-
m.merge!(additional_metadata)
|
17
|
-
m
|
9
|
+
::RSpec.describe("example group").metadata.merge(additional_metadata)
|
18
10
|
end
|
19
11
|
|
20
12
|
RSpec.configure {|c| c.include self}
|
data/spec/support/matchers.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
RSpec::Matchers::define :be_included_in_files_in do |path|
|
4
4
|
match do |mod|
|
5
5
|
stub_metadata(
|
6
|
-
:
|
6
|
+
:file_path => "#{path}whatever_spec.rb:15"
|
7
7
|
)
|
8
8
|
group = RSpec::Core::ExampleGroup.describe
|
9
9
|
group.included_modules.include?(mod)
|
metadata
CHANGED
@@ -1,64 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: generator_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
5
|
-
prerelease:
|
4
|
+
version: 0.9.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Steve Hodgkiss
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-11-28 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 3.0.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 3.0.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: railties
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 3.0.0
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 3.0.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
47
|
+
version: '3.0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
54
|
+
version: '3.0'
|
62
55
|
description: Test Rails generators with RSpec
|
63
56
|
email:
|
64
57
|
- steve@hodgkiss.me.uk
|
@@ -66,9 +59,9 @@ executables: []
|
|
66
59
|
extensions: []
|
67
60
|
extra_rdoc_files: []
|
68
61
|
files:
|
69
|
-
- .gitignore
|
70
|
-
- .rspec
|
71
|
-
- .travis.yml
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
72
65
|
- Gemfile
|
73
66
|
- MIT-LICENSE
|
74
67
|
- README.md
|
@@ -92,27 +85,26 @@ files:
|
|
92
85
|
homepage: https://github.com/stevehodgkiss/generator_spec
|
93
86
|
licenses:
|
94
87
|
- MIT
|
88
|
+
metadata: {}
|
95
89
|
post_install_message:
|
96
90
|
rdoc_options: []
|
97
91
|
require_paths:
|
98
92
|
- lib
|
99
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
-
none: false
|
101
94
|
requirements:
|
102
|
-
- -
|
95
|
+
- - ">="
|
103
96
|
- !ruby/object:Gem::Version
|
104
97
|
version: '0'
|
105
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
99
|
requirements:
|
108
|
-
- -
|
100
|
+
- - ">="
|
109
101
|
- !ruby/object:Gem::Version
|
110
102
|
version: '0'
|
111
103
|
requirements: []
|
112
104
|
rubyforge_project: generator_spec
|
113
|
-
rubygems_version:
|
105
|
+
rubygems_version: 2.2.2
|
114
106
|
signing_key:
|
115
|
-
specification_version:
|
107
|
+
specification_version: 4
|
116
108
|
summary: Test Rails generators with RSpec
|
117
109
|
test_files:
|
118
110
|
- spec/generator_spec/generator_example_group_spec.rb
|