|
56 | 56 | it "creates a new <%= class_name %>" do |
57 | 57 | expect { |
58 | 58 | post <%= index_helper %>_url, |
59 | | - params: { <%= ns_file_name %>: valid_attributes }, headers: valid_headers, as: :json |
| 59 | + params: { <%= singular_table_name %>: valid_attributes }, headers: valid_headers, as: :json |
60 | 60 | }.to change(<%= class_name %>, :count).by(1) |
61 | 61 | end |
62 | 62 |
|
63 | | - it "renders a JSON response with the new <%= ns_file_name %>" do |
| 63 | + it "renders a JSON response with the new <%= singular_table_name %>" do |
64 | 64 | post <%= index_helper %>_url, |
65 | | - params: { <%= ns_file_name %>: valid_attributes }, headers: valid_headers, as: :json |
| 65 | + params: { <%= singular_table_name %>: valid_attributes }, headers: valid_headers, as: :json |
66 | 66 | expect(response).to have_http_status(:created) |
67 | 67 | expect(response.content_type).to match(a_string_including("application/json")) |
68 | 68 | end |
|
72 | 72 | it "does not create a new <%= class_name %>" do |
73 | 73 | expect { |
74 | 74 | post <%= index_helper %>_url, |
75 | | - params: { <%= ns_file_name %>: invalid_attributes }, as: :json |
| 75 | + params: { <%= singular_table_name %>: invalid_attributes }, as: :json |
76 | 76 | }.to change(<%= class_name %>, :count).by(0) |
77 | 77 | end |
78 | 78 |
|
79 | | - it "renders a JSON response with errors for the new <%= ns_file_name %>" do |
| 79 | + it "renders a JSON response with errors for the new <%= singular_table_name %>" do |
80 | 80 | post <%= index_helper %>_url, |
81 | | - params: { <%= ns_file_name %>: invalid_attributes }, headers: valid_headers, as: :json |
| 81 | + params: { <%= singular_table_name %>: invalid_attributes }, headers: valid_headers, as: :json |
82 | 82 | expect(response).to have_http_status(:unprocessable_entity) |
83 | 83 | expect(response.content_type).to match(a_string_including("application/json")) |
84 | 84 | end |
|
91 | 91 | skip("Add a hash of attributes valid for your model") |
92 | 92 | } |
93 | 93 |
|
94 | | - it "updates the requested <%= ns_file_name %>" do |
| 94 | + it "updates the requested <%= singular_table_name %>" do |
95 | 95 | <%= file_name %> = <%= class_name %>.create! valid_attributes |
96 | 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") |
100 | 100 | end |
101 | 101 |
|
102 | | - it "renders a JSON response with the <%= ns_file_name %>" do |
| 102 | + it "renders a JSON response with the <%= singular_table_name %>" do |
103 | 103 | <%= file_name %> = <%= class_name %>.create! valid_attributes |
104 | 104 | patch <%= show_helper %>, |
105 | 105 | params: { <%= singular_table_name %>: new_attributes }, headers: valid_headers, as: :json |
|
109 | 109 | end |
110 | 110 |
|
111 | 111 | context "with invalid parameters" do |
112 | | - it "renders a JSON response with errors for the <%= ns_file_name %>" do |
| 112 | + it "renders a JSON response with errors for the <%= singular_table_name %>" do |
113 | 113 | <%= file_name %> = <%= class_name %>.create! valid_attributes |
114 | 114 | patch <%= show_helper %>, |
115 | 115 | params: { <%= singular_table_name %>: invalid_attributes }, headers: valid_headers, as: :json |
|
120 | 120 | end |
121 | 121 |
|
122 | 122 | describe "DELETE /destroy" do |
123 | | - it "destroys the requested <%= ns_file_name %>" do |
| 123 | + it "destroys the requested <%= singular_table_name %>" do |
124 | 124 | <%= file_name %> = <%= class_name %>.create! valid_attributes |
125 | 125 | expect { |
126 | 126 | delete <%= show_helper %>, headers: valid_headers, as: :json |
|
0 commit comments