rspec-rails 4.0.1 → 4.0.2

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
  SHA256:
3
- metadata.gz: 2c2f416b4c35d73ddb041ca9781a14bf6b8a312404977c54b23539a707605f23
4
- data.tar.gz: 3d1c40b0b8044843dccc25a1915cfc97aa48129704a3d37a8a951af66af5fd0f
3
+ metadata.gz: e4fdfac614970485c2587ffc56aa4f4f5a79fc2bb2bd49045d607c61fb5bc510
4
+ data.tar.gz: 0b8dabeb32e7b2d9a18c50d722f6c8ebda39610d35e8b45d329e26ff59f9046b
5
5
  SHA512:
6
- metadata.gz: 16c3d14684c86581f8933e4886e79e17554fb5a6306b6f8c798bd22347c7193bd2bf68d62f28b93d73a7b64df279202453f3d6bc15bac14da48c57f303d5c83d
7
- data.tar.gz: 3ad8ffb06ea47224800cd7ce668d6d731c8495aeeaf8922cf2ca3327bd25084b1bd8083f830a9b28c68be4192c007b00aec7132bd1d212e3d847c1413d2d06e3
6
+ metadata.gz: '09c2ebd8e132d6b98f84265e5175a475cf47cd9ac6145324c722f70fa82d328ce7feb5fc8b14e06a44ca18eb22bd66c124e8694ea84965d80ada15884bee4ac5'
7
+ data.tar.gz: 7a58ee48a4f590fde7c376019e531371cd576d7301318f38f1cb53baf817e75b29766d61b10f56fc367d764622478b7baf81c053e72ed63a558726c5dc35eb0e
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,14 @@
1
- ### Development
2
- [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.1...4-0-development)
1
+ ### 4.0.2 / 2020-12-26
2
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.1...v4.0.2)
3
+
4
+ Bug Fixes:
5
+
6
+ * Indent all extra failure lines output from system specs. (Alex Robbin, #2321)
7
+ * Generated request spec for update now uses the correct let. (Paul Hanyzewski, #2344)
8
+ * Return `true`/`false` from predicate methods in config rather than raw values.
9
+ (Phil Pirozhkov, Jon Rowe, #2353, #2354)
10
+ * Remove old #fixture_path feature detection code which broke under newer Rails.
11
+ (Koen Punt, Jon Rowe, #2370)
3
12
 
4
13
  ### 4.0.1 / 2020-05-16
5
14
  [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.0...v4.0.1)
data/README.md CHANGED
@@ -11,7 +11,7 @@ expressed in plain English.
11
11
  Use **[`rspec-rails` 3.x][]** for Rails earlier than 5.0.
12
12
  Use **[`rspec-rails` 1.x][]** for Rails 2.x.
13
13
 
14
- [Build Status]: https://secure.travis-ci.org/rspec/rspec-rails.svg?branch=master
14
+ [Build Status]: https://secure.travis-ci.org/rspec/rspec-rails.svg?branch=main
15
15
  [travis-ci]: https://travis-ci.org/rspec/rspec-rails
16
16
  [Code Climate]: https://codeclimate.com/github/rspec/rspec-rails.svg
17
17
  [code-climate]: https://codeclimate.com/github/rspec/rspec-rails
@@ -30,14 +30,14 @@ Use **[`rspec-rails` 1.x][]** for Rails 2.x.
30
30
  ```ruby
31
31
  # Run against the latest stable release
32
32
  group :development, :test do
33
- gem 'rspec-rails', '~> 4.0.0'
33
+ gem 'rspec-rails', '~> 4.0.1'
34
34
  end
35
35
 
36
- # Or, run against the master branch
37
- # (requires master-branch versions of all related RSpec libraries)
36
+ # Or, run against the main branch
37
+ # (requires main-branch versions of all related RSpec libraries)
38
38
  group :development, :test do
39
39
  %w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib|
40
- gem lib, git: "https://github.com/rspec/#{lib}.git", branch: 'master'
40
+ gem lib, git: "https://github.com/rspec/#{lib}.git", branch: 'main'
41
41
  end
42
42
  end
43
43
  ```
@@ -184,17 +184,17 @@ In addition to [the matchers that come standard in RSpec][],
184
184
  here are some extras that make it easier
185
185
  to test the various parts of a Rails system:
186
186
 
187
- | RSpec matcher | Delegates to | Available in | Notes |
188
- | ------------------------ | ----------------- | ------------------------------- | -------------------------------------------------------- |
189
- | [`be_a_new`][] | | all | primarily intended for controller specs |
190
- | [`render_template`][] | `assert_template` | request / controller / view | use with `expect(response).to` |
191
- | [`redirect_to`][] | `assert_redirect` | request / controller | use with `expect(response).to` |
192
- | [`route_to`] | `assert_routing` | routing / controller | use with `expect(...).to route_to` |
193
- | [`be_routable`] | | routing / controller | use with `expect(...).not_to be_routable` |
194
- | [`have_http_status`][] | | request / controller / feature | |
195
- | [`match_array`][] | | all | for comparing arrays of ActiveRecord objects |
196
- | [`have_been_enqueued`][] | | all | requires config: `ActiveJob::Base.queue_adapter = :test` |
197
- | [`have_enqueued_job`][] | | all | requires config: `ActiveJob::Base.queue_adapter = :test` |
187
+ | RSpec matcher | Delegates to | Available in | Notes |
188
+ | ------------------------ | ------------------- | ------------------------------- | -------------------------------------------------------- |
189
+ | [`be_a_new`][] | | all | primarily intended for controller specs |
190
+ | [`render_template`][] | `assert_template` | request / controller / view | use with `expect(response).to` |
191
+ | [`redirect_to`][] | `assert_redirect` | request / controller | use with `expect(response).to` |
192
+ | [`route_to`] | `assert_recognizes` | routing / controller | use with `expect(...).to route_to` |
193
+ | [`be_routable`] | | routing / controller | use with `expect(...).not_to be_routable` |
194
+ | [`have_http_status`][] | | request / controller / feature | |
195
+ | [`match_array`][] | | all | for comparing arrays of ActiveRecord objects |
196
+ | [`have_been_enqueued`][] | | all | requires config: `ActiveJob::Base.queue_adapter = :test` |
197
+ | [`have_enqueued_job`][] | | all | requires config: `ActiveJob::Base.queue_adapter = :test` |
198
198
 
199
199
  Follow the links above for examples of how each matcher is used.
200
200
 
@@ -94,7 +94,7 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
94
94
  it "updates the requested <%= ns_file_name %>" do
95
95
  <%= file_name %> = <%= class_name %>.create! valid_attributes
96
96
  patch <%= show_helper.tr('@', '') %>,
97
- params: { <%= singular_table_name %>: invalid_attributes }, headers: valid_headers, as: :json
97
+ params: { <%= singular_table_name %>: new_attributes }, headers: valid_headers, as: :json
98
98
  <%= file_name %>.reload
99
99
  skip("Add assertions for updated state")
100
100
  end
@@ -102,9 +102,9 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
102
102
  it "renders a JSON response with the <%= ns_file_name %>" do
103
103
  <%= file_name %> = <%= class_name %>.create! valid_attributes
104
104
  patch <%= show_helper.tr('@', '') %>,
105
- params: { <%= singular_table_name %>: invalid_attributes }, headers: valid_headers, as: :json
105
+ params: { <%= singular_table_name %>: new_attributes }, headers: valid_headers, as: :json
106
106
  expect(response).to have_http_status(:ok)
107
- expect(response.content_type).to eq("application/json")
107
+ expect(response.content_type).to match(a_string_including("application/json"))
108
108
  end
109
109
  end
110
110
 
@@ -1,3 +1,4 @@
1
+ # rubocop: disable Metrics/ModuleLength
1
2
  module RSpec
2
3
  module Rails
3
4
  # Fake class to document RSpec Rails configuration options. In practice,
@@ -55,7 +56,7 @@ module RSpec
55
56
  end
56
57
 
57
58
  # @private
58
- def self.initialize_configuration(config) # rubocop:disable Metrics/MethodLength
59
+ def self.initialize_configuration(config) # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity
59
60
  config.backtrace_exclusion_patterns << /vendor\//
60
61
  config.backtrace_exclusion_patterns << %r{lib/rspec/rails}
61
62
 
@@ -105,7 +106,41 @@ module RSpec
105
106
  end
106
107
 
107
108
  def render_views?
108
- rendering_views
109
+ rendering_views?
110
+ end
111
+
112
+ undef :rendering_views? if respond_to?(:rendering_views?)
113
+ def rendering_views?
114
+ !!rendering_views
115
+ end
116
+
117
+ # Define boolean predicates rather than relying on rspec-core due
118
+ # to the bug fix in rspec/rspec-core#2736, note some of these
119
+ # predicates are a bit nonsensical, but they exist for backwards
120
+ # compatibility, we can tidy these up in `rspec-rails` 5.
121
+ undef :fixture_path? if respond_to?(:fixture_path?)
122
+ def fixture_path?
123
+ !!fixture_path
124
+ end
125
+
126
+ undef :global_fixtures? if respond_to?(:global_fixtures?)
127
+ def global_fixtures?
128
+ !!global_fixtures
129
+ end
130
+
131
+ undef :infer_base_class_for_anonymous_controllers? if respond_to?(:infer_base_class_for_anonymous_controllers?)
132
+ def infer_base_class_for_anonymous_controllers?
133
+ !!infer_base_class_for_anonymous_controllers
134
+ end
135
+
136
+ undef :use_instantiated_fixtures? if respond_to?(:use_instantiated_fixtures?)
137
+ def use_instantiated_fixtures?
138
+ !!use_instantiated_fixtures
139
+ end
140
+
141
+ undef :use_transactional_fixtures? if respond_to?(:use_transactional_fixtures?)
142
+ def use_transactional_fixtures?
143
+ !!use_transactional_fixtures
109
144
  end
110
145
 
111
146
  def infer_spec_type_from_file_location!
@@ -156,3 +191,4 @@ module RSpec
156
191
  initialize_configuration RSpec.configuration
157
192
  end
158
193
  end
194
+ # rubocop: enable Metrics/ModuleLength
@@ -13,7 +13,7 @@ module RSpec
13
13
  def self.create_inbound_email(arg)
14
14
  case arg
15
15
  when Hash
16
- create_inbound_email_from_mail(arg)
16
+ create_inbound_email_from_mail(**arg)
17
17
  else
18
18
  create_inbound_email_from_source(arg.to_s)
19
19
  end
@@ -114,7 +114,8 @@ module RSpec
114
114
  original_after_teardown.bind(self).call
115
115
  ensure
116
116
  myio = $stdout
117
- RSpec.current_example.metadata[:extra_failure_lines] = myio.string
117
+ myio.rewind
118
+ RSpec.current_example.metadata[:extra_failure_lines] = myio.readlines
118
119
  $stdout = orig_stdout
119
120
  end
120
121
  end
@@ -1,7 +1,10 @@
1
1
  RSpec.configure do |rspec|
2
2
  # Delay this in order to give users a chance to configure `expect_with`...
3
3
  rspec.before(:suite) do
4
- if defined?(RSpec::Matchers) && RSpec::Matchers.configuration.syntax.include?(:should) && defined?(ActiveRecord::Associations)
4
+ if defined?(RSpec::Matchers) &&
5
+ RSpec::Matchers.configuration.respond_to?(:syntax) && # RSpec 4 dropped support for monkey-patching `should` syntax
6
+ RSpec::Matchers.configuration.syntax.include?(:should) &&
7
+ defined?(ActiveRecord::Associations)
5
8
  RSpec::Matchers.configuration.add_should_and_should_not_to ActiveRecord::Associations::CollectionProxy
6
9
  end
7
10
  end
@@ -8,7 +8,12 @@ module RSpec
8
8
 
9
9
  def rails_fixture_file_wrapper
10
10
  RailsFixtureFileWrapper.fixture_path = nil
11
- resolved_fixture_path = (fixture_path || RSpec.configuration.fixture_path || '').to_s
11
+ resolved_fixture_path =
12
+ if respond_to?(:fixture_path) && !fixture_path.nil?
13
+ fixture_path.to_s
14
+ else
15
+ (RSpec.configuration.fixture_path || '').to_s
16
+ end
12
17
  RailsFixtureFileWrapper.fixture_path = File.join(resolved_fixture_path, '') unless resolved_fixture_path.strip.empty?
13
18
  RailsFixtureFileWrapper.instance
14
19
  end
@@ -17,22 +22,12 @@ module RSpec
17
22
  include ActionDispatch::TestProcess if defined?(ActionDispatch::TestProcess)
18
23
 
19
24
  class << self
20
- attr_reader :fixture_path
25
+ attr_accessor :fixture_path
21
26
 
22
27
  # Get instance of wrapper
23
28
  def instance
24
29
  @instance ||= new
25
30
  end
26
-
27
- # Override fixture_path set
28
- # to support Rails 3.0->3.1 using ActionController::TestCase class to resolve fixture_path
29
- # see https://apidock.com/rails/v3.0.0/ActionDispatch/TestProcess/fixture_file_upload
30
- def fixture_path=(value)
31
- if ActionController::TestCase.respond_to?(:fixture_path)
32
- ActionController::TestCase.fixture_path = value
33
- end
34
- @fixture_path = value
35
- end
36
31
  end
37
32
  end
38
33
  end
@@ -1,3 +1,3 @@
1
- if defined?(ActiveRecord::Relation)
1
+ if defined?(ActiveRecord::Relation) && defined?(RSpec::Matchers::BuiltIn::OperatorMatcher) # RSpec 4 removed OperatorMatcher
2
2
  RSpec::Matchers::BuiltIn::OperatorMatcher.register(ActiveRecord::Relation, '=~', RSpec::Matchers::BuiltIn::ContainExactly)
3
3
  end
@@ -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 = '4.0.1'
6
+ STRING = '4.0.2'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chelimsky
8
8
  - Andy Lindeman
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain:
12
12
  - |
@@ -44,7 +44,7 @@ cert_chain:
44
44
  ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
45
45
  F3MdtaDehhjC
46
46
  -----END CERTIFICATE-----
47
- date: 2020-05-16 00:00:00.000000000 Z
47
+ date: 2020-12-26 00:00:00.000000000 Z
48
48
  dependencies:
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: actionpack
@@ -94,56 +94,56 @@ dependencies:
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '3.9'
97
+ version: '3.10'
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.9'
104
+ version: '3.10'
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.9'
111
+ version: '3.10'
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.9'
118
+ version: '3.10'
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.9'
125
+ version: '3.10'
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.9'
132
+ version: '3.10'
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.9'
139
+ version: '3.10'
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.9'
146
+ version: '3.10'
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: ammeter
149
149
  requirement: !ruby/object:Gem::Requirement
@@ -296,11 +296,11 @@ licenses:
296
296
  - MIT
297
297
  metadata:
298
298
  bug_tracker_uri: https://github.com/rspec/rspec-rails/issues
299
- changelog_uri: https://github.com/rspec/rspec-rails/blob/v4.0.1/Changelog.md
299
+ changelog_uri: https://github.com/rspec/rspec-rails/blob/v4.0.2/Changelog.md
300
300
  documentation_uri: https://rspec.info/documentation/
301
301
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
302
302
  source_code_uri: https://github.com/rspec/rspec-rails
303
- post_install_message:
303
+ post_install_message:
304
304
  rdoc_options:
305
305
  - "--charset=UTF-8"
306
306
  require_paths:
@@ -316,8 +316,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
316
  - !ruby/object:Gem::Version
317
317
  version: '0'
318
318
  requirements: []
319
- rubygems_version: 3.1.3
320
- signing_key:
319
+ rubygems_version: 3.1.4
320
+ signing_key:
321
321
  specification_version: 4
322
322
  summary: RSpec for Rails
323
323
  test_files: []
metadata.gz.sig CHANGED
Binary file