ammeter 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -0
- data/README.md +8 -1
- data/Rakefile +4 -2
- data/ammeter.gemspec +7 -2
- data/lib/ammeter/rspec/generator/example/generator_example_group.rb +8 -2
- data/lib/ammeter/version.rb +1 -1
- data/spec/ammeter/rspec/rails/generator/example/generator_example_group_spec.rb +25 -14
- metadata +79 -56
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,7 +1,14 @@
|
|
1
|
-
# Ammeter
|
1
|
+
# Ammeter [![Build Status](https://secure.travis-ci.org/alexrothenberg/ammeter.png)](http://travis-ci.org/alexrothenberg/ammeter)
|
2
2
|
|
3
3
|
A gem that makes it easy to write specs for your Rails 3 Generators.
|
4
4
|
|
5
|
+
RSpec is using ammeter to
|
6
|
+
[spec](https://github.com/rspec/rspec-rails/blob/master/spec/generators/rspec/model/model_generator_spec.rb)
|
7
|
+
[its](https://github.com/rspec/rspec-rails/blob/master/spec/generators/rspec/controller/controller_generator_spec.rb)
|
8
|
+
[own](https://github.com/rspec/rspec-rails/blob/master/spec/generators/rspec/helper/helper_generator_spec.rb)
|
9
|
+
[generators](https://github.com/rspec/rspec-rails/blob/master/spec/generators/rspec/scaffold/scaffold_generator_spec.rb)
|
10
|
+
and we think you may find it useful too.
|
11
|
+
|
5
12
|
An [ammeter](http://en.wikipedia.org/wiki/Ammeter) is used to measure electrical current and
|
6
13
|
electricity can be produced by a generator.
|
7
14
|
|
data/Rakefile
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'bundler'
|
2
|
+
require 'bundler/setup'
|
2
3
|
Bundler::GemHelper.install_tasks
|
3
4
|
|
4
|
-
require '
|
5
|
+
require 'rdoc/task'
|
5
6
|
require 'rspec'
|
6
7
|
require 'rspec/core/rake_task'
|
7
8
|
require 'cucumber/rake/task'
|
@@ -45,4 +46,5 @@ namespace :clobber do
|
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
48
|
-
task :
|
49
|
+
task :ci => [:spec, :'clobber:app', :'generate:app', :cucumber]
|
50
|
+
task :default => :ci
|
data/ammeter.gemspec
CHANGED
@@ -21,8 +21,13 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_runtime_dependency 'rspec', '~> 2'
|
22
22
|
s.add_runtime_dependency 'rspec-rails', '~> 2'
|
23
23
|
|
24
|
-
s.add_development_dependency 'rails', '~> 3'
|
25
|
-
s.add_development_dependency '
|
24
|
+
s.add_development_dependency 'rails', '~> 3.1'
|
25
|
+
s.add_development_dependency 'uglifier'
|
26
|
+
s.add_development_dependency 'turn'
|
27
|
+
s.add_development_dependency 'rake'
|
28
|
+
s.add_development_dependency 'coffee-rails'
|
29
|
+
s.add_development_dependency 'sass-rails'
|
30
|
+
s.add_development_dependency 'jquery-rails'
|
26
31
|
s.add_development_dependency 'cucumber', '~> 0.10'
|
27
32
|
s.add_development_dependency 'aruba', '~> 0.3'
|
28
33
|
s.add_development_dependency 'sqlite3', '~> 1'
|
@@ -9,8 +9,8 @@ module Ammeter
|
|
9
9
|
extend ActiveSupport::Concern
|
10
10
|
include ::RSpec::Rails::RailsExampleGroup
|
11
11
|
|
12
|
-
DELEGATED_METHODS = [:generator, :
|
13
|
-
:
|
12
|
+
DELEGATED_METHODS = [:generator, :capture, :prepare_destination,
|
13
|
+
:destination_root, :current_path, :generator_class]
|
14
14
|
module ClassMethods
|
15
15
|
mattr_accessor :test_unit_test_case_delegate
|
16
16
|
delegate :default_arguments, :to => :'self.test_unit_test_case_delegate'
|
@@ -41,6 +41,12 @@ module Ammeter
|
|
41
41
|
DELEGATED_METHODS.each do |method|
|
42
42
|
delegate method, :to => :'self.class'
|
43
43
|
end
|
44
|
+
def destination_root_is_set? #:nodoc:
|
45
|
+
raise "You need to configure your Rails::Generators::TestCase destination root." unless destination_root
|
46
|
+
end
|
47
|
+
def ensure_current_path #:nodoc:
|
48
|
+
# cd current_path
|
49
|
+
end
|
44
50
|
initialize_delegate
|
45
51
|
|
46
52
|
subject { generator }
|
data/lib/ammeter/version.rb
CHANGED
@@ -5,30 +5,41 @@ module Ammeter::RSpec::Rails
|
|
5
5
|
it { should be_included_in_files_in('./spec/generators/') }
|
6
6
|
it { should be_included_in_files_in('.\\spec\\generators\\') }
|
7
7
|
|
8
|
-
let(:
|
8
|
+
let(:group_class) do
|
9
9
|
::RSpec::Core::ExampleGroup.describe do
|
10
10
|
include GeneratorExampleGroup
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
it "adds :type => :generator to the metadata" do
|
15
|
-
|
15
|
+
group_class.metadata[:type].should eq(:generator)
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
describe 'an instance of the group' do
|
19
|
+
let(:group) { group_class.new }
|
20
|
+
subject { group }
|
21
|
+
let(:generator) { double('generator') }
|
22
|
+
before { group.stub(:generator => generator) }
|
23
|
+
describe 'uses the generator as the implicit subject' do
|
24
|
+
its(:subject) { should == generator }
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "allows you to override with explicity subject" do
|
28
|
+
before { group_class.subject { 'explicit' } }
|
29
|
+
its(:subject) { should == 'explicit' }
|
24
30
|
end
|
25
|
-
end
|
26
31
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
+
describe 'able to delegate to ::Rails::Generators::TestCase' do
|
33
|
+
it 'should know the destination is not set' do
|
34
|
+
lambda { group.destination_root_is_set? }.should raise_error "You need to configure your Rails::Generators::TestCase destination root."
|
35
|
+
end
|
36
|
+
describe 'with a destination root' do
|
37
|
+
before { group.destination '/some/path' }
|
38
|
+
its(:destination_root) { should == '/some/path' }
|
39
|
+
it 'should know the destination is set' do
|
40
|
+
lambda { group.destination_root_is_set? }.should_not raise_error
|
41
|
+
end
|
42
|
+
end
|
32
43
|
end
|
33
44
|
end
|
34
45
|
end
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ammeter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 27
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 0.1.0
|
5
|
+
version: 0.1.1
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Alex Rothenberg
|
@@ -15,125 +10,152 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-
|
13
|
+
date: 2011-09-01 00:00:00 -04:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
22
17
|
name: railties
|
23
|
-
prerelease: false
|
24
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
19
|
none: false
|
26
20
|
requirements:
|
27
21
|
- - ~>
|
28
22
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 5
|
30
|
-
segments:
|
31
|
-
- 3
|
32
23
|
version: "3"
|
33
24
|
type: :runtime
|
25
|
+
prerelease: false
|
34
26
|
version_requirements: *id001
|
35
27
|
- !ruby/object:Gem::Dependency
|
36
28
|
name: rspec
|
37
|
-
prerelease: false
|
38
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
30
|
none: false
|
40
31
|
requirements:
|
41
32
|
- - ~>
|
42
33
|
- !ruby/object:Gem::Version
|
43
|
-
hash: 7
|
44
|
-
segments:
|
45
|
-
- 2
|
46
34
|
version: "2"
|
47
35
|
type: :runtime
|
36
|
+
prerelease: false
|
48
37
|
version_requirements: *id002
|
49
38
|
- !ruby/object:Gem::Dependency
|
50
39
|
name: rspec-rails
|
51
|
-
prerelease: false
|
52
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
41
|
none: false
|
54
42
|
requirements:
|
55
43
|
- - ~>
|
56
44
|
- !ruby/object:Gem::Version
|
57
|
-
hash: 7
|
58
|
-
segments:
|
59
|
-
- 2
|
60
45
|
version: "2"
|
61
46
|
type: :runtime
|
47
|
+
prerelease: false
|
62
48
|
version_requirements: *id003
|
63
49
|
- !ruby/object:Gem::Dependency
|
64
50
|
name: rails
|
65
|
-
prerelease: false
|
66
51
|
requirement: &id004 !ruby/object:Gem::Requirement
|
67
52
|
none: false
|
68
53
|
requirements:
|
69
54
|
- - ~>
|
70
55
|
- !ruby/object:Gem::Version
|
71
|
-
|
72
|
-
segments:
|
73
|
-
- 3
|
74
|
-
version: "3"
|
56
|
+
version: "3.1"
|
75
57
|
type: :development
|
58
|
+
prerelease: false
|
76
59
|
version_requirements: *id004
|
77
60
|
- !ruby/object:Gem::Dependency
|
78
|
-
name:
|
79
|
-
prerelease: false
|
61
|
+
name: uglifier
|
80
62
|
requirement: &id005 !ruby/object:Gem::Requirement
|
81
63
|
none: false
|
82
64
|
requirements:
|
83
|
-
- - "
|
65
|
+
- - ">="
|
84
66
|
- !ruby/object:Gem::Version
|
85
|
-
|
86
|
-
segments:
|
87
|
-
- 0
|
88
|
-
- 8
|
89
|
-
- 7
|
90
|
-
version: 0.8.7
|
67
|
+
version: "0"
|
91
68
|
type: :development
|
69
|
+
prerelease: false
|
92
70
|
version_requirements: *id005
|
93
71
|
- !ruby/object:Gem::Dependency
|
94
|
-
name:
|
95
|
-
prerelease: false
|
72
|
+
name: turn
|
96
73
|
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: rake
|
84
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: coffee-rails
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: "0"
|
101
|
+
type: :development
|
102
|
+
prerelease: false
|
103
|
+
version_requirements: *id008
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: sass-rails
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: "0"
|
112
|
+
type: :development
|
113
|
+
prerelease: false
|
114
|
+
version_requirements: *id009
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: jquery-rails
|
117
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: "0"
|
123
|
+
type: :development
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: *id010
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: cucumber
|
128
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
97
129
|
none: false
|
98
130
|
requirements:
|
99
131
|
- - ~>
|
100
132
|
- !ruby/object:Gem::Version
|
101
|
-
hash: 31
|
102
|
-
segments:
|
103
|
-
- 0
|
104
|
-
- 10
|
105
133
|
version: "0.10"
|
106
134
|
type: :development
|
107
|
-
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: *id011
|
108
137
|
- !ruby/object:Gem::Dependency
|
109
138
|
name: aruba
|
110
|
-
|
111
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
139
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
112
140
|
none: false
|
113
141
|
requirements:
|
114
142
|
- - ~>
|
115
143
|
- !ruby/object:Gem::Version
|
116
|
-
hash: 13
|
117
|
-
segments:
|
118
|
-
- 0
|
119
|
-
- 3
|
120
144
|
version: "0.3"
|
121
145
|
type: :development
|
122
|
-
|
146
|
+
prerelease: false
|
147
|
+
version_requirements: *id012
|
123
148
|
- !ruby/object:Gem::Dependency
|
124
149
|
name: sqlite3
|
125
|
-
|
126
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
150
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
127
151
|
none: false
|
128
152
|
requirements:
|
129
153
|
- - ~>
|
130
154
|
- !ruby/object:Gem::Version
|
131
|
-
hash: 1
|
132
|
-
segments:
|
133
|
-
- 1
|
134
155
|
version: "1"
|
135
156
|
type: :development
|
136
|
-
|
157
|
+
prerelease: false
|
158
|
+
version_requirements: *id013
|
137
159
|
description: Write specs for your Rails 3 generators
|
138
160
|
email:
|
139
161
|
- alex@alexrothenberg.com
|
@@ -145,6 +167,7 @@ extra_rdoc_files: []
|
|
145
167
|
|
146
168
|
files:
|
147
169
|
- .gitignore
|
170
|
+
- .travis.yml
|
148
171
|
- Gemfile
|
149
172
|
- LICENSE.txt
|
150
173
|
- README.md
|
@@ -185,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
208
|
requirements:
|
186
209
|
- - ">="
|
187
210
|
- !ruby/object:Gem::Version
|
188
|
-
hash:
|
211
|
+
hash: -535140803606819433
|
189
212
|
segments:
|
190
213
|
- 0
|
191
214
|
version: "0"
|
@@ -194,14 +217,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
217
|
requirements:
|
195
218
|
- - ">="
|
196
219
|
- !ruby/object:Gem::Version
|
197
|
-
hash:
|
220
|
+
hash: -535140803606819433
|
198
221
|
segments:
|
199
222
|
- 0
|
200
223
|
version: "0"
|
201
224
|
requirements: []
|
202
225
|
|
203
226
|
rubyforge_project:
|
204
|
-
rubygems_version: 1.
|
227
|
+
rubygems_version: 1.6.2
|
205
228
|
signing_key:
|
206
229
|
specification_version: 3
|
207
230
|
summary: Write specs for your Rails 3 generators
|