ammeter 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/History.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Ammeter release history
2
2
 
3
+ ### 0.2.6 / 2012-06-28
4
+
5
+ [full changelog](https://github.com/alexrothenberg/ammeter/compare/v0.2.5...v0.2.6)
6
+
7
+ * Fixed issue #11 - testing generators that depend on other generators using `hook_for`
8
+
3
9
  ### 0.2.5 / 2012-05-03
4
10
 
5
11
  [full changelog](https://github.com/alexrothenberg/ammeter/compare/v0.2.4...v0.2.5)
@@ -0,0 +1,50 @@
1
+ Feature: generator spec
2
+
3
+ Generator specs live in spec/generators. In order to access
4
+ the generator's methods you can call them on the "generator" object.
5
+
6
+ Background: A generator that uses "hook_for"
7
+ Given a file named "lib/generators/resourceful/resourceful_generator.rb" with:
8
+ """
9
+ class ResourcefulGenerator < Rails::Generators::NamedBase
10
+ source_root File.expand_path('../templates', __FILE__)
11
+ class_option :super, :type => :boolean, :default => false
12
+
13
+ hook_for :orm, :in => :rails, :as => :model, :required => true
14
+
15
+ def create_resourceful_controller
16
+ template 'controller.rb', File.join('app/controllers', "#{plural_file_name}_controller.rb")
17
+ end
18
+ end
19
+ """
20
+ And a file named "lib/generators/resourceful/templates/controller.rb" with:
21
+ """
22
+ class <%= class_name.pluralize %>Controller < ResourcefulController
23
+ end
24
+ """
25
+
26
+ Scenario: A spec that runs the entire generator
27
+ Given a file named "spec/generators/resourceful_generator_spec.rb" with:
28
+ """
29
+ require "spec_helper"
30
+ require 'generators/resourceful/resourceful_generator'
31
+
32
+ describe ResourcefulGenerator do
33
+ before { run_generator %w(post) }
34
+ describe 'app/controller/posts_controller.rb' do
35
+ subject { file('app/controllers/posts_controller.rb') }
36
+ it { should exist }
37
+ it { should contain 'class PostsController < ResourcefulController' }
38
+ end
39
+
40
+ describe 'app/models/post.rb' do
41
+ subject { file('app/models/post.rb') }
42
+ it { should exist }
43
+ it { should contain 'class Post < ActiveRecord::Base' }
44
+ end
45
+ end
46
+ """
47
+ When I run `rake spec`
48
+ Then the output should contain "4 examples, 0 failures"
49
+
50
+
@@ -1,2 +1,4 @@
1
1
  require 'ammeter/rspec/generator/example.rb'
2
2
  require 'ammeter/rspec/generator/matchers.rb'
3
+
4
+ Rails.application.load_generators
@@ -1,3 +1,3 @@
1
1
  module Ammeter
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
@@ -1,5 +1,12 @@
1
1
  require 'rails/all'
2
2
  require 'rspec/rails'
3
+
4
+ module TestApp
5
+ class Application < Rails::Application
6
+ config.root = File.dirname(__FILE__)
7
+ end
8
+ end
9
+
3
10
  require 'ammeter/init'
4
11
 
5
12
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ammeter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-03 00:00:00.000000000 Z
12
+ date: 2012-06-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -235,6 +235,7 @@ files:
235
235
  - Rakefile
236
236
  - ammeter.gemspec
237
237
  - features/generator_spec.feature
238
+ - features/hooking_into_other_generators.feature
238
239
  - features/support/env.rb
239
240
  - features/templates/generate_example_app.rb
240
241
  - features/templates/rspec.rake
@@ -269,7 +270,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
269
270
  version: '0'
270
271
  segments:
271
272
  - 0
272
- hash: 1693166208592429466
273
+ hash: -2181907763227366726
273
274
  required_rubygems_version: !ruby/object:Gem::Requirement
274
275
  none: false
275
276
  requirements:
@@ -278,15 +279,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
278
279
  version: '0'
279
280
  segments:
280
281
  - 0
281
- hash: 1693166208592429466
282
+ hash: -2181907763227366726
282
283
  requirements: []
283
284
  rubyforge_project:
284
- rubygems_version: 1.8.21
285
+ rubygems_version: 1.8.24
285
286
  signing_key:
286
287
  specification_version: 3
287
288
  summary: Write specs for your Rails 3+ generators
288
289
  test_files:
289
290
  - features/generator_spec.feature
291
+ - features/hooking_into_other_generators.feature
290
292
  - features/support/env.rb
291
293
  - features/templates/generate_example_app.rb
292
294
  - features/templates/rspec.rake