rspec-rails 2.6.0 → 2.6.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/.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.beta1
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
@@ -35,9 +35,7 @@ MSG
35
35
  end
36
36
  end
37
37
 
38
- require 'rake'
39
38
  require 'yaml'
40
-
41
39
  require 'rspec'
42
40
  require 'rspec/core/rake_task'
43
41
 
@@ -90,16 +88,11 @@ namespace :generate do
90
88
  Dir.chdir("./tmp/example_app") do
91
89
  sh "rm -rf test"
92
90
  sh "ln -s #{bindir}"
93
- application_filename = "config/application.rb"
94
- application_file = File.read(application_filename)
95
- sh "rm #{application_filename}"
96
- puts "rewrite #{application_filename} with config.assets.enabled = false"
97
- File.open(application_filename, "w") do |f|
91
+ application_file = File.read("config/application.rb")
92
+ sh "rm config/application.rb"
93
+ File.open("config/application.rb","w") do |f|
98
94
  f.write application_file.gsub("config.assets.enabled = true","config.assets.enabled = false")
99
95
  end
100
- "config/initializers/wrap_parameters.rb".tap do |f|
101
- sh "rm #{f}" if test ?f, f
102
- end
103
96
  end
104
97
  end
105
98
  end
@@ -107,7 +100,7 @@ namespace :generate do
107
100
 
108
101
  desc "generate a bunch of stuff with generators"
109
102
  task :stuff do
110
- in_example_app "rake rails:template LOCATION='../../templates/generate_stuff.rb'"
103
+ in_example_app "bin/rake rails:template LOCATION='../../templates/generate_stuff.rb'"
111
104
  end
112
105
  end
113
106
 
@@ -121,19 +114,19 @@ end
121
114
 
122
115
  namespace :db do
123
116
  task :migrate do
124
- in_example_app "rake db:migrate"
117
+ in_example_app "bin/rake db:migrate"
125
118
  end
126
119
 
127
120
  namespace :test do
128
121
  task :prepare do
129
- in_example_app "rake db:test:prepare"
122
+ in_example_app "bin/rake db:test:prepare"
130
123
  end
131
124
  end
132
125
  end
133
126
 
134
127
  desc "run a variety of specs against the generated app"
135
128
  task :smoke do
136
- in_example_app "rake rails:template --trace LOCATION='../../templates/run_specs.rb'"
129
+ in_example_app "bin/rake rails:template --trace LOCATION='../../templates/run_specs.rb'"
137
130
  end
138
131
 
139
132
  desc 'clobber generated files'
data/Thorfile CHANGED
@@ -1,14 +1,7 @@
1
1
  class Gemfile < Thor
2
2
  desc "use VERSION", "installs the bundle using gemfiles/rails-VERSION"
3
3
  def use(version)
4
- "gemfiles/rails-#{version}".tap do |gemfile|
5
- ENV["BUNDLE_GEMFILE"] = File.expand_path(gemfile)
6
- say "Using #{gemfile}"
7
- end
8
- "bundle install --binstubs".tap do |m|
9
- say m
10
- system m
11
- end
4
+ with(version, %w[bundle install --binstubs])
12
5
  unless version =~ /^\d\.\d\.\d/
13
6
  "bundle update rails".tap do |m|
14
7
  say m
@@ -19,6 +12,18 @@ class Gemfile < Thor
19
12
  `echo rails-#{version} > ./.gemfile`
20
13
  end
21
14
 
15
+ desc "with VERSION COMMAND", "executes COMMAND with the gemfile for VERSION"
16
+ def with(version, *command)
17
+ "gemfiles/rails-#{version}".tap do |gemfile|
18
+ ENV["BUNDLE_GEMFILE"] = File.expand_path(gemfile)
19
+ say "BUNDLE_GEMFILE=#{gemfile}"
20
+ end
21
+ command.join(' ').tap do |m|
22
+ say m
23
+ system m
24
+ end
25
+ end
26
+
22
27
  desc "which", "print out the configured gemfile"
23
28
  def which
24
29
  say `cat ./.gemfile`
data/features/.nav CHANGED
@@ -4,6 +4,7 @@
4
4
  - Autotest.md (Autotest integration)
5
5
  - Changelog.md
6
6
  - Upgrade.md
7
+ - RailsVersions.md (Rails versions)
7
8
  - request_specs:
8
9
  - request_spec.feature
9
10
  - model_specs:
@@ -1,3 +1,14 @@
1
+ ### 2.6.1 / 2011-05-25
2
+
3
+ [full changelog](http://github.com/rspec/rspec-rails/compare/v2.6.0...v2.6.1)
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)
@@ -0,0 +1,4 @@
1
+ rails version | rspec-rails version
2
+ 2.3 | 1.3.4
3
+ 3.0 | >= 2.0
4
+ 3.1 | >= 2.6
@@ -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`. In order to access the helper methods you can call them on the
5
- `helper` object.
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 true
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 true" do
15
- helper.page_title.should be_true
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
- true
33
+ "RSpec is your friend"
25
34
  end
26
35
  end
27
36
  """
@@ -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
@@ -14,6 +14,8 @@ module GemfileBase
14
14
  end
15
15
  end
16
16
 
17
+ gem 'rake', '0.8.7'
18
+ gem 'rdoc'
17
19
  gem 'sqlite3-ruby', :require => 'sqlite3'
18
20
  gem "cucumber", "~> 0.10.2"
19
21
  gem "aruba", "~> 0.3.6"
@@ -2,4 +2,4 @@ require File.expand_path("../base.rb", __FILE__)
2
2
 
3
3
  extend GemfileBase
4
4
 
5
- gem "rails", "3.1.0.beta1"
5
+ gem "rails", "3.1.0.rc1"
@@ -3,5 +3,3 @@ require File.expand_path("../base.rb", __FILE__)
3
3
  extend GemfileBase
4
4
 
5
5
  gem "rails", :git => "git://github.com/rails/rails.git"
6
- gem "arel", :git => "git://github.com/rails/arel.git"
7
- gem "rack", :git => "git://github.com/rack/rack.git"
@@ -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.dup.tap do |new_base|
129
- def new_base.name; "StubResourcesController"; end
130
- metadata[:example_group][:describes] = Class.new(new_base, &body)
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 :stub_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'].prerequisites.delete('test')
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
@@ -1,7 +1,7 @@
1
1
  module RSpec # :nodoc:
2
2
  module Rails # :nodoc:
3
3
  module Version # :nodoc:
4
- STRING = '2.6.0'
4
+ STRING = '2.6.1'
5
5
  end
6
6
  end
7
7
  end
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,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 6
9
- - 0
10
- version: 2.6.0
9
+ - 1
10
+ version: 2.6.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Chelimsky
@@ -15,11 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-12 00:00:00 -05:00
18
+ date: 2011-05-25 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ type: :runtime
23
+ requirement: &id001 !ruby/object:Gem::Requirement
23
24
  none: false
24
25
  requirements:
25
26
  - - ~>
@@ -29,12 +30,12 @@ dependencies:
29
30
  - 3
30
31
  - 0
31
32
  version: "3.0"
32
- prerelease: false
33
- type: :runtime
34
- requirement: *id001
33
+ version_requirements: *id001
35
34
  name: activesupport
35
+ prerelease: false
36
36
  - !ruby/object:Gem::Dependency
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
37
+ type: :runtime
38
+ requirement: &id002 !ruby/object:Gem::Requirement
38
39
  none: false
39
40
  requirements:
40
41
  - - ~>
@@ -44,12 +45,12 @@ dependencies:
44
45
  - 3
45
46
  - 0
46
47
  version: "3.0"
47
- prerelease: false
48
- type: :runtime
49
- requirement: *id002
48
+ version_requirements: *id002
50
49
  name: actionpack
50
+ prerelease: false
51
51
  - !ruby/object:Gem::Dependency
52
- version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ type: :runtime
53
+ requirement: &id003 !ruby/object:Gem::Requirement
53
54
  none: false
54
55
  requirements:
55
56
  - - ~>
@@ -59,12 +60,12 @@ dependencies:
59
60
  - 3
60
61
  - 0
61
62
  version: "3.0"
62
- prerelease: false
63
- type: :runtime
64
- requirement: *id003
63
+ version_requirements: *id003
65
64
  name: railties
65
+ prerelease: false
66
66
  - !ruby/object:Gem::Dependency
67
- version_requirements: &id004 !ruby/object:Gem::Requirement
67
+ type: :runtime
68
+ requirement: &id004 !ruby/object:Gem::Requirement
68
69
  none: false
69
70
  requirements:
70
71
  - - ~>
@@ -75,10 +76,9 @@ dependencies:
75
76
  - 6
76
77
  - 0
77
78
  version: 2.6.0
78
- prerelease: false
79
- type: :runtime
80
- requirement: *id004
79
+ version_requirements: *id004
81
80
  name: rspec
81
+ prerelease: false
82
82
  description: RSpec-2 for Rails-3
83
83
  email: dchelimsky@gmail.com
84
84
  executables: []
@@ -106,6 +106,7 @@ files:
106
106
  - features/Generators.md
107
107
  - features/GettingStarted.md
108
108
  - features/README.md
109
+ - features/RailsVersions.md
109
110
  - features/Upgrade.md
110
111
  - features/controller_specs/README.md
111
112
  - features/controller_specs/anonymous_controller.feature
@@ -145,7 +146,7 @@ files:
145
146
  - gemfiles/rails-3.0.5
146
147
  - gemfiles/rails-3.0.6
147
148
  - gemfiles/rails-3.0.7
148
- - gemfiles/rails-3.1.0.beta1
149
+ - gemfiles/rails-3.1.0.rc1
149
150
  - gemfiles/rails-master
150
151
  - lib/autotest/rails_rspec2.rb
151
152
  - lib/generators/rspec.rb
@@ -270,13 +271,14 @@ rubyforge_project: rspec
270
271
  rubygems_version: 1.6.2
271
272
  signing_key:
272
273
  specification_version: 3
273
- summary: rspec-rails-2.6.0
274
+ summary: rspec-rails-2.6.1
274
275
  test_files:
275
276
  - features/Autotest.md
276
277
  - features/Changelog.md
277
278
  - features/Generators.md
278
279
  - features/GettingStarted.md
279
280
  - features/README.md
281
+ - features/RailsVersions.md
280
282
  - features/Upgrade.md
281
283
  - features/controller_specs/README.md
282
284
  - features/controller_specs/anonymous_controller.feature