generator_spec 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -2
- data/Gemfile.lock +66 -81
- data/README.md +50 -44
- data/generator_spec.gemspec +4 -2
- data/lib/generator_spec/matcher.rb +1 -1
- data/lib/generator_spec/test_case.rb +6 -6
- data/lib/generator_spec/version.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- data/spec/support/file_system.rb +1 -0
- metadata +61 -10
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,97 +1,82 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
generator_spec (0.8.
|
5
|
-
|
6
|
-
|
4
|
+
generator_spec (0.8.5)
|
5
|
+
activerecord (>= 3.0, < 4.0)
|
6
|
+
railties (>= 3.0, < 4.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
activesupport (= 3.
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
mime-types (~> 1.16)
|
49
|
-
treetop (~> 1.4.8)
|
50
|
-
mime-types (1.16)
|
51
|
-
polyglot (0.3.2)
|
52
|
-
rack (1.2.3)
|
53
|
-
rack-mount (0.6.14)
|
54
|
-
rack (>= 1.0.0)
|
55
|
-
rack-test (0.5.7)
|
11
|
+
actionpack (3.2.9)
|
12
|
+
activemodel (= 3.2.9)
|
13
|
+
activesupport (= 3.2.9)
|
14
|
+
builder (~> 3.0.0)
|
15
|
+
erubis (~> 2.7.0)
|
16
|
+
journey (~> 1.0.4)
|
17
|
+
rack (~> 1.4.0)
|
18
|
+
rack-cache (~> 1.2)
|
19
|
+
rack-test (~> 0.6.1)
|
20
|
+
sprockets (~> 2.2.1)
|
21
|
+
activemodel (3.2.9)
|
22
|
+
activesupport (= 3.2.9)
|
23
|
+
builder (~> 3.0.0)
|
24
|
+
activerecord (3.2.9)
|
25
|
+
activemodel (= 3.2.9)
|
26
|
+
activesupport (= 3.2.9)
|
27
|
+
arel (~> 3.0.2)
|
28
|
+
tzinfo (~> 0.3.29)
|
29
|
+
activesupport (3.2.9)
|
30
|
+
i18n (~> 0.6)
|
31
|
+
multi_json (~> 1.0)
|
32
|
+
arel (3.0.2)
|
33
|
+
builder (3.0.4)
|
34
|
+
diff-lcs (1.1.3)
|
35
|
+
erubis (2.7.0)
|
36
|
+
fakefs (0.4.1)
|
37
|
+
hike (1.2.1)
|
38
|
+
i18n (0.6.1)
|
39
|
+
journey (1.0.4)
|
40
|
+
json (1.7.5)
|
41
|
+
multi_json (1.3.7)
|
42
|
+
rack (1.4.1)
|
43
|
+
rack-cache (1.2)
|
44
|
+
rack (>= 0.4)
|
45
|
+
rack-ssl (1.3.2)
|
46
|
+
rack
|
47
|
+
rack-test (0.6.2)
|
56
48
|
rack (>= 1.0)
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
activeresource (= 3.0.10)
|
62
|
-
activesupport (= 3.0.10)
|
63
|
-
bundler (~> 1.0)
|
64
|
-
railties (= 3.0.10)
|
65
|
-
railties (3.0.10)
|
66
|
-
actionpack (= 3.0.10)
|
67
|
-
activesupport (= 3.0.10)
|
49
|
+
railties (3.2.9)
|
50
|
+
actionpack (= 3.2.9)
|
51
|
+
activesupport (= 3.2.9)
|
52
|
+
rack-ssl (~> 1.3.2)
|
68
53
|
rake (>= 0.8.7)
|
69
54
|
rdoc (~> 3.4)
|
70
|
-
thor (
|
71
|
-
rake (0.
|
72
|
-
rdoc (3.
|
73
|
-
|
74
|
-
|
75
|
-
rspec-
|
76
|
-
rspec-
|
77
|
-
|
78
|
-
rspec-
|
79
|
-
|
80
|
-
|
81
|
-
rspec-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
tzinfo (0.3.29)
|
55
|
+
thor (>= 0.14.6, < 2.0)
|
56
|
+
rake (10.0.2)
|
57
|
+
rdoc (3.12)
|
58
|
+
json (~> 1.4)
|
59
|
+
rspec (2.12.0)
|
60
|
+
rspec-core (~> 2.12.0)
|
61
|
+
rspec-expectations (~> 2.12.0)
|
62
|
+
rspec-mocks (~> 2.12.0)
|
63
|
+
rspec-core (2.12.0)
|
64
|
+
rspec-expectations (2.12.0)
|
65
|
+
diff-lcs (~> 1.1.3)
|
66
|
+
rspec-mocks (2.12.0)
|
67
|
+
sprockets (2.2.1)
|
68
|
+
hike (~> 1.2)
|
69
|
+
multi_json (~> 1.0)
|
70
|
+
rack (~> 1.0)
|
71
|
+
tilt (~> 1.1, != 1.3.0)
|
72
|
+
thor (0.16.0)
|
73
|
+
tilt (1.3.3)
|
74
|
+
tzinfo (0.3.35)
|
91
75
|
|
92
76
|
PLATFORMS
|
93
77
|
ruby
|
94
78
|
|
95
79
|
DEPENDENCIES
|
96
|
-
fakefs
|
80
|
+
fakefs (~> 0.4.1)
|
97
81
|
generator_spec!
|
82
|
+
rspec
|
data/README.md
CHANGED
@@ -6,60 +6,66 @@ Test Rails generators with RSpec using the standard Rails::Generators::TestCase
|
|
6
6
|
|
7
7
|
Gemfile:
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
```ruby
|
10
|
+
group :test do
|
11
|
+
gem "generator_spec"
|
12
|
+
end
|
13
|
+
```
|
12
14
|
|
13
15
|
Spec:
|
14
16
|
|
15
|
-
|
17
|
+
```ruby
|
18
|
+
# spec/lib/generators/test/test_generator_spec.rb
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
describe TestGenerator do
|
20
|
-
include GeneratorSpec::TestCase
|
21
|
-
destination File.expand_path("../../tmp", __FILE__)
|
22
|
-
arguments %w(something)
|
20
|
+
require "generator_spec/test_case"
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
describe TestGenerator do
|
23
|
+
include GeneratorSpec::TestCase
|
24
|
+
destination File.expand_path("../../tmp", __FILE__)
|
25
|
+
arguments %w(something)
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
before(:all) do
|
28
|
+
prepare_destination
|
29
|
+
run_generator
|
30
|
+
end
|
31
|
+
|
32
|
+
it "creates a test initializer" do
|
33
|
+
assert_file "config/initializers/test.rb", "# Initializer"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
```
|
33
37
|
|
34
38
|
An RSpec file matching DSL is also provided, taken with permission from [beard](https://github.com/carlhuda/beard/blob/master/spec/support/matcher.rb) by [carlhuda](https://github.com/carlhuda).
|
35
39
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
```ruby
|
41
|
+
describe TestGenerator, "using custom matcher" do
|
42
|
+
include GeneratorSpec::TestCase
|
43
|
+
destination File.expand_path("../../tmp", __FILE__)
|
44
|
+
|
45
|
+
before do
|
46
|
+
prepare_destination
|
47
|
+
run_generator
|
48
|
+
end
|
44
49
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|
50
|
+
specify do
|
51
|
+
destination_root.should have_structure {
|
52
|
+
no_file "test.rb"
|
53
|
+
directory "config" do
|
54
|
+
directory "initializers" do
|
55
|
+
file "test.rb" do
|
56
|
+
contains "# Initializer"
|
54
57
|
end
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
end
|
59
|
+
end
|
60
|
+
directory "db" do
|
61
|
+
directory "migrate" do
|
62
|
+
file "123_create_tests.rb"
|
63
|
+
migration "create_tests" do
|
64
|
+
contains "class TestMigration"
|
62
65
|
end
|
63
|
-
|
66
|
+
end
|
64
67
|
end
|
65
|
-
|
68
|
+
}
|
69
|
+
end
|
70
|
+
end
|
71
|
+
```
|
data/generator_spec.gemspec
CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
|
-
s.add_dependency
|
22
|
-
s.add_dependency
|
21
|
+
s.add_dependency 'activerecord', ['>= 3.0', '< 4.0']
|
22
|
+
s.add_dependency 'railties', ['>= 3.0', '< 4.0']
|
23
|
+
s.add_development_dependency 'rspec'
|
24
|
+
s.add_development_dependency 'fakefs', '~> 0.4.1'
|
23
25
|
end
|
@@ -1,17 +1,17 @@
|
|
1
|
-
require '
|
1
|
+
require 'active_record'
|
2
|
+
require 'rspec'
|
2
3
|
require 'rails/generators/test_case'
|
3
4
|
require 'generator_spec/matcher'
|
4
5
|
|
5
6
|
module GeneratorSpec
|
6
7
|
module TestCase
|
7
8
|
extend ActiveSupport::Concern
|
8
|
-
include RSpec::Rails::RailsExampleGroup
|
9
9
|
include Matcher
|
10
10
|
include FileUtils
|
11
|
-
|
11
|
+
|
12
12
|
included do
|
13
13
|
cattr_accessor :test_case, :test_case_instance
|
14
|
-
|
14
|
+
|
15
15
|
self.test_case = Class.new(Rails::Generators::TestCase) do
|
16
16
|
def fake_test_case; end
|
17
17
|
def add_assertion; end
|
@@ -19,7 +19,7 @@ module GeneratorSpec
|
|
19
19
|
self.test_case_instance = self.test_case.new(:fake_test_case)
|
20
20
|
self.test_case.tests described_class
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
module ClassMethods
|
24
24
|
def tests(klass)
|
25
25
|
self.test_case.generator_class = klass
|
@@ -33,7 +33,7 @@ module GeneratorSpec
|
|
33
33
|
self.test_case.destination_root = path
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def method_missing(method_sym, *arguments, &block)
|
38
38
|
self.test_case_instance.send(method_sym, *arguments, &block)
|
39
39
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/file_system.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: generator_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement:
|
15
|
+
name: activerecord
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -24,18 +24,69 @@ dependencies:
|
|
24
24
|
version: '4.0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
33
|
+
- - <
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '4.0'
|
28
36
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
30
|
-
requirement:
|
37
|
+
name: railties
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
31
39
|
none: false
|
32
40
|
requirements:
|
33
41
|
- - ! '>='
|
34
42
|
- !ruby/object:Gem::Version
|
35
|
-
version: '0'
|
43
|
+
version: '3.0'
|
44
|
+
- - <
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '4.0'
|
36
47
|
type: :runtime
|
37
48
|
prerelease: false
|
38
|
-
version_requirements:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- - <
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '4.0'
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rspec
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
- !ruby/object:Gem::Dependency
|
75
|
+
name: fakefs
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ~>
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 0.4.1
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.4.1
|
39
90
|
description: Test Rails generators with RSpec
|
40
91
|
email:
|
41
92
|
- steve@hodgkiss.me.uk
|
@@ -82,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
133
|
version: '0'
|
83
134
|
requirements: []
|
84
135
|
rubyforge_project: generator_spec
|
85
|
-
rubygems_version: 1.8.
|
136
|
+
rubygems_version: 1.8.23
|
86
137
|
signing_key:
|
87
138
|
specification_version: 3
|
88
139
|
summary: Test Rails generators with RSpec
|