|
40 | 40 | describe "GET /show" do
|
41 | 41 | it "renders a successful response" do
|
42 | 42 | <%= file_name %> = <%= class_name %>.create! valid_attributes
|
43 |
| - get <%= "#{singular_table_name}_url(#{file_name})" %> |
| 43 | + get <%= singular_url_helper(file_name) %> |
44 | 44 | expect(response).to be_successful
|
45 | 45 | end
|
46 | 46 | end
|
|
55 | 55 | describe "GET /edit" do
|
56 | 56 | it "render a successful response" do
|
57 | 57 | <%= file_name %> = <%= class_name %>.create! valid_attributes
|
58 |
| - get <%= "edit_#{singular_table_name}_url(#{file_name})" %> |
| 58 | + get <%= "edit_#{singular_url_helper(file_name)}" %> |
59 | 59 | expect(response).to be_successful
|
60 | 60 | end
|
61 | 61 | end
|
|
70 | 70 |
|
71 | 71 | it "redirects to the created <%= ns_file_name %>" do
|
72 | 72 | post <%= "#{index_helper}_path" %>, params: { <%= ns_file_name %>: valid_attributes }
|
73 |
| - expect(response).to redirect_to(<%= singular_table_name %>_url(<%= class_name %>.last)) |
| 73 | + expect(response).to redirect_to(<%= singular_url_helper("#{class_name}.last") %>) |
74 | 74 | end
|
75 | 75 | end
|
76 | 76 |
|
|
103 | 103 |
|
104 | 104 | it "redirects to the <%= ns_file_name %>" do
|
105 | 105 | <%= file_name %> = <%= class_name %>.create! valid_attributes
|
106 |
| - patch <%= "#{singular_table_name}_url(#{file_name})" %>, params: { <%= singular_table_name %>: new_attributes } |
| 106 | + patch <%= singular_url_helper(file_name) %>, params: { <%= singular_table_name %>: new_attributes } |
107 | 107 | <%= file_name %>.reload
|
108 | 108 | expect(response).to redirect_to(<%= singular_table_name %>_url(<%= file_name %>))
|
109 | 109 | end
|
|
112 | 112 | context "with invalid parameters" do
|
113 | 113 | it "renders a successful response (i.e. to display the 'edit' template)" do
|
114 | 114 | <%= file_name %> = <%= class_name %>.create! valid_attributes
|
115 |
| - patch <%= "#{singular_table_name}_url(#{file_name})" %>, params: { <%= singular_table_name %>: invalid_attributes } |
| 115 | + patch <%= singular_url_helper(file_name) %>, params: { <%= singular_table_name %>: invalid_attributes } |
116 | 116 | expect(response).to be_successful
|
117 | 117 | end
|
118 | 118 | end
|
|
122 | 122 | it "destroys the requested <%= ns_file_name %>" do
|
123 | 123 | <%= file_name %> = <%= class_name %>.create! valid_attributes
|
124 | 124 | expect {
|
125 |
| - delete <%= "#{singular_table_name}_url(#{file_name})" %> |
| 125 | + delete <%= singular_url_helper(file_name) %> |
126 | 126 | }.to change(<%= class_name %>, :count).by(-1)
|
127 | 127 | end
|
128 | 128 |
|
129 | 129 | it "redirects to the <%= table_name %> list" do
|
130 | 130 | <%= file_name %> = <%= class_name %>.create! valid_attributes
|
131 |
| - delete <%= "#{singular_table_name}_url(#{file_name})" %> |
| 131 | + delete <%= singular_url_helper(file_name) %> |
132 | 132 | expect(response).to redirect_to(<%= "#{index_helper}_url" %>)
|
133 | 133 | end
|
134 | 134 | end
|
|
0 commit comments