Skip to content
This repository
  • 11 commits
  • 10 files changed
  • 1 comment
  • 3 contributors
16  Changelog.md
Source Rendered
... ...
@@ -1,3 +1,19 @@
  1
+### 2.8.0.rc1 / 2011-11-06
  2
+
  3
+[full changelog](http://github.com/rspec/rspec-rails/compare/v2.7.0...v2.8.0.rc1)
  4
+
  5
+* Enhancements
  6
+    * Removed unnecessary "config.mock_with :rspec" from spec_helper.rb (Paul
  7
+      Annesley)
  8
+
  9
+* Changes
  10
+    * No API changes for rspec-rails in this release, but some internals
  11
+      changed to align with rspec-core-2.8.
  12
+
  13
+* [rspec-core](https://github.com/rspec/rspec-core/blob/master/Changelog.md)
  14
+* [rspec-expectations](https://github.com/rspec/rspec-expectations/blob/master/Changelog.md)
  15
+* [rspec-mocks](https://github.com/rspec/rspec-mocks/blob/master/Changelog.md)
  16
+
1 17
 ### 2.7.0 / 2011-10-16
2 18
 
3 19
 [full changelog](http://github.com/rspec/rspec-rails/compare/v2.6.1...v2.7.0)
8  gemfiles/base.rb
@@ -47,9 +47,11 @@ def self.extended(host)
47 47
         end
48 48
 
49 49
         platforms :mri_19 do
50  
-          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
51  
-          gem 'ruby-debug19'
52  
-          gem 'ruby-debug-base19', RUBY_VERSION == '1.9.1' ? '0.11.23' : '~> 0.11.24'
  50
+          if RUBY_VERSION == '1.9.2'
  51
+            gem 'linecache19', '~> 0.5.12'
  52
+            gem 'ruby-debug19', '~> 0.11.6'
  53
+            gem 'ruby-debug-base19', '~> 0.11.25'
  54
+          end
53 55
         end
54 56
 
55 57
         platforms :ruby_18, :ruby_19 do
1  lib/generators/rspec/install/templates/spec/spec_helper.rb
@@ -16,7 +16,6 @@
16 16
   # config.mock_with :mocha
17 17
   # config.mock_with :flexmock
18 18
   # config.mock_with :rr
19  
-  config.mock_with :rspec
20 19
 
21 20
   # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
22 21
   config.fixture_path = "#{::Rails.root}/spec/fixtures"
19  lib/generators/rspec/scaffold/scaffold_generator.rb
@@ -67,20 +67,19 @@ def params
67 67
 
68 68
         # support for namespaced-resources
69 69
         def ns_file_name
70  
-          if ARGV[0].match(/(\w+)\/(\w+)/)
71  
-            "#{$1.underscore}_#{$2.singularize.underscore}"
72  
-          else
73  
-            file_name
74  
-          end
  70
+          ns_parts.empty? ? file_name : "#{ns_parts[0].underscore}_#{ns_parts[1].singularize.underscore}"
75 71
         end
76 72
 
77 73
         # support for namespaced-resources
78 74
         def ns_table_name
79  
-          if ARGV[0].match(/(\w+)\/(\w+)/)
80  
-            "#{$1.underscore}/#{$2.tableize}"
81  
-          else
82  
-            table_name
83  
-          end
  75
+          ns_parts.empty? ? table_name : "#{ns_parts[0].underscore}/#{ns_parts[1].tableize}"
  76
+        end
  77
+
  78
+        def ns_parts
  79
+          @ns_parts ||= begin
  80
+                          matches = ARGV[0].to_s.match(/\A(\w+)\/(\w+)/)
  81
+                          matches ? [matches[1], matches[2]] : []
  82
+                        end
84 83
         end
85 84
 
86 85
         # Returns the name of the mock. For example, if the file name is user,
3  lib/rspec/rails/fixture_support.rb
@@ -29,8 +29,7 @@ module FixtureSupport
29 29
 
30 30
       RSpec.configure do |c|
31 31
         c.include RSpec::Rails::FixtureSupport
32  
-        c.add_setting :use_transactional_fixtures
33  
-        c.add_setting :use_transactional_examples, :alias => :use_transactional_fixtures
  32
+        c.add_setting :use_transactional_fixtures, :alias_with => :use_transactional_examples
34 33
         c.add_setting :use_instantiated_fixtures
35 34
         c.add_setting :global_fixtures
36 35
         c.add_setting :fixture_path
2  lib/rspec/rails/version.rb
... ...
@@ -1,7 +1,7 @@
1 1
 module RSpec
2 2
   module Rails
3 3
     module Version
4  
-      STRING = '2.7.0'
  4
+      STRING = '2.8.0.rc1'
5 5
     end
6 6
   end
7 7
 end
18  lib/rspec/rails/view_rendering.rb
... ...
@@ -1,16 +1,24 @@
1 1
 require 'action_view/testing/resolvers'
2 2
 
3 3
 RSpec.configure do |config|
4  
-  config.add_setting :render_views, :default => false
  4
+  # This allows us to expose `render_views` as a config option even though it
  5
+  # breaks the convention of other options by using `render_views` as a
  6
+  # command (i.e. render_views = true), where it would normally be used as a
  7
+  # getter. This makes it easier for rspec-rails users because we use
  8
+  # `render_views` directly in example groups, so this aligns the two APIs,
  9
+  # but requires this workaround:
  10
+  config.add_setting :rendering_views, :default => false
  11
+
  12
+  def config.render_views=(val)
  13
+    self.rendering_views = val
  14
+  end
5 15
 
6  
-  # TODO - rspec-core needs a way to define a setting that works like this in
7  
-  # one go
8 16
   def config.render_views
9  
-    settings[:render_views] = true
  17
+    self.rendering_views = true
10 18
   end
11 19
 
12 20
   def config.render_views?
13  
-    settings[:render_views]
  21
+    rendering_views
14 22
   end
15 23
 end
16 24
 
74  spec/generators/rspec/scaffold/scaffold_generator_spec.rb
... ...
@@ -1,40 +1,36 @@
1 1
 require 'spec_helper'
2 2
 
3  
-# Generators are not automatically loaded by Rails
4 3
 require 'generators/rspec/scaffold/scaffold_generator'
5 4
 
6 5
 describe Rspec::Generators::ScaffoldGenerator do
7  
-  # Tell the generator where to put its output (what it thinks of as Rails.root)
8 6
   destination File.expand_path("../../../../../tmp", __FILE__)
9 7
 
10 8
   before { prepare_destination }
11 9
 
12  
-  describe 'controller specs' do
  10
+  describe 'standard controller spec' do
13 11
     subject { file('spec/controllers/posts_controller_spec.rb') }
14  
-    describe 'generated by default' do
15  
-      before do
16  
-        run_generator %w(posts)
17  
-      end
18 12
 
19  
-      describe 'the spec' do
20  
-        it { should exist }
21  
-        it { should contain /require 'spec_helper'/ }
22  
-        it { should contain /describe PostsController/ }
23  
-      end
  13
+    describe 'with no options' do
  14
+      before { run_generator %w(posts) }
  15
+      it { should contain /require 'spec_helper'/ }
  16
+      it { should contain /describe PostsController/ }
24 17
     end
25  
-    describe 'skipped with a flag' do
26  
-      before do
27  
-        run_generator %w(posts --no-controller_specs)
28  
-      end
  18
+
  19
+    describe 'with --no-controller_specs' do
  20
+      before { run_generator %w(posts --no-controller_specs) }
29 21
       it { should_not exist }
30 22
     end
31 23
   end
32 24
 
  25
+  describe 'namespaced controller spec' do
  26
+    subject { file('spec/controllers/admin/posts_controller_spec.rb') }
  27
+    before  { run_generator %w(admin/posts) }
  28
+    it { should contain /describe Admin::PostsController/ }
  29
+  end
  30
+
33 31
   describe 'view specs' do
34  
-    describe 'generated by default' do
35  
-      before do
36  
-        run_generator %w(posts)
37  
-      end
  32
+    describe 'with no options' do
  33
+      before { run_generator %w(posts) }
38 34
       describe 'edit' do
39 35
         subject { file("spec/views/posts/edit.html.erb_spec.rb") }
40 36
         it { should exist }
@@ -42,6 +38,7 @@
42 38
         it { should contain /describe "(.*)\/edit.html.erb"/ }
43 39
         it { should contain /it "renders the edit (.*) form"/ }
44 40
       end
  41
+
45 42
       describe 'index' do
46 43
         subject { file("spec/views/posts/index.html.erb_spec.rb") }
47 44
         it { should exist }
@@ -49,6 +46,7 @@
49 46
         it { should contain /describe "(.*)\/index.html.erb"/ }
50 47
         it { should contain /it "renders a list of (.*)"/ }
51 48
       end
  49
+
52 50
       describe 'new' do
53 51
         subject { file("spec/views/posts/new.html.erb_spec.rb") }
54 52
         it { should exist }
@@ -56,6 +54,7 @@
56 54
         it { should contain /describe "(.*)\/new.html.erb"/ }
57 55
         it { should contain /it "renders new (.*) form"/ }
58 56
       end
  57
+
59 58
       describe 'show' do
60 59
         subject { file("spec/views/posts/show.html.erb_spec.rb") }
61 60
         it { should exist }
@@ -65,22 +64,24 @@
65 64
       end
66 65
     end
67 66
 
68  
-    describe 'skipped with a flag' do
69  
-      before do
70  
-        run_generator %w(posts --no-view-specs)
71  
-      end
  67
+    describe 'with --no-view-specs' do
  68
+      before { run_generator %w(posts --no-view-specs) }
  69
+
72 70
       describe 'edit' do
73 71
         subject { file("spec/views/posts/edit.html.erb_spec.rb") }
74 72
         it { should_not exist }
75 73
       end
  74
+
76 75
       describe 'index' do
77 76
         subject { file("spec/views/posts/index.html.erb_spec.rb") }
78 77
         it { should_not exist }
79 78
       end
  79
+
80 80
       describe 'new' do
81 81
         subject { file("spec/views/posts/new.html.erb_spec.rb") }
82 82
         it { should_not exist }
83 83
       end
  84
+
84 85
       describe 'show' do
85 86
         subject { file("spec/views/posts/show.html.erb_spec.rb") }
86 87
         it { should_not exist }
@@ -88,26 +89,19 @@
88 89
     end
89 90
   end
90 91
 
91  
-  describe 'routing specs' do
  92
+  describe 'routing spec' do
92 93
     subject { file('spec/routing/posts_routing_spec.rb') }
93  
-    describe 'generated by default' do
94  
-      before do
95  
-        run_generator %w(posts)
96  
-      end
97 94
 
98  
-      describe 'the spec' do
99  
-        it { should exist }
100  
-        it { should contain /require "spec_helper"/ }
101  
-        it { should contain /describe PostsController/ }
102  
-        it { should contain /describe "routing"/ }
103  
-      end
  95
+    describe 'with default options' do
  96
+      before { run_generator %w(posts) }
  97
+      it { should contain /require "spec_helper"/ }
  98
+      it { should contain /describe PostsController/ }
  99
+      it { should contain /describe "routing"/ }
104 100
     end
105  
-    describe 'skipped with a flag' do
106  
-      before do
107  
-        run_generator %w(posts --no-routing_specs)
108  
-      end
  101
+
  102
+    describe 'with --no-routing-specs' do
  103
+      before { run_generator %w(posts --no-routing_specs) }
109 104
       it { should_not exist }
110 105
     end
111 106
   end
112  
-
113 107
 end
3  spec/rspec/rails/matchers/relation_match_array_spec.rb
... ...
@@ -1,6 +1,8 @@
1 1
 require "spec_helper"
2 2
 
3 3
 describe "ActiveSupport::Relation =~ matcher" do
  4
+  before { MockableModel.delete_all }
  5
+  
4 6
   let!(:models) { Array.new(3) { MockableModel.create } }
5 7
 
6 8
   it "verifies that the scope returns the records on the right hand side, regardless of order" do
@@ -9,7 +11,6 @@
9 11
 
10 12
   it "fails if the scope encompasses more records than on the right hand side" do
11 13
     another_model = MockableModel.create
12  
-
13 14
     MockableModel.scoped.should_not =~ models.reverse
14 15
   end
15 16
 
9  spec/spec_helper.rb
@@ -16,12 +16,13 @@ def self.run_all(reporter=nil)
16 16
   end
17 17
 end
18 18
 
19  
-RSpec.configure do |c|
20  
-  c.before(:each) do
  19
+RSpec.configure do |config|
  20
+  config.before(:each) do
21 21
     @real_world = RSpec.world
22 22
     RSpec.instance_variable_set(:@world, RSpec::Core::World.new)
23 23
   end
24  
-  c.after(:each) do
  24
+  config.after(:each) do
25 25
     RSpec.instance_variable_set(:@world, @real_world)
26 26
   end
27  
-end
  27
+  config.order = :random
  28
+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.