ammeter 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +19 -2
  2. data/lib/ammeter/version.rb +1 -1
  3. metadata +3 -3
data/README.md CHANGED
@@ -17,25 +17,42 @@ A gem that makes it easy to write specs for your Rails 3 Generators.
17
17
  end
18
18
 
19
19
  # using mocks to ensure proper methods are called
20
- it 'should run both the model and fixture tasks' do
20
+ # invoke_all - will call all the tasks in the generator
21
+ it 'should run all tasks in the generator' do
21
22
  gen = generator %w(posts)
22
23
  gen.should_receive :create_model_spec
23
24
  gen.should_receive :create_fixture_file
24
25
  capture(:stdout) { gen.invoke_all }
25
26
  end
26
27
 
28
+ # invoke_task - will call just the named task in the generator
29
+ it 'should run a specific tasks in the generator' do
30
+ gen = generator %w(posts)
31
+ gen.should_receive :create_model_spec
32
+ gen.should_not_receive :create_fixture_file
33
+ capture(:stdout) { gen.invoke_task :create_model_spec }
34
+ end
35
+
36
+ # custom matchers make it easy to verify what the generator creates
27
37
  describe 'the generated files' do
28
38
  before do
29
39
  run_generator %w(posts)
30
40
  end
31
41
  describe 'the spec' do
42
+ # file - gives you the absolute path where the generator will create the file
32
43
  subject { file('spec/models/posts_spec.rb') }
44
+
45
+ # should exist - verifies the file exists
33
46
  it { should exist }
47
+
48
+ # should contain - verifies the file's contents
34
49
  it { should contain /require 'spec_helper'/ }
35
- it { should /describe Posts/ }
50
+ it { should contain /describe Posts/ }
36
51
  end
37
52
  describe 'the migration' do
38
53
  subject { file('db/migrate/create_posts.rb') }
54
+
55
+ # should be_a_migration - verifies the file exists with a migration timestamp as part of the filename
39
56
  it { should be_a_migration }
40
57
  end
41
58
  end
@@ -1,3 +1,3 @@
1
1
  module Ammeter
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ammeter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Rothenberg