rspec-rails 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -2
- data/History.md +13 -1
- data/README.md +2 -2
- data/lib/generators/rspec/integration/integration_generator.rb +11 -1
- data/lib/generators/rspec/integration/templates/request_spec.rb +6 -0
- data/lib/generators/rspec/scaffold/scaffold_generator.rb +4 -2
- data/lib/generators/rspec/scaffold/templates/edit_spec.rb +1 -1
- data/lib/generators/rspec/scaffold/templates/index_spec.rb +1 -1
- data/lib/generators/rspec/scaffold/templates/new_spec.rb +1 -1
- data/lib/generators/rspec/scaffold/templates/show_spec.rb +1 -1
- data/lib/rspec/rails/example/controller_example_group.rb +9 -1
- data/lib/rspec/rails/example/helper_example_group.rb +1 -0
- data/lib/rspec/rails/example/request_example_group.rb +19 -2
- data/lib/rspec/rails/version.rb +1 -1
- data/rspec-rails.gemspec +4 -2
- metadata +42 -14
data/Gemfile
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
+
gem "rails", :path => File.expand_path("../vendor/rails", __FILE__)
|
3
4
|
gem "rack", :git => "git://github.com/rack/rack.git"
|
4
|
-
gem 'rails', :path => File.expand_path("../vendor/rails", __FILE__)
|
5
5
|
|
6
6
|
%w[rspec-rails rspec rspec-core rspec-expectations rspec-mocks].each do |lib|
|
7
7
|
gem lib, :path => File.expand_path("../../#{lib}", __FILE__)
|
8
8
|
end
|
9
9
|
|
10
|
-
gem "cucumber", "
|
10
|
+
gem "cucumber", :git => "git://github.com/dchelimsky/cucumber", :branch => "update-gemspec"
|
11
11
|
gem "aruba", "0.2.2"
|
12
12
|
gem 'webrat', "0.7.2"
|
13
13
|
gem 'sqlite3-ruby', :require => 'sqlite3'
|
data/History.md
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
-
## rspec-rails-2 release history
|
1
|
+
## rspec-rails-2 release history
|
2
|
+
|
3
|
+
### 2.2.1 / 2010-12-01
|
4
|
+
|
5
|
+
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.2.0...v2.2.1)
|
6
|
+
|
7
|
+
* Bug fixes
|
8
|
+
* Depend on railties, activesupport, and actionpack instead of rails (Piotr
|
9
|
+
Solnica)
|
10
|
+
* Got webrat integration working properly across different types of specs
|
11
|
+
|
12
|
+
* Deprecations
|
13
|
+
* --webrat-matchers flag for generators is deprecated. use --webrat instead.
|
2
14
|
|
3
15
|
### 2.2.0 / 2010-11-28
|
4
16
|
|
data/README.md
CHANGED
@@ -6,10 +6,10 @@ NOTE: rspec-2 does _not_ support rails-2. Use rspec-rails-1.3.x for rails-2.
|
|
6
6
|
|
7
7
|
## Documentation
|
8
8
|
|
9
|
-
The [Cucumber features](http://relishapp.com/rspec/rspec-rails/v/2-
|
9
|
+
The [Cucumber features](http://relishapp.com/rspec/rspec-rails/v/2-2) are the
|
10
10
|
most comprehensive and up-to-date docs for end-users.
|
11
11
|
|
12
|
-
The [RDoc](http://rubydoc.info/gems/rspec-rails/2.1/frames) provides additional
|
12
|
+
The [RDoc](http://rubydoc.info/gems/rspec-rails/2.2.1/frames) provides additional
|
13
13
|
information for contributors and/or extenders.
|
14
14
|
|
15
15
|
All of the documentation is open source and a work in progress. If you find it
|
@@ -3,7 +3,9 @@ require 'generators/rspec'
|
|
3
3
|
module Rspec
|
4
4
|
module Generators
|
5
5
|
class IntegrationGenerator < Base
|
6
|
-
class_option :request_specs,
|
6
|
+
class_option :request_specs, :type => :boolean, :default => true, :desc => "Generate request specs"
|
7
|
+
class_option :webrat, :type => :boolean, :default => false, :desc => "Use webrat methods/matchers"
|
8
|
+
class_option :webrat_matchers, :type => :boolean, :default => false, :desc => "Use webrat methods/matchers (deprecated - use --webrat)"
|
7
9
|
|
8
10
|
def generate_request_spec
|
9
11
|
return unless options[:request_specs]
|
@@ -11,6 +13,14 @@ module Rspec
|
|
11
13
|
template 'request_spec.rb',
|
12
14
|
File.join('spec/requests', class_path, "#{table_name}_spec.rb")
|
13
15
|
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def webrat?
|
20
|
+
RSpec.deprecate("the --webrat-matchers option", "--webrat") if options[:webrat_matchers]
|
21
|
+
options[:webrat] || options[:webrat_matchers]
|
22
|
+
end
|
23
|
+
|
14
24
|
end
|
15
25
|
end
|
16
26
|
end
|
@@ -3,7 +3,13 @@ require 'spec_helper'
|
|
3
3
|
describe "<%= class_name.pluralize %>" do
|
4
4
|
describe "GET /<%= table_name %>" do
|
5
5
|
it "works! (now write some real specs)" do
|
6
|
+
<% if webrat? -%>
|
7
|
+
visit <%= table_name %>_path
|
8
|
+
<% else -%>
|
9
|
+
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
|
6
10
|
get <%= table_name %>_path
|
11
|
+
<% end -%>
|
12
|
+
response.status.should be(200)
|
7
13
|
end
|
8
14
|
end
|
9
15
|
end
|
@@ -14,7 +14,8 @@ module Rspec
|
|
14
14
|
|
15
15
|
class_option :controller_specs, :type => :boolean, :default => true, :desc => "Generate controller specs"
|
16
16
|
class_option :view_specs, :type => :boolean, :default => true, :desc => "Generate view specs"
|
17
|
-
class_option :
|
17
|
+
class_option :webrat, :type => :boolean, :default => false, :desc => "Use webrat methods/matchers"
|
18
|
+
class_option :webrat_matchers, :type => :boolean, :default => false, :desc => "Use webrat methods/matchers (deprecated - use --webrat)"
|
18
19
|
class_option :helper_specs, :type => :boolean, :default => true, :desc => "Generate helper specs"
|
19
20
|
class_option :routing_specs, :type => :boolean, :default => true, :desc => "Generate routing specs"
|
20
21
|
|
@@ -51,7 +52,8 @@ module Rspec
|
|
51
52
|
protected
|
52
53
|
|
53
54
|
def webrat?
|
54
|
-
options[:webrat_matchers]
|
55
|
+
RSpec.deprecate("--webrat-matchers", "--webrat") if options[:webrat_matchers]
|
56
|
+
options[:webrat] || options[:webrat_matchers]
|
55
57
|
end
|
56
58
|
|
57
59
|
def copy_view(view)
|
@@ -20,7 +20,7 @@ describe "<%= table_name %>/edit.html.<%= options[:template_engine] %>" do
|
|
20
20
|
<% end -%>
|
21
21
|
end
|
22
22
|
<% else -%>
|
23
|
-
# Run the generator again with the --webrat
|
23
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
24
24
|
assert_select "form", :action => <%= file_name %>_path(@<%= file_name %>), :method => "post" do
|
25
25
|
<% for attribute in output_attributes -%>
|
26
26
|
assert_select "<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>", :name => "<%= file_name %>[<%= attribute.name %>]"
|
@@ -22,7 +22,7 @@ describe "<%= table_name %>/index.html.<%= options[:template_engine] %>" do
|
|
22
22
|
<% if webrat? -%>
|
23
23
|
rendered.should have_selector("tr>td", :content => <%= value_for(attribute) %>.to_s, :count => 2)
|
24
24
|
<% else -%>
|
25
|
-
# Run the generator again with the --webrat
|
25
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
26
26
|
assert_select "tr>td", :text => <%= value_for(attribute) %>.to_s, :count => 2
|
27
27
|
<% end -%>
|
28
28
|
<% end -%>
|
@@ -19,7 +19,7 @@ describe "<%= table_name %>/new.html.<%= options[:template_engine] %>" do
|
|
19
19
|
<% end -%>
|
20
20
|
end
|
21
21
|
<% else -%>
|
22
|
-
# Run the generator again with the --webrat
|
22
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
23
23
|
assert_select "form", :action => <%= table_name %>_path, :method => "post" do
|
24
24
|
<% for attribute in output_attributes -%>
|
25
25
|
assert_select "<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>", :name => "<%= file_name %>[<%= attribute.name %>]"
|
@@ -18,7 +18,7 @@ describe "<%= table_name %>/show.html.<%= options[:template_engine] %>" do
|
|
18
18
|
<% if webrat? -%>
|
19
19
|
rendered.should contain(<%= value_for(attribute) %>.to_s)
|
20
20
|
<% else -%>
|
21
|
-
# Run the generator again with the --webrat
|
21
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
22
22
|
rendered.should match(/<%= eval(value_for(attribute)) %>/)
|
23
23
|
<% end -%>
|
24
24
|
<% end -%>
|
@@ -157,12 +157,20 @@ module RSpec::Rails
|
|
157
157
|
end
|
158
158
|
|
159
159
|
included do
|
160
|
+
subject { controller }
|
161
|
+
|
160
162
|
metadata[:type] = :controller
|
163
|
+
|
161
164
|
before do
|
162
165
|
@routes = ::Rails.application.routes
|
163
166
|
ActionController::Base.allow_forgery_protection = false
|
164
167
|
end
|
165
|
-
|
168
|
+
|
169
|
+
webrat do
|
170
|
+
before do
|
171
|
+
Webrat.configure {|c| c.mode = :rails}
|
172
|
+
end
|
173
|
+
end
|
166
174
|
end
|
167
175
|
|
168
176
|
RSpec.configure &include_self_when_dir_matches('spec','controllers')
|
@@ -21,12 +21,21 @@ module RSpec::Rails
|
|
21
21
|
include ActionDispatch::Assertions
|
22
22
|
include RSpec::Rails::BrowserSimulators
|
23
23
|
|
24
|
+
module InstanceMethods
|
25
|
+
def app
|
26
|
+
::Rails.application
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
24
30
|
webrat do
|
25
31
|
include Webrat::Matchers
|
26
32
|
include Webrat::Methods
|
27
33
|
|
28
|
-
|
29
|
-
|
34
|
+
module InstanceMethods
|
35
|
+
|
36
|
+
def last_response
|
37
|
+
@response
|
38
|
+
end
|
30
39
|
end
|
31
40
|
end
|
32
41
|
|
@@ -44,6 +53,14 @@ module RSpec::Rails
|
|
44
53
|
before do
|
45
54
|
@router = ::Rails.application.routes
|
46
55
|
end
|
56
|
+
|
57
|
+
webrat do
|
58
|
+
before do
|
59
|
+
Webrat.configure do |c|
|
60
|
+
c.mode = :rack
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
47
64
|
end
|
48
65
|
|
49
66
|
RSpec.configure &include_self_when_dir_matches('spec','requests')
|
data/lib/rspec/rails/version.rb
CHANGED
data/rspec-rails.gemspec
CHANGED
@@ -57,7 +57,9 @@ Gem::Specification.new do |s|
|
|
57
57
|
**************************************************
|
58
58
|
}
|
59
59
|
|
60
|
-
s.add_runtime_dependency "
|
61
|
-
s.add_runtime_dependency "
|
60
|
+
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0"])
|
61
|
+
s.add_runtime_dependency(%q<actionpack>, ["~> 3.0"])
|
62
|
+
s.add_runtime_dependency(%q<railties>, ["~> 3.0"])
|
63
|
+
s.add_runtime_dependency "rspec", "~> #{RSpec::Rails::Version::STRING.split('.')[0..1].concat(['0']).join('.')}"
|
62
64
|
end
|
63
65
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 2.2.
|
8
|
+
- 1
|
9
|
+
version: 2.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- David Chelimsky
|
@@ -14,11 +14,11 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-12-01 00:00:00 -06:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
21
|
+
name: activesupport
|
22
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
23
|
none: false
|
24
24
|
requirements:
|
@@ -27,14 +27,41 @@ dependencies:
|
|
27
27
|
segments:
|
28
28
|
- 3
|
29
29
|
- 0
|
30
|
-
|
31
|
-
version: 3.0.0
|
30
|
+
version: "3.0"
|
32
31
|
type: :runtime
|
33
32
|
prerelease: false
|
34
33
|
version_requirements: *id001
|
35
34
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
35
|
+
name: actionpack
|
37
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 3
|
43
|
+
- 0
|
44
|
+
version: "3.0"
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: railties
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 3
|
57
|
+
- 0
|
58
|
+
version: "3.0"
|
59
|
+
type: :runtime
|
60
|
+
prerelease: false
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
38
65
|
none: false
|
39
66
|
requirements:
|
40
67
|
- - ~>
|
@@ -42,10 +69,11 @@ dependencies:
|
|
42
69
|
segments:
|
43
70
|
- 2
|
44
71
|
- 2
|
45
|
-
|
72
|
+
- 0
|
73
|
+
version: 2.2.0
|
46
74
|
type: :runtime
|
47
75
|
prerelease: false
|
48
|
-
version_requirements: *
|
76
|
+
version_requirements: *id004
|
49
77
|
description: RSpec-2 for Rails-3
|
50
78
|
email: dchelimsky@gmail.com
|
51
79
|
executables: []
|
@@ -183,7 +211,7 @@ licenses: []
|
|
183
211
|
post_install_message: |
|
184
212
|
**************************************************
|
185
213
|
|
186
|
-
Thank you for installing rspec-rails-2.2.
|
214
|
+
Thank you for installing rspec-rails-2.2.1!
|
187
215
|
|
188
216
|
This version of rspec-rails only works with versions of rails >= 3.0.0
|
189
217
|
|
@@ -193,7 +221,7 @@ post_install_message: |
|
|
193
221
|
can access its generators and rake tasks.
|
194
222
|
|
195
223
|
group :development, :test do
|
196
|
-
gem "rspec-rails", ">= 2.2.
|
224
|
+
gem "rspec-rails", ">= 2.2.1"
|
197
225
|
end
|
198
226
|
|
199
227
|
Be sure to run the following command in each of your Rails apps if you're
|
@@ -224,7 +252,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
224
252
|
requirements:
|
225
253
|
- - ">="
|
226
254
|
- !ruby/object:Gem::Version
|
227
|
-
hash:
|
255
|
+
hash: 1117426161329304162
|
228
256
|
segments:
|
229
257
|
- 0
|
230
258
|
version: "0"
|
@@ -233,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
261
|
requirements:
|
234
262
|
- - ">="
|
235
263
|
- !ruby/object:Gem::Version
|
236
|
-
hash:
|
264
|
+
hash: 1117426161329304162
|
237
265
|
segments:
|
238
266
|
- 0
|
239
267
|
version: "0"
|
@@ -243,7 +271,7 @@ rubyforge_project: rspec
|
|
243
271
|
rubygems_version: 1.3.7
|
244
272
|
signing_key:
|
245
273
|
specification_version: 3
|
246
|
-
summary: rspec-rails-2.2.
|
274
|
+
summary: rspec-rails-2.2.1
|
247
275
|
test_files:
|
248
276
|
- features/README.markdown
|
249
277
|
- features/controller_specs/anonymous_controller.feature
|