rspec-rails 5.0.3 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 829e7ddefdd0596e8b0015b56de40850a711f970ed3bebbe541f34a415b46a40
4
- data.tar.gz: cb3a76cc3cb01705a92c1679473d3a0a488041fb47933a513bee90c91fc2da5c
3
+ metadata.gz: 9911ecc326fa2e641d1d5236121f9b93c9ee47d06c85824eb65c619e4ca81c1e
4
+ data.tar.gz: 0515b3c5ace9cd0b61ccf7824c2d026c1695e7e5ebe4f2c1c50bea64af1dc1b2
5
5
  SHA512:
6
- metadata.gz: f84c6e4ad2c9d546c3d305daf8c6ef4a65f3559fdbea88bd148e3f25503e0b9c1bd520df473a6c0ae2579a40bce2d937edbb7e7b6cada7ad43320f7c7a124303
7
- data.tar.gz: d6e2f6ad0a19e7b821149c0df545f39a0529fd8660bac992b365ec60015a1e2cb0aec7f54cd99ebd8ee6a60eead7aa9fead5c5ade5d7df380304268d630ecc2f
6
+ metadata.gz: e4d76e8a54ff22a9284826050b6a1bbb09d1fb46f395d980e729051ea60ce0cd2441cc926db3d6818e7fb314d57ede64e2d42373ebd887b77a522306e4733688
7
+ data.tar.gz: decce0771196535865fb7facd775edf339f79b7463cd5c53c18ad30aca4d61db6f00c2123307709c6a89bce5aec4338f7a16ab3db1a95677997fb6e8eaae3d42
checksums.yaml.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ### Development
2
- [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.3...5-0-maintenance)
2
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.1.0...5-1-maintenance)
3
+
4
+ ### 5.1.0 / 2022-01-26
5
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.3...v5.1.0)
6
+
7
+ Enhancements:
8
+
9
+ * Make the API request scaffold template more consistent and compatible with
10
+ Rails 6.1. (Naoto Hamada, #2484)
11
+ * Change the scaffold `rails_helper.rb` template to use `require_relative`.
12
+ (Jon Dufresne, #2528)
3
13
 
4
14
  ### 5.0.3 / 2022-01-26
5
15
  [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.2...v5.0.3)
data/README.md CHANGED
@@ -30,8 +30,8 @@ According to [RSpec Rails new versioning strategy][] use:
30
30
 
31
31
  ## Installation
32
32
 
33
- **IMPORTANT** This README / branch refers to the 5.0.x series of releases.
34
- See the [`main` branch on Github](https://github.com/rspec/rspec-rails/tree/main) for more up to date releases.
33
+ **IMPORTANT** This README / branch refers to the current development build.
34
+ See the [`5-0-maintenance` branch on Github](https://github.com/rspec/rspec-rails/tree/5-0-maintenance) if you want or require the latest stable release.
35
35
 
36
36
  1. Add `rspec-rails` to **both** the `:development` and `:test` groups
37
37
  of your app’s `Gemfile`:
@@ -127,6 +127,10 @@ module Rspec
127
127
  def banner
128
128
  self.class.banner
129
129
  end
130
+
131
+ def show_helper(resource_name = file_name)
132
+ "#{singular_route_name}_url(#{resource_name})"
133
+ end
130
134
  end
131
135
  end
132
136
  end
@@ -46,7 +46,7 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
46
46
  describe "GET /show" do
47
47
  it "renders a successful response" do
48
48
  <%= file_name %> = <%= class_name %>.create! valid_attributes
49
- get <%= show_helper.tr('@', '') %>, as: :json
49
+ get <%= show_helper %>, as: :json
50
50
  expect(response).to be_successful
51
51
  end
52
52
  end
@@ -80,7 +80,7 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
80
80
  post <%= index_helper %>_url,
81
81
  params: { <%= singular_table_name %>: invalid_attributes }, headers: valid_headers, as: :json
82
82
  expect(response).to have_http_status(:unprocessable_entity)
83
- expect(response.content_type).to eq("application/json")
83
+ expect(response.content_type).to match(a_string_including("application/json"))
84
84
  end
85
85
  end
86
86
  end
@@ -93,7 +93,7 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
93
93
 
94
94
  it "updates the requested <%= singular_table_name %>" do
95
95
  <%= file_name %> = <%= class_name %>.create! valid_attributes
96
- patch <%= show_helper.tr('@', '') %>,
96
+ patch <%= show_helper %>,
97
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")
@@ -101,7 +101,7 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
101
101
 
102
102
  it "renders a JSON response with the <%= singular_table_name %>" do
103
103
  <%= file_name %> = <%= class_name %>.create! valid_attributes
104
- patch <%= show_helper.tr('@', '') %>,
104
+ patch <%= show_helper %>,
105
105
  params: { <%= singular_table_name %>: new_attributes }, headers: valid_headers, as: :json
106
106
  expect(response).to have_http_status(:ok)
107
107
  expect(response.content_type).to match(a_string_including("application/json"))
@@ -111,10 +111,10 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
111
111
  context "with invalid parameters" do
112
112
  it "renders a JSON response with errors for the <%= singular_table_name %>" do
113
113
  <%= file_name %> = <%= class_name %>.create! valid_attributes
114
- patch <%= show_helper.tr('@', '') %>,
114
+ patch <%= show_helper %>,
115
115
  params: { <%= singular_table_name %>: invalid_attributes }, headers: valid_headers, as: :json
116
116
  expect(response).to have_http_status(:unprocessable_entity)
117
- expect(response.content_type).to eq("application/json")
117
+ expect(response.content_type).to match(a_string_including("application/json"))
118
118
  end
119
119
  end
120
120
  end
@@ -123,7 +123,7 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
123
123
  it "destroys the requested <%= singular_table_name %>" do
124
124
  <%= file_name %> = <%= class_name %>.create! valid_attributes
125
125
  expect {
126
- delete <%= show_helper.tr('@', '') %>, headers: valid_headers, as: :json
126
+ delete <%= show_helper %>, headers: valid_headers, as: :json
127
127
  }.to change(<%= class_name %>, :count).by(-1)
128
128
  end
129
129
  end
@@ -18,6 +18,7 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
18
18
  include Engine.routes.url_helpers
19
19
  <% end -%>
20
20
 
21
+ # This should return the minimal set of attributes required to create a valid
21
22
  # <%= class_name %>. As you add validations to <%= class_name %>, be sure to
22
23
  # adjust the attributes here as well.
23
24
  let(:valid_attributes) {
@@ -41,7 +42,7 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
41
42
  describe "GET /show" do
42
43
  it "renders a successful response" do
43
44
  <%= file_name %> = <%= class_name %>.create! valid_attributes
44
- get <%= show_helper.tr('@', '') %>
45
+ get <%= show_helper %>
45
46
  expect(response).to be_successful
46
47
  end
47
48
  end
@@ -54,9 +55,9 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
54
55
  end
55
56
 
56
57
  describe "GET /edit" do
57
- it "render a successful response" do
58
+ it "renders a successful response" do
58
59
  <%= file_name %> = <%= class_name %>.create! valid_attributes
59
- get <%= edit_helper.tr('@','') %>
60
+ get <%= edit_helper %>
60
61
  expect(response).to be_successful
61
62
  end
62
63
  end
@@ -71,7 +72,7 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
71
72
 
72
73
  it "redirects to the created <%= singular_table_name %>" do
73
74
  post <%= index_helper %>_url, params: { <%= singular_table_name %>: valid_attributes }
74
- expect(response).to redirect_to(<%= show_helper.gsub("\@#{file_name}", class_name+".last") %>)
75
+ expect(response).to redirect_to(<%= show_helper(class_name+".last") %>)
75
76
  end
76
77
  end
77
78
 
@@ -97,14 +98,14 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
97
98
 
98
99
  it "updates the requested <%= singular_table_name %>" do
99
100
  <%= file_name %> = <%= class_name %>.create! valid_attributes
100
- patch <%= show_helper.tr('@', '') %>, params: { <%= singular_table_name %>: new_attributes }
101
+ patch <%= show_helper %>, params: { <%= singular_table_name %>: new_attributes }
101
102
  <%= file_name %>.reload
102
103
  skip("Add assertions for updated state")
103
104
  end
104
105
 
105
106
  it "redirects to the <%= singular_table_name %>" do
106
107
  <%= file_name %> = <%= class_name %>.create! valid_attributes
107
- patch <%= show_helper.tr('@', '') %>, params: { <%= singular_table_name %>: new_attributes }
108
+ patch <%= show_helper %>, params: { <%= singular_table_name %>: new_attributes }
108
109
  <%= file_name %>.reload
109
110
  expect(response).to redirect_to(<%= singular_table_name %>_url(<%= file_name %>))
110
111
  end
@@ -113,7 +114,7 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
113
114
  context "with invalid parameters" do
114
115
  it "renders a successful response (i.e. to display the 'edit' template)" do
115
116
  <%= file_name %> = <%= class_name %>.create! valid_attributes
116
- patch <%= show_helper.tr('@', '') %>, params: { <%= singular_table_name %>: invalid_attributes }
117
+ patch <%= show_helper %>, params: { <%= singular_table_name %>: invalid_attributes }
117
118
  expect(response).to be_successful
118
119
  end
119
120
  end
@@ -123,13 +124,13 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
123
124
  it "destroys the requested <%= singular_table_name %>" do
124
125
  <%= file_name %> = <%= class_name %>.create! valid_attributes
125
126
  expect {
126
- delete <%= show_helper.tr('@', '') %>
127
+ delete <%= show_helper %>
127
128
  }.to change(<%= class_name %>, :count).by(-1)
128
129
  end
129
130
 
130
131
  it "redirects to the <%= table_name %> list" do
131
132
  <%= file_name %> = <%= class_name %>.create! valid_attributes
132
- delete <%= show_helper.tr('@', '') %>
133
+ delete <%= show_helper %>
133
134
  expect(response).to redirect_to(<%= index_helper %>_url)
134
135
  end
135
136
  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 = '5.0.3'
6
+ STRING = '5.1.0'
7
7
  end
8
8
  end
9
9
  end
data.tar.gz.sig CHANGED
Binary file
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: 5.0.3
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chelimsky
@@ -308,7 +308,7 @@ licenses:
308
308
  - MIT
309
309
  metadata:
310
310
  bug_tracker_uri: https://github.com/rspec/rspec-rails/issues
311
- changelog_uri: https://github.com/rspec/rspec-rails/blob/v5.0.3/Changelog.md
311
+ changelog_uri: https://github.com/rspec/rspec-rails/blob/v5.1.0/Changelog.md
312
312
  documentation_uri: https://rspec.info/documentation/
313
313
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
314
314
  source_code_uri: https://github.com/rspec/rspec-rails
metadata.gz.sig CHANGED
Binary file