rspec-rails 3.6.0.beta2 → 3.6.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92a487b773b69d4298893756136ed2ec3bbc1082
4
- data.tar.gz: 175a3d8803f8c795b0b01e5f47f486d4822a9abb
3
+ metadata.gz: 6a7eda925f6b28cb26e136d29619c218ad4fe9ab
4
+ data.tar.gz: 80d510b9fa22f01c66affa8cbb70924dcb10b5c4
5
5
  SHA512:
6
- metadata.gz: caa44ae7581f7d2ed130b86ec3159c4e2d08c131373a2c293799bf160661e9cffc4efb59623265730eb4402ce27b1e9076c1a6dad844469e6475640ca3c934fb
7
- data.tar.gz: f27164ec0efea4782a452ef0aab36b50147d22946a348b9b36aa36eb0ac24c9b2ae2e63b398b89af9eeee09337dc4d4ca109fe320a3d87ae963bef35f3ed3bdc
6
+ metadata.gz: 18f3225f0cd7906ff77d358fadbea8c939b7b79647e7e314d772f9f10438d0b71a9a2477a7f03e33577cfa1bd2834954edac128f9be10bdaa69c896998c0a439
7
+ data.tar.gz: 3a2045da2a6aeea26f06656044f5be1efd57bf173423b84b016ded7febbf6b79cae20c302293bf26ae744f6928ac0218f24b79aea33ccead272ae7a5be76cac4
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,15 @@
1
+ ### 3.6.0 / 2017-05-04
2
+ [Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.6.0.beta2...v3.6.0)
3
+
4
+ Enhancements:
5
+
6
+ * Add compatibility for Rails 5.1. (Sam Phippen, Yuichiro Kaneko, #1790)
7
+
8
+ Bug Fixes:
9
+
10
+ * Fix scaffold generator so that it does not generate broken controller specs
11
+ on Rails 3.x and 4.x. (Yuji Nakayama, #1710)
12
+
1
13
  ### 3.6.0.beta2 / 2016-12-12
2
14
  [Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.6.0.beta1...v3.6.0.beta2)
3
15
 
@@ -5,6 +17,8 @@ Enhancements:
5
17
 
6
18
  * Improve failure output of ActiveJob matchers by listing queued jobs.
7
19
  (Wojciech Wnętrzak, #1722)
20
+ * Load `spec_helper.rb` earlier in `rails_helper.rb` by default.
21
+ (Kevin Glowacz, #1795)
8
22
 
9
23
  ### 3.6.0.beta1 / 2016-10-09
10
24
  [Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.5.2...v3.6.0.beta1)
@@ -1,9 +1,9 @@
1
1
  # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ require 'spec_helper'
2
3
  ENV['RAILS_ENV'] ||= 'test'
3
4
  require File.expand_path('../../config/environment', __FILE__)
4
5
  # Prevent database truncation if the environment is production
5
6
  abort("The Rails environment is running in production mode!") if Rails.env.production?
6
- require 'spec_helper'
7
7
  require 'rspec/rails'
8
8
  # Add additional requires below this line. Rails is not loaded until this point!
9
9
 
@@ -19,6 +19,11 @@ module Rspec
19
19
  class_option :helper_specs, :type => :boolean, :default => true, :desc => "Generate helper specs"
20
20
  class_option :routing_specs, :type => :boolean, :default => true, :desc => "Generate routing specs"
21
21
 
22
+ def initialize(*args, &blk)
23
+ @generator_args = args.first
24
+ super(*args, &blk)
25
+ end
26
+
22
27
  def generate_controller_spec
23
28
  return unless options[:controller_specs]
24
29
 
@@ -59,6 +64,8 @@ module Rspec
59
64
 
60
65
  protected
61
66
 
67
+ attr_reader :generator_args
68
+
62
69
  def copy_view(view)
63
70
  template "#{view}_spec.rb",
64
71
  File.join("spec/views", controller_file_path, "#{view}.html.#{options[:template_engine]}_spec.rb")
@@ -76,7 +83,7 @@ module Rspec
76
83
 
77
84
  def ns_parts
78
85
  @ns_parts ||= begin
79
- matches = ARGV[0].to_s.match(/\A(\w+)(?:\/|::)(\w+)/)
86
+ matches = generator_args[0].to_s.match(/\A(\w+)(?:\/|::)(\w+)/)
80
87
  matches ? [matches[1], matches[2]] : []
81
88
  end
82
89
  end
@@ -46,7 +46,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
46
46
  describe "GET #index" do
47
47
  it "returns a success response" do
48
48
  <%= file_name %> = <%= class_name %>.create! valid_attributes
49
- <% if RUBY_VERSION < '1.9.3' -%>
49
+ <% if Rails::VERSION::STRING < '5.0' -%>
50
50
  get :index, {}, valid_session
51
51
  <% else -%>
52
52
  get :index, params: {}, session: valid_session
@@ -59,7 +59,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
59
59
  describe "GET #show" do
60
60
  it "returns a success response" do
61
61
  <%= file_name %> = <%= class_name %>.create! valid_attributes
62
- <% if RUBY_VERSION < '1.9.3' -%>
62
+ <% if Rails::VERSION::STRING < '5.0' -%>
63
63
  get :show, {:id => <%= file_name %>.to_param}, valid_session
64
64
  <% else -%>
65
65
  get :show, params: {id: <%= file_name %>.to_param}, session: valid_session
@@ -70,7 +70,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
70
70
 
71
71
  describe "GET #new" do
72
72
  it "returns a success response" do
73
- <% if RUBY_VERSION < '1.9.3' -%>
73
+ <% if Rails::VERSION::STRING < '5.0' -%>
74
74
  get :new, {}, valid_session
75
75
  <% else -%>
76
76
  get :new, params: {}, session: valid_session
@@ -82,7 +82,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
82
82
  describe "GET #edit" do
83
83
  it "returns a success response" do
84
84
  <%= file_name %> = <%= class_name %>.create! valid_attributes
85
- <% if RUBY_VERSION < '1.9.3' -%>
85
+ <% if Rails::VERSION::STRING < '5.0' -%>
86
86
  get :edit, {:id => <%= file_name %>.to_param}, valid_session
87
87
  <% else -%>
88
88
  get :edit, params: {id: <%= file_name %>.to_param}, session: valid_session
@@ -95,7 +95,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
95
95
  context "with valid params" do
96
96
  it "creates a new <%= class_name %>" do
97
97
  expect {
98
- <% if RUBY_VERSION < '1.9.3' -%>
98
+ <% if Rails::VERSION::STRING < '5.0' -%>
99
99
  post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
100
100
  <% else -%>
101
101
  post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session
@@ -104,7 +104,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
104
104
  end
105
105
 
106
106
  it "redirects to the created <%= ns_file_name %>" do
107
- <% if RUBY_VERSION < '1.9.3' -%>
107
+ <% if Rails::VERSION::STRING < '5.0' -%>
108
108
  post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
109
109
  <% else -%>
110
110
  post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session
@@ -115,7 +115,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
115
115
 
116
116
  context "with invalid params" do
117
117
  it "returns a success response (i.e. to display the 'new' template)" do
118
- <% if RUBY_VERSION < '1.9.3' -%>
118
+ <% if Rails::VERSION::STRING < '5.0' -%>
119
119
  post :create, {:<%= ns_file_name %> => invalid_attributes}, valid_session
120
120
  <% else -%>
121
121
  post :create, params: {<%= ns_file_name %>: invalid_attributes}, session: valid_session
@@ -133,7 +133,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
133
133
 
134
134
  it "updates the requested <%= ns_file_name %>" do
135
135
  <%= file_name %> = <%= class_name %>.create! valid_attributes
136
- <% if RUBY_VERSION < '1.9.3' -%>
136
+ <% if Rails::VERSION::STRING < '5.0' -%>
137
137
  put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => new_attributes}, valid_session
138
138
  <% else -%>
139
139
  put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, session: valid_session
@@ -144,7 +144,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
144
144
 
145
145
  it "redirects to the <%= ns_file_name %>" do
146
146
  <%= file_name %> = <%= class_name %>.create! valid_attributes
147
- <% if RUBY_VERSION < '1.9.3' -%>
147
+ <% if Rails::VERSION::STRING < '5.0' -%>
148
148
  put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes}, valid_session
149
149
  <% else -%>
150
150
  put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, session: valid_session
@@ -156,7 +156,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
156
156
  context "with invalid params" do
157
157
  it "returns a success response (i.e. to display the 'edit' template)" do
158
158
  <%= file_name %> = <%= class_name %>.create! valid_attributes
159
- <% if RUBY_VERSION < '1.9.3' -%>
159
+ <% if Rails::VERSION::STRING < '5.0' -%>
160
160
  put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => invalid_attributes}, valid_session
161
161
  <% else -%>
162
162
  put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, session: valid_session
@@ -170,7 +170,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
170
170
  it "destroys the requested <%= ns_file_name %>" do
171
171
  <%= file_name %> = <%= class_name %>.create! valid_attributes
172
172
  expect {
173
- <% if RUBY_VERSION < '1.9.3' -%>
173
+ <% if Rails::VERSION::STRING < '5.0' -%>
174
174
  delete :destroy, {:id => <%= file_name %>.to_param}, valid_session
175
175
  <% else -%>
176
176
  delete :destroy, params: {id: <%= file_name %>.to_param}, session: valid_session
@@ -180,7 +180,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
180
180
 
181
181
  it "redirects to the <%= table_name %> list" do
182
182
  <%= file_name %> = <%= class_name %>.create! valid_attributes
183
- <% if RUBY_VERSION < '1.9.3' -%>
183
+ <% if Rails::VERSION::STRING < '5.0' -%>
184
184
  delete :destroy, {:id => <%= file_name %>.to_param}, valid_session
185
185
  <% else -%>
186
186
  delete :destroy, params: {id: <%= file_name %>.to_param}, session: valid_session
@@ -16,7 +16,11 @@ RSpec.describe "<%= ns_table_name %>/edit", <%= type_metatag(:view) %> do
16
16
  assert_select "form[action=?][method=?]", <%= ns_file_name %>_path(@<%= ns_file_name %>), "post" do
17
17
  <% for attribute in output_attributes -%>
18
18
  <%- name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name %>
19
+ <% if Rails.version.to_f >= 5.1 -%>
20
+ assert_select "<%= attribute.input_type -%>[name=?]", "<%= ns_file_name %>[<%= name %>]"
21
+ <% else -%>
19
22
  assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= name %>[name=?]", "<%= ns_file_name %>[<%= name %>]"
23
+ <% end -%>
20
24
  <% end -%>
21
25
  end
22
26
  end
@@ -15,7 +15,11 @@ RSpec.describe "<%= ns_table_name %>/new", <%= type_metatag(:view) %> do
15
15
  assert_select "form[action=?][method=?]", <%= index_helper %>_path, "post" do
16
16
  <% for attribute in output_attributes -%>
17
17
  <%- name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name %>
18
+ <% if Rails.version.to_f >= 5.1 -%>
19
+ assert_select "<%= attribute.input_type -%>[name=?]", "<%= ns_file_name %>[<%= name %>]"
20
+ <% else -%>
18
21
  assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= name %>[name=?]", "<%= ns_file_name %>[<%= name %>]"
22
+ <% end -%>
19
23
  <% end -%>
20
24
  end
21
25
  end
@@ -8,6 +8,7 @@ module RSpec
8
8
  class Railtie < ::Rails::Railtie
9
9
  # As of Rails 5.1.0 you can register directories to work with `rake notes`
10
10
  if ::Rails::VERSION::STRING >= '5.1'
11
+ require 'rails/source_annotation_extractor'
11
12
  SourceAnnotationExtractor::Annotation.register_directories("spec")
12
13
  end
13
14
  # Rails-3.0.1 requires config.app_generators instead of 3.0.0's config.generators
@@ -63,7 +63,7 @@ unless RSpec.respond_to?(:feature)
63
63
  main_feature = nil unless c.expose_dsl_globally?
64
64
  c.alias_example_group_to :feature, opts
65
65
  c.alias_example_to :scenario
66
- c.alias_example_to :xscenario
66
+ c.alias_example_to :xscenario, :skip => 'Temporarily skipped with xscenario'
67
67
  end
68
68
 
69
69
  # Due to load order issues and `config.expose_dsl_globally?` defaulting to
@@ -11,7 +11,6 @@ module RSpec
11
11
  include RSpec::Rails::SetupAndTeardownAdapter
12
12
  include RSpec::Rails::MinitestLifecycleAdapter if ::Rails::VERSION::STRING >= '4'
13
13
  include RSpec::Rails::MinitestAssertionAdapter
14
- include RSpec::Rails::Matchers
15
14
  include RSpec::Rails::FixtureSupport
16
15
  end
17
16
  end
@@ -61,8 +61,8 @@ module RSpec
61
61
  end
62
62
 
63
63
  # @api public
64
- # Passes if actual is an instance of `model_class` and returns `false` for
65
- # `persisted?`. Typically used to specify instance variables assigned to
64
+ # Passes if actual is an instance of `model_class` and returns `true` for
65
+ # `new_record?`. Typically used to specify instance variables assigned to
66
66
  # views by controller actions
67
67
  #
68
68
  # Use the `with` method to specify the specific attributes to match on the
@@ -4,7 +4,7 @@ module RSpec
4
4
  # @private
5
5
  class BeANewRecord < RSpec::Matchers::BuiltIn::BaseMatcher
6
6
  def matches?(actual)
7
- !actual.persisted?
7
+ actual.new_record?
8
8
  end
9
9
 
10
10
  def failure_message
@@ -17,7 +17,7 @@ module RSpec
17
17
  end
18
18
 
19
19
  # @api public
20
- # Passes if actual returns `false` for `persisted?`.
20
+ # Passes if actual returns `true` for `new_record?`.
21
21
  #
22
22
  # @example
23
23
  # get :new
@@ -3,7 +3,7 @@ module RSpec
3
3
  # Version information for RSpec Rails.
4
4
  module Version
5
5
  # Current version of RSpec Rails, in semantic versioning format.
6
- STRING = '3.6.0.beta2'
6
+ STRING = '3.6.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.0.beta2
4
+ version: 3.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chelimsky
@@ -44,7 +44,7 @@ cert_chain:
44
44
  ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
45
45
  F3MdtaDehhjC
46
46
  -----END CERTIFICATE-----
47
- date: 2016-12-12 00:00:00.000000000 Z
47
+ date: 2017-05-04 00:00:00.000000000 Z
48
48
  dependencies:
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: activesupport
@@ -92,58 +92,58 @@ dependencies:
92
92
  name: rspec-core
93
93
  requirement: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '='
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 3.6.0.beta2
97
+ version: 3.6.0
98
98
  type: :runtime
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - '='
102
+ - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: 3.6.0.beta2
104
+ version: 3.6.0
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: rspec-expectations
107
107
  requirement: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - '='
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: 3.6.0.beta2
111
+ version: 3.6.0
112
112
  type: :runtime
113
113
  prerelease: false
114
114
  version_requirements: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '='
116
+ - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: 3.6.0.beta2
118
+ version: 3.6.0
119
119
  - !ruby/object:Gem::Dependency
120
120
  name: rspec-mocks
121
121
  requirement: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - '='
123
+ - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: 3.6.0.beta2
125
+ version: 3.6.0
126
126
  type: :runtime
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '='
130
+ - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: 3.6.0.beta2
132
+ version: 3.6.0
133
133
  - !ruby/object:Gem::Dependency
134
134
  name: rspec-support
135
135
  requirement: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - '='
137
+ - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: 3.6.0.beta2
139
+ version: 3.6.0
140
140
  type: :runtime
141
141
  prerelease: false
142
142
  version_requirements: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - '='
144
+ - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: 3.6.0.beta2
146
+ version: 3.6.0
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: cucumber
149
149
  requirement: !ruby/object:Gem::Requirement
@@ -287,12 +287,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
287
287
  version: '0'
288
288
  required_rubygems_version: !ruby/object:Gem::Requirement
289
289
  requirements:
290
- - - ">"
290
+ - - ">="
291
291
  - !ruby/object:Gem::Version
292
- version: 1.3.1
292
+ version: '0'
293
293
  requirements: []
294
294
  rubyforge_project:
295
- rubygems_version: 2.5.1
295
+ rubygems_version: 2.4.5.2
296
296
  signing_key:
297
297
  specification_version: 4
298
298
  summary: RSpec for Rails
metadata.gz.sig CHANGED
Binary file