rspec-rails 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +14 -1
- data/Thorfile +4 -2
- data/lib/generators/rspec/controller/controller_generator.rb +2 -2
- data/lib/generators/rspec/helper/helper_generator.rb +1 -1
- data/lib/generators/rspec/integration/integration_generator.rb +5 -1
- data/lib/generators/rspec/mailer/mailer_generator.rb +2 -2
- data/lib/generators/rspec/model/model_generator.rb +1 -1
- data/lib/generators/rspec/observer/observer_generator.rb +1 -1
- data/lib/generators/rspec/scaffold/scaffold_generator.rb +3 -3
- data/lib/generators/rspec/scaffold/templates/controller_spec.rb +3 -1
- data/lib/generators/rspec/view/view_generator.rb +1 -1
- data/lib/rspec/rails.rb +4 -1
- data/lib/rspec/rails/version.rb +1 -1
- data/lib/rspec/rails/view_assigns.rb +18 -8
- data/rspec-rails.gemspec +1 -1
- metadata +14 -12
data/History.md
CHANGED
@@ -1,4 +1,17 @@
|
|
1
|
-
## rspec-rails release history (incomplete)
|
1
|
+
## rspec-rails-2 release history (incomplete)
|
2
|
+
|
3
|
+
### 2.0.1 / 2010-10-15
|
4
|
+
|
5
|
+
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.0.0...v2.0.1)
|
6
|
+
|
7
|
+
* Enhancements
|
8
|
+
* Add option to not generate request spec (--skip-request-specs)
|
9
|
+
|
10
|
+
* Bug fixes
|
11
|
+
* Updated the mock_[model] method generated in controller specs so it adds
|
12
|
+
any stubs submitted each time it is called.
|
13
|
+
* Fixed bug where view assigns weren't making it to the view in view specs in Rails-3.0.1.
|
14
|
+
(Emanuele Vicentini)
|
2
15
|
|
3
16
|
### 2.0.0 / 2010-10-10
|
4
17
|
|
data/Thorfile
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
class Rails < Thor
|
2
2
|
VERSIONS = {
|
3
3
|
:rails => {
|
4
|
-
"3.0.0" => "v3.0.0",
|
5
4
|
"master" => "master",
|
5
|
+
"3.0.0" => "v3.0.0",
|
6
|
+
"3.0.1" => "v3.0.1",
|
6
7
|
"3-0-stable" => "origin/3-0-stable"
|
7
8
|
},
|
8
9
|
:arel => {
|
9
|
-
"3.0.0" => "v1.0.0",
|
10
10
|
"master" => "master",
|
11
|
+
"3.0.0" => "v1.0.0",
|
12
|
+
"3.0.1" => "v1.0.0",
|
11
13
|
"3-0-stable" => "master"
|
12
14
|
}
|
13
15
|
}
|
@@ -9,14 +9,14 @@ module Rspec
|
|
9
9
|
class_option :controller_specs, :type => :boolean, :default => true
|
10
10
|
class_option :view_specs, :type => :boolean, :default => true
|
11
11
|
|
12
|
-
def
|
12
|
+
def generate_controller_spec
|
13
13
|
return unless options[:controller_specs]
|
14
14
|
|
15
15
|
template 'controller_spec.rb',
|
16
16
|
File.join('spec/controllers', class_path, "#{file_name}_controller_spec.rb")
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def generate_view_specs
|
20
20
|
return if actions.empty?
|
21
21
|
return unless options[:view_specs]
|
22
22
|
|
@@ -5,7 +5,7 @@ module Rspec
|
|
5
5
|
class HelperGenerator < Base
|
6
6
|
class_option :helper_specs, :type => :boolean, :default => true
|
7
7
|
|
8
|
-
def
|
8
|
+
def generate_helper_spec
|
9
9
|
return unless options[:helper_specs]
|
10
10
|
|
11
11
|
template 'helper_spec.rb', File.join('spec/helpers', class_path, "#{file_name}_helper_spec.rb")
|
@@ -3,7 +3,11 @@ require 'generators/rspec'
|
|
3
3
|
module Rspec
|
4
4
|
module Generators
|
5
5
|
class IntegrationGenerator < Base
|
6
|
-
|
6
|
+
class_option :request_specs, :type => :boolean, :default => true, :desc => "Generate request specs"
|
7
|
+
|
8
|
+
def generate_request_spec
|
9
|
+
return unless options[:request_specs]
|
10
|
+
|
7
11
|
template 'request_spec.rb',
|
8
12
|
File.join('spec/requests', class_path, "#{table_name}_spec.rb")
|
9
13
|
end
|
@@ -5,11 +5,11 @@ module Rspec
|
|
5
5
|
class MailerGenerator < Base
|
6
6
|
argument :actions, :type => :array, :default => [], :banner => "method method"
|
7
7
|
|
8
|
-
def
|
8
|
+
def generate_mailer_spec
|
9
9
|
template "mailer_spec.rb", File.join('spec/mailers', class_path, "#{file_name}_spec.rb")
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def generate_fixtures_files
|
13
13
|
actions.each do |action|
|
14
14
|
@action, @path = action, File.join(file_path, action)
|
15
15
|
template "fixture", File.join("spec/fixtures", @path)
|
@@ -6,7 +6,7 @@ module Rspec
|
|
6
6
|
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
7
7
|
class_option :fixture, :type => :boolean
|
8
8
|
|
9
|
-
def
|
9
|
+
def create_model_spec
|
10
10
|
template 'model_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb")
|
11
11
|
end
|
12
12
|
|
@@ -18,14 +18,14 @@ module Rspec
|
|
18
18
|
class_option :helper_specs, :type => :boolean, :default => true, :desc => "Generate helper specs"
|
19
19
|
class_option :routing_specs, :type => :boolean, :default => true, :desc => "Generate routing specs"
|
20
20
|
|
21
|
-
def
|
21
|
+
def generate_controller_spec
|
22
22
|
return unless options[:controller_specs]
|
23
23
|
|
24
24
|
template 'controller_spec.rb',
|
25
25
|
File.join('spec/controllers', controller_class_path, "#{controller_file_name}_controller_spec.rb")
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def generate_view_specs
|
29
29
|
return unless options[:view_specs]
|
30
30
|
|
31
31
|
copy_view :edit
|
@@ -39,7 +39,7 @@ module Rspec
|
|
39
39
|
invoke invoked, [ controller_name ]
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def generate_routing_spec
|
43
43
|
return unless options[:routing_specs]
|
44
44
|
|
45
45
|
template 'routing_spec.rb',
|
@@ -3,7 +3,9 @@ require 'spec_helper'
|
|
3
3
|
describe <%= controller_class_name %>Controller do
|
4
4
|
|
5
5
|
def <%= mock_file_name %>(stubs={})
|
6
|
-
@<%= mock_file_name %> ||= mock_model(<%= class_name
|
6
|
+
(@<%= mock_file_name %> ||= mock_model(<%= class_name %>).as_null_object).tap do |<%= file_name %>|
|
7
|
+
<%= file_name %>.stub(stubs) unless stubs.empty?
|
8
|
+
end
|
7
9
|
end
|
8
10
|
|
9
11
|
<% unless options[:singleton] -%>
|
data/lib/rspec/rails.rb
CHANGED
@@ -8,12 +8,13 @@ module RSpec
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
require 'rspec/core'
|
12
|
+
|
11
13
|
RSpec::configure do |c|
|
12
14
|
c.backtrace_clean_patterns << /vendor\//
|
13
15
|
c.backtrace_clean_patterns << /lib\/rspec\/rails/
|
14
16
|
end
|
15
17
|
|
16
|
-
require 'rspec/core'
|
17
18
|
require 'rspec/rails/extensions'
|
18
19
|
require 'rspec/rails/view_rendering'
|
19
20
|
require 'rspec/rails/adapters'
|
@@ -23,3 +24,5 @@ require 'rspec/rails/mocks'
|
|
23
24
|
require 'rspec/rails/module_inclusion'
|
24
25
|
require 'rspec/rails/browser_simulators'
|
25
26
|
require 'rspec/rails/example'
|
27
|
+
|
28
|
+
|
data/lib/rspec/rails/version.rb
CHANGED
@@ -13,17 +13,26 @@ module RSpec
|
|
13
13
|
_encapsulated_assigns[key] = value
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
def view_assigns
|
17
|
+
begin
|
18
|
+
# TODO: _assigns was deprecated in favor of view_assigns after
|
19
|
+
# Rails-3.0.0 was released. Since we are not able to predict when
|
20
|
+
# the _assigns/view_assigns patch will be released (I thought it
|
21
|
+
# would have been in 3.0.1, but 3.0.1 bypassed this change for a
|
22
|
+
# security fix), this bit ensures that we do the right thing without
|
23
|
+
# knowing anything about the Rails version we are dealing with.
|
24
|
+
#
|
25
|
+
# Once that change _is_ released, this can be changed to something
|
26
|
+
# that checks for the Rails version when the module is being
|
27
|
+
# interpreted, as it was before commit dd0095.
|
18
28
|
super.merge(_encapsulated_assigns)
|
19
|
-
|
20
|
-
def view_assigns
|
29
|
+
rescue
|
21
30
|
_assigns
|
22
31
|
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
32
|
+
end
|
33
|
+
|
34
|
+
def _assigns
|
35
|
+
super.merge(_encapsulated_assigns)
|
27
36
|
end
|
28
37
|
|
29
38
|
private
|
@@ -32,6 +41,7 @@ module RSpec
|
|
32
41
|
@_encapsulated_assigns ||= {}
|
33
42
|
end
|
34
43
|
end
|
44
|
+
|
35
45
|
end
|
36
46
|
end
|
37
47
|
end
|
data/rspec-rails.gemspec
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 13
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 2
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 2.0.
|
9
|
+
- 1
|
10
|
+
version: 2.0.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- David Chelimsky
|
@@ -15,24 +16,25 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-10-
|
19
|
+
date: 2010-10-15 00:00:00 -05:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 15
|
28
29
|
segments:
|
29
30
|
- 2
|
30
31
|
- 0
|
31
32
|
- 0
|
32
33
|
version: 2.0.0
|
34
|
+
requirement: *id001
|
33
35
|
type: :runtime
|
36
|
+
name: rspec
|
34
37
|
prerelease: false
|
35
|
-
version_requirements: *id001
|
36
38
|
description: RSpec-2 for Rails-3
|
37
39
|
email: dchelimsky@gmail.com;chad.humphries@gmail.com
|
38
40
|
executables: []
|
@@ -165,7 +167,7 @@ licenses: []
|
|
165
167
|
post_install_message: |
|
166
168
|
**************************************************
|
167
169
|
|
168
|
-
Thank you for installing rspec-rails-2.0.
|
170
|
+
Thank you for installing rspec-rails-2.0.1!
|
169
171
|
|
170
172
|
This version of rspec-rails only works with versions of rails >= 3.0.0
|
171
173
|
|
@@ -175,7 +177,7 @@ post_install_message: |
|
|
175
177
|
can access its generators and rake tasks.
|
176
178
|
|
177
179
|
group :development, :test do
|
178
|
-
gem "rspec-rails", ">= 2.0.
|
180
|
+
gem "rspec-rails", ">= 2.0.1"
|
179
181
|
end
|
180
182
|
|
181
183
|
Be sure to run the following command in each of your Rails apps if you're
|
@@ -206,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
206
208
|
requirements:
|
207
209
|
- - ">="
|
208
210
|
- !ruby/object:Gem::Version
|
209
|
-
hash:
|
211
|
+
hash: 3
|
210
212
|
segments:
|
211
213
|
- 0
|
212
214
|
version: "0"
|
@@ -215,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
217
|
requirements:
|
216
218
|
- - ">="
|
217
219
|
- !ruby/object:Gem::Version
|
218
|
-
hash:
|
220
|
+
hash: 3
|
219
221
|
segments:
|
220
222
|
- 0
|
221
223
|
version: "0"
|
@@ -225,7 +227,7 @@ rubyforge_project: rspec
|
|
225
227
|
rubygems_version: 1.3.7
|
226
228
|
signing_key:
|
227
229
|
specification_version: 3
|
228
|
-
summary: rspec-rails-2.0.
|
230
|
+
summary: rspec-rails-2.0.1
|
229
231
|
test_files:
|
230
232
|
- features/README.markdown
|
231
233
|
- features/controller_specs/anonymous_controller.feature
|