|
72 | 72 | end
|
73 | 73 | end
|
74 | 74 |
|
75 |
| - describe "PUT /update" do |
| 75 | + describe "PATCH /update" do |
76 | 76 | context "with valid parameters" do
|
77 | 77 | let(:new_attributes) {
|
78 | 78 | skip("Add a hash of attributes valid for your model")
|
79 | 79 | }
|
80 | 80 |
|
81 | 81 | it "updates the requested <%= ns_file_name %>" do
|
82 | 82 | <%= file_name %> = <%= class_name %>.create! valid_attributes
|
83 |
| - put "/<%= ns_table_name %>/<%= file_name %>.id", params: { <%= ns_file_name %>: new_attributes } |
| 83 | + patch <%= "#{singular_table_name}_url(#{file_name})" %>, params: { <%= singular_table_name %>: new_attributes } |
84 | 84 | <%= file_name %>.reload
|
85 | 85 | skip("Add assertions for updated state")
|
86 | 86 | end
|
87 | 87 |
|
88 | 88 | it "redirects to the <%= ns_file_name %>" do
|
89 | 89 | <%= file_name %> = <%= class_name %>.create! valid_attributes
|
90 |
| - put "/<%= ns_table_name %>/<%= file_name %>.id", params: { <%= ns_file_name %>: new_attributes } |
| 90 | + patch <%= "#{singular_table_name}_url(#{file_name})" %>, params: { <%= singular_table_name %>: new_attributes } |
91 | 91 | <%= file_name %>.reload
|
92 |
| - expect(response).to redirect_to("<%= ns_table_name %>/#{<%= file_name %>.id}") |
| 92 | + expect(response).to redirect_to(<%= singular_table_name %>_url(<%= file_name %>)) |
93 | 93 | end
|
94 | 94 | end
|
95 | 95 |
|
96 | 96 | context "with invalid parameters" do
|
97 | 97 | it "renders a successful response (i.e. to display the 'edit' template)" do
|
98 |
| - put "/<%= ns_table_name %>/<%= file_name %>.id", params: { <%= ns_file_name %>: invalid_attributes } |
| 98 | + <%= file_name %> = <%= class_name %>.create! valid_attributes |
| 99 | + patch <%= "#{singular_table_name}_url(#{file_name})" %>, params: { <%= singular_table_name %>: invalid_attributes } |
99 | 100 | expect(response).to be_successful
|
100 | 101 | end
|
101 | 102 | end
|
|
112 | 113 | it "redirects to the <%= table_name %> list" do
|
113 | 114 | <%= file_name %> = <%= class_name %>.create! valid_attributes
|
114 | 115 | delete "/<%= ns_table_name %>/<%= file_name %>.id"
|
115 |
| - expect(response).to redirect_to("<%= ns_table_name %>/#{<%= class_name %>.last}") |
| 116 | + expect(response).to redirect_to(<%= "#{index_helper}_url" %>) |
116 | 117 | end
|
117 | 118 | end
|
118 | 119 | end
|
|
0 commit comments