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 CHANGED
@@ -1,5 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
-
5
- gem "fakefs"
data/Gemfile.lock CHANGED
@@ -1,97 +1,82 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- generator_spec (0.8.4)
5
- rails (>= 3.0, < 4.0)
6
- rspec-rails
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
- abstract (1.0.0)
12
- actionmailer (3.0.10)
13
- actionpack (= 3.0.10)
14
- mail (~> 2.2.19)
15
- actionpack (3.0.10)
16
- activemodel (= 3.0.10)
17
- activesupport (= 3.0.10)
18
- builder (~> 2.1.2)
19
- erubis (~> 2.6.6)
20
- i18n (~> 0.5.0)
21
- rack (~> 1.2.1)
22
- rack-mount (~> 0.6.14)
23
- rack-test (~> 0.5.7)
24
- tzinfo (~> 0.3.23)
25
- activemodel (3.0.10)
26
- activesupport (= 3.0.10)
27
- builder (~> 2.1.2)
28
- i18n (~> 0.5.0)
29
- activerecord (3.0.10)
30
- activemodel (= 3.0.10)
31
- activesupport (= 3.0.10)
32
- arel (~> 2.0.10)
33
- tzinfo (~> 0.3.23)
34
- activeresource (3.0.10)
35
- activemodel (= 3.0.10)
36
- activesupport (= 3.0.10)
37
- activesupport (3.0.10)
38
- arel (2.0.10)
39
- builder (2.1.2)
40
- diff-lcs (1.1.2)
41
- erubis (2.6.6)
42
- abstract (>= 1.0.0)
43
- fakefs (0.3.1)
44
- i18n (0.5.0)
45
- mail (2.2.19)
46
- activesupport (>= 2.3.6)
47
- i18n (>= 0.4.0)
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
- rails (3.0.10)
58
- actionmailer (= 3.0.10)
59
- actionpack (= 3.0.10)
60
- activerecord (= 3.0.10)
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 (~> 0.14.4)
71
- rake (0.9.2)
72
- rdoc (3.9.3)
73
- rspec (2.6.0)
74
- rspec-core (~> 2.6.0)
75
- rspec-expectations (~> 2.6.0)
76
- rspec-mocks (~> 2.6.0)
77
- rspec-core (2.6.4)
78
- rspec-expectations (2.6.0)
79
- diff-lcs (~> 1.1.2)
80
- rspec-mocks (2.6.0)
81
- rspec-rails (2.6.1)
82
- actionpack (~> 3.0)
83
- activesupport (~> 3.0)
84
- railties (~> 3.0)
85
- rspec (~> 2.6.0)
86
- thor (0.14.6)
87
- treetop (1.4.10)
88
- polyglot
89
- polyglot (>= 0.3.1)
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
- group :test do
10
- gem "generator_spec"
11
- end
9
+ ```ruby
10
+ group :test do
11
+ gem "generator_spec"
12
+ end
13
+ ```
12
14
 
13
15
  Spec:
14
16
 
15
- # spec/lib/generators/test/test_generator_spec.rb
17
+ ```ruby
18
+ # spec/lib/generators/test/test_generator_spec.rb
16
19
 
17
- require "generator_spec/test_case"
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
- before(:all) do
25
- prepare_destination
26
- run_generator
27
- end
22
+ describe TestGenerator do
23
+ include GeneratorSpec::TestCase
24
+ destination File.expand_path("../../tmp", __FILE__)
25
+ arguments %w(something)
28
26
 
29
- it "creates a test initializer" do
30
- assert_file "config/initializers/test.rb", "# Initializer"
31
- end
32
- end
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
- describe TestGenerator, "using custom matcher" do
37
- include GeneratorSpec::TestCase
38
- destination File.expand_path("../../tmp", __FILE__)
39
-
40
- before do
41
- prepare_destination
42
- run_generator
43
- end
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
- specify do
46
- destination_root.should have_structure {
47
- no_file "test.rb"
48
- directory "config" do
49
- directory "initializers" do
50
- file "test.rb" do
51
- contains "# Initializer"
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
- directory "db" do
56
- directory "migrate" do
57
- file "123_create_tests.rb"
58
- migration "create_tests" do
59
- contains "class TestMigration"
60
- end
61
- end
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
- end
68
+ }
69
+ end
70
+ end
71
+ ```
@@ -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 "rails", ">= 3.0", "< 4.0"
22
- s.add_dependency "rspec-rails"
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
@@ -43,7 +43,7 @@ module GeneratorSpec
43
43
  file_name = migration_file_name(root, @name)
44
44
 
45
45
  unless file_name && file_name.exist?
46
- throw :failure, file_name
46
+ throw :failure, @name
47
47
  end
48
48
 
49
49
  check_contents(file_name)
@@ -1,17 +1,17 @@
1
- require 'rspec/rails'
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
@@ -1,3 +1,3 @@
1
1
  module GeneratorSpec
2
- VERSION = '0.8.5'
2
+ VERSION = '0.8.6'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'bundler/setup'
2
- require 'rails/all'
3
- require 'rspec/rails'
2
+ require 'active_record'
3
+ require 'rspec'
4
4
  require 'generator_spec/test_case'
5
5
  require 'fakefs/spec_helpers'
6
6
 
@@ -1,6 +1,7 @@
1
1
  module Helpers
2
2
  module FileSystem
3
3
  def write_file(file_name, contents)
4
+ write_directory(TMP_ROOT)
4
5
  ::File.open(file_name.to_s, 'w') {|f| f.write(contents) }
5
6
  end
6
7
 
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.5
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-01-28 00:00:00.000000000Z
12
+ date: 2012-11-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: &70134539407120 !ruby/object:Gem::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: *70134539407120
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: rspec-rails
30
- requirement: &70134539406440 !ruby/object:Gem::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: *70134539406440
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.6
136
+ rubygems_version: 1.8.23
86
137
  signing_key:
87
138
  specification_version: 3
88
139
  summary: Test Rails generators with RSpec