Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: rspec/rspec-rails
...
head fork: rspec/rspec-rails
  • 11 commits
  • 10 files changed
  • 1 commit comment
  • 3 contributors
16 Changelog.md
View
@@ -1,3 +1,19 @@
+### 2.8.0.rc1 / 2011-11-06
+
+[full changelog](http://github.com/rspec/rspec-rails/compare/v2.7.0...v2.8.0.rc1)
+
+* Enhancements
+ * Removed unnecessary "config.mock_with :rspec" from spec_helper.rb (Paul
+ Annesley)
+
+* Changes
+ * No API changes for rspec-rails in this release, but some internals
+ changed to align with rspec-core-2.8.
+
+* [rspec-core](https://github.com/rspec/rspec-core/blob/master/Changelog.md)
+* [rspec-expectations](https://github.com/rspec/rspec-expectations/blob/master/Changelog.md)
+* [rspec-mocks](https://github.com/rspec/rspec-mocks/blob/master/Changelog.md)
+
### 2.7.0 / 2011-10-16
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.6.1...v2.7.0)
8 gemfiles/base.rb
View
@@ -47,9 +47,11 @@ def self.extended(host)
end
platforms :mri_19 do
- gem 'linecache19', '0.5.11' # 0.5.12 cannot install on 1.9.1, and 0.5.11 appears to work with both 1.9.1 & 1.9.2
- gem 'ruby-debug19'
- gem 'ruby-debug-base19', RUBY_VERSION == '1.9.1' ? '0.11.23' : '~> 0.11.24'
+ if RUBY_VERSION == '1.9.2'
+ gem 'linecache19', '~> 0.5.12'
+ gem 'ruby-debug19', '~> 0.11.6'
+ gem 'ruby-debug-base19', '~> 0.11.25'
+ end
end
platforms :ruby_18, :ruby_19 do
1  lib/generators/rspec/install/templates/spec/spec_helper.rb
View
@@ -16,7 +16,6 @@
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
- config.mock_with :rspec
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
19 lib/generators/rspec/scaffold/scaffold_generator.rb
View
@@ -67,20 +67,19 @@ def params
# support for namespaced-resources
def ns_file_name
- if ARGV[0].match(/(\w+)\/(\w+)/)
- "#{$1.underscore}_#{$2.singularize.underscore}"
- else
- file_name
- end
+ ns_parts.empty? ? file_name : "#{ns_parts[0].underscore}_#{ns_parts[1].singularize.underscore}"
end
# support for namespaced-resources
def ns_table_name
- if ARGV[0].match(/(\w+)\/(\w+)/)
- "#{$1.underscore}/#{$2.tableize}"
- else
- table_name
- end
+ ns_parts.empty? ? table_name : "#{ns_parts[0].underscore}/#{ns_parts[1].tableize}"
+ end
+
+ def ns_parts
+ @ns_parts ||= begin
+ matches = ARGV[0].to_s.match(/\A(\w+)\/(\w+)/)
+ matches ? [matches[1], matches[2]] : []
+ end
end
# Returns the name of the mock. For example, if the file name is user,
3  lib/rspec/rails/fixture_support.rb
View
@@ -29,8 +29,7 @@ module FixtureSupport
RSpec.configure do |c|
c.include RSpec::Rails::FixtureSupport
- c.add_setting :use_transactional_fixtures
- c.add_setting :use_transactional_examples, :alias => :use_transactional_fixtures
+ c.add_setting :use_transactional_fixtures, :alias_with => :use_transactional_examples
c.add_setting :use_instantiated_fixtures
c.add_setting :global_fixtures
c.add_setting :fixture_path
2  lib/rspec/rails/version.rb
View
@@ -1,7 +1,7 @@
module RSpec
module Rails
module Version
- STRING = '2.7.0'
+ STRING = '2.8.0.rc1'
end
end
end
18 lib/rspec/rails/view_rendering.rb
View
@@ -1,16 +1,24 @@
require 'action_view/testing/resolvers'
RSpec.configure do |config|
- config.add_setting :render_views, :default => false
+ # This allows us to expose `render_views` as a config option even though it
+ # breaks the convention of other options by using `render_views` as a
+ # command (i.e. render_views = true), where it would normally be used as a
+ # getter. This makes it easier for rspec-rails users because we use
+ # `render_views` directly in example groups, so this aligns the two APIs,
+ # but requires this workaround:
+ config.add_setting :rendering_views, :default => false
+
+ def config.render_views=(val)
+ self.rendering_views = val
+ end
- # TODO - rspec-core needs a way to define a setting that works like this in
- # one go
def config.render_views
- settings[:render_views] = true
+ self.rendering_views = true
end
def config.render_views?
- settings[:render_views]
+ rendering_views
end
end
74 spec/generators/rspec/scaffold/scaffold_generator_spec.rb
View
@@ -1,40 +1,36 @@
require 'spec_helper'
-# Generators are not automatically loaded by Rails
require 'generators/rspec/scaffold/scaffold_generator'
describe Rspec::Generators::ScaffoldGenerator do
- # Tell the generator where to put its output (what it thinks of as Rails.root)
destination File.expand_path("../../../../../tmp", __FILE__)
before { prepare_destination }
- describe 'controller specs' do
+ describe 'standard controller spec' do
subject { file('spec/controllers/posts_controller_spec.rb') }
- describe 'generated by default' do
- before do
- run_generator %w(posts)
- end
- describe 'the spec' do
- it { should exist }
- it { should contain /require 'spec_helper'/ }
- it { should contain /describe PostsController/ }
- end
+ describe 'with no options' do
+ before { run_generator %w(posts) }
+ it { should contain /require 'spec_helper'/ }
+ it { should contain /describe PostsController/ }
end
- describe 'skipped with a flag' do
- before do
- run_generator %w(posts --no-controller_specs)
- end
+
+ describe 'with --no-controller_specs' do
+ before { run_generator %w(posts --no-controller_specs) }
it { should_not exist }
end
end
+ describe 'namespaced controller spec' do
+ subject { file('spec/controllers/admin/posts_controller_spec.rb') }
+ before { run_generator %w(admin/posts) }
+ it { should contain /describe Admin::PostsController/ }
+ end
+
describe 'view specs' do
- describe 'generated by default' do
- before do
- run_generator %w(posts)
- end
+ describe 'with no options' do
+ before { run_generator %w(posts) }
describe 'edit' do
subject { file("spec/views/posts/edit.html.erb_spec.rb") }
it { should exist }
@@ -42,6 +38,7 @@
it { should contain /describe "(.*)\/edit.html.erb"/ }
it { should contain /it "renders the edit (.*) form"/ }
end
+
describe 'index' do
subject { file("spec/views/posts/index.html.erb_spec.rb") }
it { should exist }
@@ -49,6 +46,7 @@
it { should contain /describe "(.*)\/index.html.erb"/ }
it { should contain /it "renders a list of (.*)"/ }
end
+
describe 'new' do
subject { file("spec/views/posts/new.html.erb_spec.rb") }
it { should exist }
@@ -56,6 +54,7 @@
it { should contain /describe "(.*)\/new.html.erb"/ }
it { should contain /it "renders new (.*) form"/ }
end
+
describe 'show' do
subject { file("spec/views/posts/show.html.erb_spec.rb") }
it { should exist }
@@ -65,22 +64,24 @@
end
end
- describe 'skipped with a flag' do
- before do
- run_generator %w(posts --no-view-specs)
- end
+ describe 'with --no-view-specs' do
+ before { run_generator %w(posts --no-view-specs) }
+
describe 'edit' do
subject { file("spec/views/posts/edit.html.erb_spec.rb") }
it { should_not exist }
end
+
describe 'index' do
subject { file("spec/views/posts/index.html.erb_spec.rb") }
it { should_not exist }
end
+
describe 'new' do
subject { file("spec/views/posts/new.html.erb_spec.rb") }
it { should_not exist }
end
+
describe 'show' do
subject { file("spec/views/posts/show.html.erb_spec.rb") }
it { should_not exist }
@@ -88,26 +89,19 @@
end
end
- describe 'routing specs' do
+ describe 'routing spec' do
subject { file('spec/routing/posts_routing_spec.rb') }
- describe 'generated by default' do
- before do
- run_generator %w(posts)
- end
- describe 'the spec' do
- it { should exist }
- it { should contain /require "spec_helper"/ }
- it { should contain /describe PostsController/ }
- it { should contain /describe "routing"/ }
- end
+ describe 'with default options' do
+ before { run_generator %w(posts) }
+ it { should contain /require "spec_helper"/ }
+ it { should contain /describe PostsController/ }
+ it { should contain /describe "routing"/ }
end
- describe 'skipped with a flag' do
- before do
- run_generator %w(posts --no-routing_specs)
- end
+
+ describe 'with --no-routing-specs' do
+ before { run_generator %w(posts --no-routing_specs) }
it { should_not exist }
end
end
-
end
3  spec/rspec/rails/matchers/relation_match_array_spec.rb
View
@@ -1,6 +1,8 @@
require "spec_helper"
describe "ActiveSupport::Relation =~ matcher" do
+ before { MockableModel.delete_all }
+
let!(:models) { Array.new(3) { MockableModel.create } }
it "verifies that the scope returns the records on the right hand side, regardless of order" do
@@ -9,7 +11,6 @@
it "fails if the scope encompasses more records than on the right hand side" do
another_model = MockableModel.create
-
MockableModel.scoped.should_not =~ models.reverse
end
9 spec/spec_helper.rb
View
@@ -16,12 +16,13 @@ def self.run_all(reporter=nil)
end
end
-RSpec.configure do |c|
- c.before(:each) do
+RSpec.configure do |config|
+ config.before(:each) do
@real_world = RSpec.world
RSpec.instance_variable_set(:@world, RSpec::Core::World.new)
end
- c.after(:each) do
+ config.after(:each) do
RSpec.instance_variable_set(:@world, @real_world)
end
-end
+ config.order = :random
+end

Showing you all comments on commits in this comparison.

David Chelimsky
Owner

FYI - this change broke the generator, but in such a way that we didn't see it in CI. I fixed it in 1b1c181

Something went wrong with that request. Please try again.