rspec-rails 2.6.0 → 2.6.1.beta1
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/.travis.yml +3 -2
- data/Rakefile +7 -12
- data/features/.nav +1 -0
- data/features/Changelog.md +11 -0
- data/features/RailsVersions.md +4 -0
- data/features/controller_specs/anonymous_controller.feature +31 -0
- data/features/helper_specs/helper_spec.feature +15 -6
- data/features/matchers/README.md +14 -0
- data/gemfiles/base.rb +1 -0
- data/gemfiles/rails-3.1.0.rc1 +5 -0
- data/gemfiles/rails-master +0 -2
- data/lib/rspec/rails/example/controller_example_group.rb +4 -4
- data/lib/rspec/rails/tasks/rspec.rake +4 -2
- data/lib/rspec/rails/version.rb +1 -1
- data/rspec-rails.gemspec +4 -4
- metadata +17 -10
data/.travis.yml
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
script: "rake --trace 2>&1"
|
1
|
+
script: "gemfiles/bin/rake --trace 2>&1"
|
2
2
|
rvm:
|
3
3
|
- 1.8.7
|
4
4
|
- 1.9.2
|
5
5
|
gemfile:
|
6
6
|
- gemfiles/rails-3.0.7
|
7
|
-
- gemfiles/rails-3.1.0.
|
7
|
+
- gemfiles/rails-3.1.0.rc1
|
8
8
|
- gemfiles/rails-master
|
9
|
+
bundler_args: "--binstubs"
|
9
10
|
env:
|
10
11
|
- CI=true
|
data/Rakefile
CHANGED
@@ -90,16 +90,11 @@ namespace :generate do
|
|
90
90
|
Dir.chdir("./tmp/example_app") do
|
91
91
|
sh "rm -rf test"
|
92
92
|
sh "ln -s #{bindir}"
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
puts "rewrite #{application_filename} with config.assets.enabled = false"
|
97
|
-
File.open(application_filename, "w") do |f|
|
93
|
+
application_file = File.read("config/application.rb")
|
94
|
+
sh "rm config/application.rb"
|
95
|
+
File.open("config/application.rb","w") do |f|
|
98
96
|
f.write application_file.gsub("config.assets.enabled = true","config.assets.enabled = false")
|
99
97
|
end
|
100
|
-
"config/initializers/wrap_parameters.rb".tap do |f|
|
101
|
-
sh "rm #{f}" if test ?f, f
|
102
|
-
end
|
103
98
|
end
|
104
99
|
end
|
105
100
|
end
|
@@ -107,7 +102,7 @@ namespace :generate do
|
|
107
102
|
|
108
103
|
desc "generate a bunch of stuff with generators"
|
109
104
|
task :stuff do
|
110
|
-
in_example_app "rake rails:template LOCATION='../../templates/generate_stuff.rb'"
|
105
|
+
in_example_app "bin/rake rails:template LOCATION='../../templates/generate_stuff.rb'"
|
111
106
|
end
|
112
107
|
end
|
113
108
|
|
@@ -121,19 +116,19 @@ end
|
|
121
116
|
|
122
117
|
namespace :db do
|
123
118
|
task :migrate do
|
124
|
-
in_example_app "rake db:migrate"
|
119
|
+
in_example_app "bin/rake db:migrate"
|
125
120
|
end
|
126
121
|
|
127
122
|
namespace :test do
|
128
123
|
task :prepare do
|
129
|
-
in_example_app "rake db:test:prepare"
|
124
|
+
in_example_app "bin/rake db:test:prepare"
|
130
125
|
end
|
131
126
|
end
|
132
127
|
end
|
133
128
|
|
134
129
|
desc "run a variety of specs against the generated app"
|
135
130
|
task :smoke do
|
136
|
-
in_example_app "rake rails:template --trace LOCATION='../../templates/run_specs.rb'"
|
131
|
+
in_example_app "bin/rake rails:template --trace LOCATION='../../templates/run_specs.rb'"
|
137
132
|
end
|
138
133
|
|
139
134
|
desc 'clobber generated files'
|
data/features/.nav
CHANGED
data/features/Changelog.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
### 2.6.1.beta1 / 2011-05-22
|
2
|
+
|
3
|
+
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.6.0...v2.6.1.beta1)
|
4
|
+
|
5
|
+
This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
|
6
|
+
|
7
|
+
* Bug fixes
|
8
|
+
* fix controller specs with anonymous controllers with around filters
|
9
|
+
* exclude spec directory from rcov metrics
|
10
|
+
* guard against calling prerequisites on nil default rake task (Jack Dempsey)
|
11
|
+
|
1
12
|
### 2.6.0 / 2011-05-12
|
2
13
|
|
3
14
|
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.5.0...v2.6.0)
|
@@ -76,3 +76,34 @@ Feature: anonymous controller
|
|
76
76
|
"""
|
77
77
|
When I run `rspec spec`
|
78
78
|
Then the examples should all pass
|
79
|
+
|
80
|
+
Scenario: regression with ApplicationController around_filters
|
81
|
+
Given a file named "spec/controllers/application_controller_around_filter_spec.rb" with:
|
82
|
+
"""
|
83
|
+
require "spec_helper"
|
84
|
+
|
85
|
+
class ApplicationController < ActionController::Base
|
86
|
+
around_filter :some_around_filter
|
87
|
+
|
88
|
+
def some_around_filter
|
89
|
+
@callback_invoked = true
|
90
|
+
yield
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe ApplicationController do
|
95
|
+
controller do
|
96
|
+
def index
|
97
|
+
render :nothing => true
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
it "invokes the callback" do
|
102
|
+
get :index
|
103
|
+
|
104
|
+
assigns[:callback_invoked].should be_true
|
105
|
+
end
|
106
|
+
end
|
107
|
+
"""
|
108
|
+
When I run `rspec spec`
|
109
|
+
Then the examples should all pass
|
@@ -1,18 +1,27 @@
|
|
1
1
|
Feature: helper spec
|
2
2
|
|
3
3
|
Helper specs live in `spec/helpers`, or any example group with `:type =>
|
4
|
-
:helper`.
|
5
|
-
|
4
|
+
:helper`.
|
5
|
+
|
6
|
+
Helper specs expose a `helper` object, which includes the helper module being
|
7
|
+
specified, the `ApplicationHelper` module (if there is one) and all of the
|
8
|
+
helpers built into Rails. It does not include the other helper modules in
|
9
|
+
your app.
|
10
|
+
|
11
|
+
To access the helper methods you're specifying, simply call them directly
|
12
|
+
on the `helper` object.
|
13
|
+
|
14
|
+
NOTE: helper methods defined in controllers are not included.
|
6
15
|
|
7
|
-
Scenario: helper method that returns
|
16
|
+
Scenario: helper method that returns a value
|
8
17
|
Given a file named "spec/helpers/application_helper_spec.rb" with:
|
9
18
|
"""
|
10
19
|
require "spec_helper"
|
11
20
|
|
12
21
|
describe ApplicationHelper do
|
13
22
|
describe "#page_title" do
|
14
|
-
it "returns
|
15
|
-
helper.page_title.should
|
23
|
+
it "returns the default title" do
|
24
|
+
helper.page_title.should eq("RSpec is your friend")
|
16
25
|
end
|
17
26
|
end
|
18
27
|
end
|
@@ -21,7 +30,7 @@ Feature: helper spec
|
|
21
30
|
"""
|
22
31
|
module ApplicationHelper
|
23
32
|
def page_title
|
24
|
-
|
33
|
+
"RSpec is your friend"
|
25
34
|
end
|
26
35
|
end
|
27
36
|
"""
|
data/features/matchers/README.md
CHANGED
@@ -1,4 +1,18 @@
|
|
1
1
|
rspec-rails offers a number of custom matchers, most of which are
|
2
2
|
rspec-compatible wrappers for Rails' assertions.
|
3
3
|
|
4
|
+
### redirects
|
4
5
|
|
6
|
+
# delegates to assert_redirected_to
|
7
|
+
response.should redirect_to(path)
|
8
|
+
|
9
|
+
### templates
|
10
|
+
|
11
|
+
# delegates to assert_template
|
12
|
+
response.should render_template(template_name)
|
13
|
+
|
14
|
+
### assigned objects
|
15
|
+
|
16
|
+
# passes if assigns(:widget) is an instance of Widget
|
17
|
+
# and it is not persisted
|
18
|
+
assigns(:widget).should be_a_new(Widget)
|
data/gemfiles/base.rb
CHANGED
data/gemfiles/rails-master
CHANGED
@@ -125,14 +125,14 @@ module RSpec::Rails
|
|
125
125
|
# defined in +ApplicationController+, however, are accessible from within
|
126
126
|
# the block.
|
127
127
|
def controller(base_class = ApplicationController, &body)
|
128
|
-
base_class
|
129
|
-
|
130
|
-
|
128
|
+
metadata[:example_group][:describes] = Class.new(base_class, &body)
|
129
|
+
metadata[:example_group][:describes].singleton_class.class_eval do
|
130
|
+
def name; "AnonymousController" end
|
131
131
|
end
|
132
132
|
|
133
133
|
before do
|
134
134
|
@orig_routes, @routes = @routes, ActionDispatch::Routing::RouteSet.new
|
135
|
-
@routes.draw { resources :
|
135
|
+
@routes.draw { resources :anonymous }
|
136
136
|
end
|
137
137
|
|
138
138
|
after do
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'rspec/core'
|
2
2
|
require 'rspec/core/rake_task'
|
3
|
-
Rake.application.instance_variable_get('@tasks')['default']
|
3
|
+
if default = Rake.application.instance_variable_get('@tasks')['default']
|
4
|
+
default.prerequisites.delete('test')
|
5
|
+
end
|
4
6
|
|
5
7
|
spec_prereq = Rails.configuration.generators.options[:rails][:orm] == :active_record ? "db:test:prepare" : :noop
|
6
8
|
task :noop do; end
|
@@ -23,7 +25,7 @@ namespace :spec do
|
|
23
25
|
RSpec::Core::RakeTask.new(:rcov => spec_prereq) do |t|
|
24
26
|
t.rcov = true
|
25
27
|
t.pattern = "./spec/**/*_spec.rb"
|
26
|
-
t.rcov_opts = '--exclude /gems/,/Library/,/usr/,lib/tasks,.bundle,config,/lib/rspec/,/lib/rspec
|
28
|
+
t.rcov_opts = '--exclude /gems/,/Library/,/usr/,lib/tasks,.bundle,config,/lib/rspec/,/lib/rspec-,spec'
|
27
29
|
end
|
28
30
|
|
29
31
|
task :statsetup do
|
data/lib/rspec/rails/version.rb
CHANGED
data/rspec-rails.gemspec
CHANGED
@@ -25,10 +25,10 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0"])
|
26
26
|
s.add_runtime_dependency(%q<actionpack>, ["~> 3.0"])
|
27
27
|
s.add_runtime_dependency(%q<railties>, ["~> 3.0"])
|
28
|
-
if RSpec::Rails::Version::STRING =~ /[a-zA-Z]+/
|
29
|
-
s.add_runtime_dependency "rspec", "= #{RSpec::Rails::Version::STRING}"
|
30
|
-
else
|
28
|
+
# if RSpec::Rails::Version::STRING =~ /[a-zA-Z]+/
|
29
|
+
# s.add_runtime_dependency "rspec", "= #{RSpec::Rails::Version::STRING}"
|
30
|
+
# else
|
31
31
|
s.add_runtime_dependency "rspec", "~> #{RSpec::Rails::Version::STRING.split('.')[0..1].concat(['0']).join('.')}"
|
32
|
-
end
|
32
|
+
# end
|
33
33
|
end
|
34
34
|
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 62196361
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
|
9
|
+
- 1
|
10
|
+
- beta
|
11
|
+
- 1
|
12
|
+
version: 2.6.1.beta1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- David Chelimsky
|
@@ -15,7 +17,7 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date: 2011-05-
|
20
|
+
date: 2011-05-22 00:00:00 -04:00
|
19
21
|
default_executable:
|
20
22
|
dependencies:
|
21
23
|
- !ruby/object:Gem::Dependency
|
@@ -106,6 +108,7 @@ files:
|
|
106
108
|
- features/Generators.md
|
107
109
|
- features/GettingStarted.md
|
108
110
|
- features/README.md
|
111
|
+
- features/RailsVersions.md
|
109
112
|
- features/Upgrade.md
|
110
113
|
- features/controller_specs/README.md
|
111
114
|
- features/controller_specs/anonymous_controller.feature
|
@@ -146,6 +149,7 @@ files:
|
|
146
149
|
- gemfiles/rails-3.0.6
|
147
150
|
- gemfiles/rails-3.0.7
|
148
151
|
- gemfiles/rails-3.1.0.beta1
|
152
|
+
- gemfiles/rails-3.1.0.rc1
|
149
153
|
- gemfiles/rails-master
|
150
154
|
- lib/autotest/rails_rspec2.rb
|
151
155
|
- lib/generators/rspec.rb
|
@@ -258,25 +262,28 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
258
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
259
263
|
none: false
|
260
264
|
requirements:
|
261
|
-
- - "
|
265
|
+
- - ">"
|
262
266
|
- !ruby/object:Gem::Version
|
263
|
-
hash:
|
267
|
+
hash: 25
|
264
268
|
segments:
|
265
|
-
-
|
266
|
-
|
269
|
+
- 1
|
270
|
+
- 3
|
271
|
+
- 1
|
272
|
+
version: 1.3.1
|
267
273
|
requirements: []
|
268
274
|
|
269
275
|
rubyforge_project: rspec
|
270
276
|
rubygems_version: 1.6.2
|
271
277
|
signing_key:
|
272
278
|
specification_version: 3
|
273
|
-
summary: rspec-rails-2.6.
|
279
|
+
summary: rspec-rails-2.6.1.beta1
|
274
280
|
test_files:
|
275
281
|
- features/Autotest.md
|
276
282
|
- features/Changelog.md
|
277
283
|
- features/Generators.md
|
278
284
|
- features/GettingStarted.md
|
279
285
|
- features/README.md
|
286
|
+
- features/RailsVersions.md
|
280
287
|
- features/Upgrade.md
|
281
288
|
- features/controller_specs/README.md
|
282
289
|
- features/controller_specs/anonymous_controller.feature
|