rspec-rails 2.6.0.rc4 → 2.6.0.rc6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +1 -0
- data/features/Changelog.md +9 -0
- data/features/matchers/new_record_matcher.feature +0 -42
- data/features/view_specs/view_spec.feature +0 -19
- data/gemfiles/base.rb +1 -1
- data/gemfiles/rails-3-0-stable +0 -1
- data/gemfiles/rails-3.1.0.beta1 +16 -0
- data/lib/generators/rspec/scaffold/templates/controller_spec.rb +2 -2
- data/lib/rspec/rails.rb +2 -2
- data/lib/rspec/rails/example/controller_example_group.rb +3 -26
- data/lib/rspec/rails/example/helper_example_group.rb +0 -9
- data/lib/rspec/rails/example/mailer_example_group.rb +0 -13
- data/lib/rspec/rails/example/request_example_group.rb +0 -25
- data/lib/rspec/rails/example/view_example_group.rb +7 -10
- data/lib/rspec/rails/vendor/capybara.rb +29 -0
- data/lib/rspec/rails/vendor/webrat.rb +33 -0
- data/lib/rspec/rails/version.rb +1 -1
- data/rspec-rails.gemspec +3 -3
- metadata +14 -12
- data/lib/rspec/rails/browser_simulators.rb +0 -35
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/features/Changelog.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
### 2.6.0.rc6 / 2011-05-06
|
2
|
+
|
3
|
+
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.6.0.rc4...v2.6.0.rc6)
|
4
|
+
|
5
|
+
* Bug fixes
|
6
|
+
* Fix load order issue w/ Capybara (oleg dashevskii)
|
7
|
+
* Relax the dependencies on rails gems to >= 3.0 (Joel Moss)
|
8
|
+
* Fix monkey patches that broke due to internal changes in rails-3.1.0.beta1
|
9
|
+
|
1
10
|
### 2.6.0.rc4 / 2011-05-01
|
2
11
|
|
3
12
|
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.6.0.rc2...v2.6.0.rc4)
|
@@ -26,45 +26,3 @@ Feature: be_a_new matcher
|
|
26
26
|
"""
|
27
27
|
When I run `rspec spec/models/widget_spec.rb`
|
28
28
|
Then the examples should all pass
|
29
|
-
|
30
|
-
Scenario: example spec using be_a_new.with
|
31
|
-
Given a file named "spec/models/widget_spec.rb" with:
|
32
|
-
"""
|
33
|
-
require "spec_helper"
|
34
|
-
|
35
|
-
class Widget < ActiveRecord::Base
|
36
|
-
establish_connection :adapter => 'sqlite3',
|
37
|
-
:database => ':memory:'
|
38
|
-
|
39
|
-
connection.execute <<-eosql
|
40
|
-
CREATE TABLE widgets (
|
41
|
-
foo_id integer,
|
42
|
-
number integer
|
43
|
-
)
|
44
|
-
eosql
|
45
|
-
end
|
46
|
-
|
47
|
-
describe Widget do
|
48
|
-
context "when initialized with attributes" do
|
49
|
-
subject { Widget.new(:foo_id => 1, :number => 1) }
|
50
|
-
|
51
|
-
it "has all of the attributes" do
|
52
|
-
should be_a_new(Widget).with(:foo_id => 1, :number => 1)
|
53
|
-
end
|
54
|
-
|
55
|
-
it "has one of the attributes" do
|
56
|
-
should be_a_new(Widget).with(:foo_id => 1)
|
57
|
-
end
|
58
|
-
|
59
|
-
it "has none of the attributes" do
|
60
|
-
should_not be_a_new(Widget).with(:blah => 'blah')
|
61
|
-
end
|
62
|
-
|
63
|
-
it "has one of the attribute values not the same" do
|
64
|
-
should_not be_a_new(Widget).with(:foo_id => 2)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
"""
|
69
|
-
When I run `rspec spec/models/widget_spec.rb`
|
70
|
-
Then the examples should all pass
|
@@ -134,25 +134,6 @@ Feature: view spec
|
|
134
134
|
When I run `rspec spec/views`
|
135
135
|
Then the examples should all pass
|
136
136
|
|
137
|
-
Scenario: passing spec with rendering of Prototype helper update
|
138
|
-
Given a file named "spec/views/widgets/prototype_update.html.erb_spec.rb" with:
|
139
|
-
"""
|
140
|
-
require "spec_helper"
|
141
|
-
|
142
|
-
describe "render a Prototype helper update" do
|
143
|
-
it "hides the status indicator" do
|
144
|
-
|
145
|
-
render :update do |page|
|
146
|
-
page.hide 'status-indicator'
|
147
|
-
end
|
148
|
-
|
149
|
-
rendered.should =~ /Element.hide\(\"status-indicator\"\);/
|
150
|
-
end
|
151
|
-
end
|
152
|
-
"""
|
153
|
-
When I run `rspec spec/views`
|
154
|
-
Then the examples should all pass
|
155
|
-
|
156
137
|
Scenario: spec with view that accesses helper_method helpers
|
157
138
|
Given a file named "app/views/secrets/index.html.erb" with:
|
158
139
|
"""
|
data/gemfiles/base.rb
CHANGED
data/gemfiles/rails-3-0-stable
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path("../base.rb", __FILE__)
|
2
|
+
|
3
|
+
extend GemfileBase
|
4
|
+
|
5
|
+
gem "rails", "3.1.0.beta1"
|
6
|
+
|
7
|
+
# From the Gemfile generated by 'rails new ....'
|
8
|
+
gem 'sass'
|
9
|
+
gem 'coffee-script'
|
10
|
+
gem 'uglifier'
|
11
|
+
gem 'jquery-rails'
|
12
|
+
|
13
|
+
group :test do
|
14
|
+
# Pretty printed test output
|
15
|
+
gem 'turn', :require => false
|
16
|
+
end
|
@@ -127,7 +127,7 @@ describe <%= controller_class_name %>Controller do
|
|
127
127
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
128
128
|
# Trigger the behavior that occurs when invalid params are submitted
|
129
129
|
<%= class_name %>.any_instance.stub(:save).and_return(false)
|
130
|
-
put :update, :id => <%= file_name %>.id.to_s
|
130
|
+
put :update, :id => <%= file_name %>.id.to_s, :<%= ns_file_name %> => {}
|
131
131
|
assigns(:<%= ns_file_name %>).should eq(<%= file_name %>)
|
132
132
|
end
|
133
133
|
|
@@ -135,7 +135,7 @@ describe <%= controller_class_name %>Controller do
|
|
135
135
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
136
136
|
# Trigger the behavior that occurs when invalid params are submitted
|
137
137
|
<%= class_name %>.any_instance.stub(:save).and_return(false)
|
138
|
-
put :update, :id => <%= file_name %>.id.to_s
|
138
|
+
put :update, :id => <%= file_name %>.id.to_s, :<%= ns_file_name %> => {}
|
139
139
|
response.should render_template("edit")
|
140
140
|
end
|
141
141
|
end
|
data/lib/rspec/rails.rb
CHANGED
@@ -12,6 +12,6 @@ require 'rspec/rails/matchers'
|
|
12
12
|
require 'rspec/rails/fixture_support'
|
13
13
|
require 'rspec/rails/mocks'
|
14
14
|
require 'rspec/rails/module_inclusion'
|
15
|
-
require 'rspec/rails/browser_simulators'
|
16
15
|
require 'rspec/rails/example'
|
17
|
-
|
16
|
+
require 'rspec/rails/vendor/capybara'
|
17
|
+
require 'rspec/rails/vendor/webrat'
|
@@ -82,21 +82,6 @@ module RSpec::Rails
|
|
82
82
|
include RSpec::Rails::Matchers::RedirectTo
|
83
83
|
include RSpec::Rails::Matchers::RenderTemplate
|
84
84
|
include RSpec::Rails::Matchers::RoutingMatchers
|
85
|
-
include RSpec::Rails::BrowserSimulators
|
86
|
-
|
87
|
-
webrat do
|
88
|
-
include Webrat::Matchers
|
89
|
-
include Webrat::Methods
|
90
|
-
end
|
91
|
-
|
92
|
-
capybara do
|
93
|
-
begin
|
94
|
-
include Capybara::DSL
|
95
|
-
include Capybara::RSpecMatchers
|
96
|
-
rescue
|
97
|
-
include Capybara
|
98
|
-
end
|
99
|
-
end
|
100
85
|
|
101
86
|
module ClassMethods
|
102
87
|
def controller_class
|
@@ -140,11 +125,9 @@ module RSpec::Rails
|
|
140
125
|
# defined in +ApplicationController+, however, are accessible from within
|
141
126
|
# the block.
|
142
127
|
def controller(base_class = ApplicationController, &body)
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
"StubResourcesController"
|
147
|
-
end
|
128
|
+
base_class.dup.tap do |new_base|
|
129
|
+
def new_base.name; "StubResourcesController"; end
|
130
|
+
metadata[:example_group][:describes] = Class.new(new_base, &body)
|
148
131
|
end
|
149
132
|
|
150
133
|
before do
|
@@ -179,12 +162,6 @@ module RSpec::Rails
|
|
179
162
|
@routes = ::Rails.application.routes
|
180
163
|
ActionController::Base.allow_forgery_protection = false
|
181
164
|
end
|
182
|
-
|
183
|
-
webrat do
|
184
|
-
before do
|
185
|
-
Webrat.configure {|c| c.mode = :rails}
|
186
|
-
end
|
187
|
-
end
|
188
165
|
end
|
189
166
|
end
|
190
167
|
end
|
@@ -30,15 +30,6 @@ module RSpec::Rails
|
|
30
30
|
include RSpec::Rails::RailsExampleGroup
|
31
31
|
include ActionView::TestCase::Behavior
|
32
32
|
include RSpec::Rails::ViewAssigns
|
33
|
-
include RSpec::Rails::BrowserSimulators
|
34
|
-
|
35
|
-
webrat do
|
36
|
-
include Webrat::Matchers
|
37
|
-
end
|
38
|
-
|
39
|
-
capybara do
|
40
|
-
include Capybara::RSpecMatchers if defined?(Capybara::RSpecMatchers)
|
41
|
-
end
|
42
33
|
|
43
34
|
module ClassMethods
|
44
35
|
def determine_default_helper_class(ignore)
|
@@ -4,19 +4,6 @@ if defined?(ActionMailer)
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
include RSpec::Rails::RailsExampleGroup
|
6
6
|
include ActionMailer::TestCase::Behavior
|
7
|
-
include RSpec::Rails::BrowserSimulators
|
8
|
-
|
9
|
-
webrat do
|
10
|
-
include Webrat::Matchers
|
11
|
-
end
|
12
|
-
|
13
|
-
capybara do
|
14
|
-
begin
|
15
|
-
include Capybara::RSpecMatchers
|
16
|
-
rescue
|
17
|
-
include Capybara
|
18
|
-
end
|
19
|
-
end
|
20
7
|
|
21
8
|
included do
|
22
9
|
metadata[:type] = :mailer
|
@@ -16,7 +16,6 @@ module RSpec::Rails
|
|
16
16
|
include RSpec::Rails::RailsExampleGroup
|
17
17
|
include ActionDispatch::Integration::Runner
|
18
18
|
include ActionDispatch::Assertions
|
19
|
-
include RSpec::Rails::BrowserSimulators
|
20
19
|
|
21
20
|
module InstanceMethods
|
22
21
|
def app
|
@@ -24,22 +23,6 @@ module RSpec::Rails
|
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
|
-
webrat do
|
28
|
-
include Webrat::Matchers
|
29
|
-
include Webrat::Methods
|
30
|
-
|
31
|
-
module InstanceMethods
|
32
|
-
|
33
|
-
def last_response
|
34
|
-
@response
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
capybara do
|
40
|
-
include Capybara unless defined?(Capybara::DSL)
|
41
|
-
end
|
42
|
-
|
43
26
|
include RSpec::Rails::Matchers::RedirectTo
|
44
27
|
include RSpec::Rails::Matchers::RenderTemplate
|
45
28
|
include ActionController::TemplateAssertions
|
@@ -50,14 +33,6 @@ module RSpec::Rails
|
|
50
33
|
before do
|
51
34
|
@routes = ::Rails.application.routes
|
52
35
|
end
|
53
|
-
|
54
|
-
webrat do
|
55
|
-
before do
|
56
|
-
Webrat.configure do |c|
|
57
|
-
c.mode = :rack
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
36
|
end
|
62
37
|
end
|
63
38
|
end
|
@@ -23,15 +23,6 @@ module RSpec::Rails
|
|
23
23
|
include ActionView::TestCase::Behavior
|
24
24
|
include RSpec::Rails::ViewAssigns
|
25
25
|
include RSpec::Rails::Matchers::RenderTemplate
|
26
|
-
include RSpec::Rails::BrowserSimulators
|
27
|
-
|
28
|
-
webrat do
|
29
|
-
include Webrat::Matchers
|
30
|
-
end
|
31
|
-
|
32
|
-
capybara do
|
33
|
-
include Capybara::RSpecMatchers if defined?(Capybara::RSpecMatchers)
|
34
|
-
end
|
35
26
|
|
36
27
|
module ClassMethods
|
37
28
|
def _default_helper
|
@@ -151,7 +142,13 @@ module RSpec::Rails
|
|
151
142
|
|
152
143
|
before do
|
153
144
|
_include_controller_helpers
|
154
|
-
|
145
|
+
if view.lookup_context.respond_to?(:prefixes)
|
146
|
+
# rails 3.1
|
147
|
+
view.lookup_context.prefixes << _controller_path
|
148
|
+
else
|
149
|
+
# rails 3.0
|
150
|
+
controller.controller_path = _controller_path
|
151
|
+
end
|
155
152
|
controller.request.path_parameters["controller"] = _controller_path
|
156
153
|
controller.request.path_parameters["action"] = _inferred_action unless _inferred_action =~ /^_/
|
157
154
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
begin
|
2
|
+
require 'capybara/rspec'
|
3
|
+
rescue LoadError
|
4
|
+
end
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'capybara/rails'
|
8
|
+
rescue LoadError
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec.configure do |c|
|
12
|
+
if defined?(Capybara::RSpecMatchers)
|
13
|
+
c.include Capybara::RSpecMatchers, :type => :view
|
14
|
+
c.include Capybara::RSpecMatchers, :type => :helper
|
15
|
+
c.include Capybara::RSpecMatchers, :type => :mailer
|
16
|
+
c.include Capybara::RSpecMatchers, :type => :controller
|
17
|
+
end
|
18
|
+
|
19
|
+
if defined?(Capybara::DSL)
|
20
|
+
c.include Capybara::DSL, :type => :controller
|
21
|
+
end
|
22
|
+
|
23
|
+
unless defined?(Capybara::RSpecMatchers) || defined?(Capybara::DSL)
|
24
|
+
if defined?(Capybara)
|
25
|
+
c.include Capybara, :type => :request
|
26
|
+
c.include Capybara, :type => :controller
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
begin
|
2
|
+
require 'webrat'
|
3
|
+
rescue LoadError
|
4
|
+
end
|
5
|
+
|
6
|
+
RSpec.configure do |c|
|
7
|
+
if defined?(Webrat)
|
8
|
+
c.include Webrat::Matchers, :type => :request
|
9
|
+
c.include Webrat::Matchers, :type => :controller
|
10
|
+
c.include Webrat::Matchers, :type => :view
|
11
|
+
c.include Webrat::Matchers, :type => :helper
|
12
|
+
c.include Webrat::Matchers, :type => :mailer
|
13
|
+
|
14
|
+
c.include Webrat::Methods, :type => :request
|
15
|
+
c.include Webrat::Methods, :type => :controller
|
16
|
+
|
17
|
+
module RequestInstanceMethods
|
18
|
+
def last_response
|
19
|
+
@response
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
c.include RequestInstanceMethods, :type => :request
|
24
|
+
|
25
|
+
c.before :type => :controller do
|
26
|
+
Webrat.configure {|c| c.mode = :rails}
|
27
|
+
end
|
28
|
+
|
29
|
+
c.before :type => :request do
|
30
|
+
Webrat.configure {|c| c.mode = :rack}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/rspec/rails/version.rb
CHANGED
data/rspec-rails.gemspec
CHANGED
@@ -22,9 +22,9 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.rdoc_options = ["--charset=UTF-8"]
|
23
23
|
s.require_path = "lib"
|
24
24
|
|
25
|
-
s.add_runtime_dependency(%q<activesupport>, ["
|
26
|
-
s.add_runtime_dependency(%q<actionpack>, ["
|
27
|
-
s.add_runtime_dependency(%q<railties>, ["
|
25
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 3.0"])
|
26
|
+
s.add_runtime_dependency(%q<actionpack>, [">= 3.0"])
|
27
|
+
s.add_runtime_dependency(%q<railties>, [">= 3.0"])
|
28
28
|
if RSpec::Rails::Version::STRING =~ /[a-zA-Z]+/
|
29
29
|
s.add_runtime_dependency "rspec", "= #{RSpec::Rails::Version::STRING}"
|
30
30
|
else
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424057
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 6
|
9
9
|
- 0
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 2.6.0.
|
11
|
+
- 6
|
12
|
+
version: 2.6.0.rc6
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- David Chelimsky
|
@@ -17,14 +17,14 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-05-
|
20
|
+
date: 2011-05-06 00:00:00 -05:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
24
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
hash: 7
|
30
30
|
segments:
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
|
-
- -
|
42
|
+
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
hash: 7
|
45
45
|
segments:
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
55
55
|
none: false
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
hash: 7
|
60
60
|
segments:
|
@@ -71,14 +71,14 @@ dependencies:
|
|
71
71
|
requirements:
|
72
72
|
- - "="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
hash:
|
74
|
+
hash: 15424057
|
75
75
|
segments:
|
76
76
|
- 2
|
77
77
|
- 6
|
78
78
|
- 0
|
79
79
|
- rc
|
80
|
-
-
|
81
|
-
version: 2.6.0.
|
80
|
+
- 6
|
81
|
+
version: 2.6.0.rc6
|
82
82
|
prerelease: false
|
83
83
|
type: :runtime
|
84
84
|
requirement: *id004
|
@@ -149,6 +149,7 @@ files:
|
|
149
149
|
- gemfiles/rails-3.0.5
|
150
150
|
- gemfiles/rails-3.0.6
|
151
151
|
- gemfiles/rails-3.0.7
|
152
|
+
- gemfiles/rails-3.1.0.beta1
|
152
153
|
- gemfiles/rails-master
|
153
154
|
- lib/autotest/rails_rspec2.rb
|
154
155
|
- lib/generators/rspec.rb
|
@@ -182,7 +183,6 @@ files:
|
|
182
183
|
- lib/rspec-rails.rb
|
183
184
|
- lib/rspec/rails.rb
|
184
185
|
- lib/rspec/rails/adapters.rb
|
185
|
-
- lib/rspec/rails/browser_simulators.rb
|
186
186
|
- lib/rspec/rails/example.rb
|
187
187
|
- lib/rspec/rails/example/controller_example_group.rb
|
188
188
|
- lib/rspec/rails/example/helper_example_group.rb
|
@@ -205,6 +205,8 @@ files:
|
|
205
205
|
- lib/rspec/rails/mocks.rb
|
206
206
|
- lib/rspec/rails/module_inclusion.rb
|
207
207
|
- lib/rspec/rails/tasks/rspec.rake
|
208
|
+
- lib/rspec/rails/vendor/capybara.rb
|
209
|
+
- lib/rspec/rails/vendor/webrat.rb
|
208
210
|
- lib/rspec/rails/version.rb
|
209
211
|
- lib/rspec/rails/view_assigns.rb
|
210
212
|
- lib/rspec/rails/view_rendering.rb
|
@@ -274,7 +276,7 @@ rubyforge_project: rspec
|
|
274
276
|
rubygems_version: 1.6.2
|
275
277
|
signing_key:
|
276
278
|
specification_version: 3
|
277
|
-
summary: rspec-rails-2.6.0.
|
279
|
+
summary: rspec-rails-2.6.0.rc6
|
278
280
|
test_files:
|
279
281
|
- features/Autotest.md
|
280
282
|
- features/Changelog.md
|
@@ -1,35 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'capybara/rspec'
|
3
|
-
rescue LoadError
|
4
|
-
end
|
5
|
-
|
6
|
-
begin
|
7
|
-
require 'capybara/rails'
|
8
|
-
rescue LoadError
|
9
|
-
end
|
10
|
-
|
11
|
-
begin
|
12
|
-
require 'webrat'
|
13
|
-
rescue LoadError
|
14
|
-
end
|
15
|
-
|
16
|
-
module RSpec
|
17
|
-
module Rails
|
18
|
-
module BrowserSimulators
|
19
|
-
extend ActiveSupport::Concern
|
20
|
-
|
21
|
-
def self.included(mod)
|
22
|
-
mod.instance_eval do
|
23
|
-
def webrat(&block)
|
24
|
-
block.call if defined?(Webrat)
|
25
|
-
end
|
26
|
-
|
27
|
-
def capybara(&block)
|
28
|
-
block.call if defined?(Capybara)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|