|
64 | 64 | context "with valid params" do
|
65 | 65 | it "creates a new <%= class_name %>" do
|
66 | 66 | expect {
|
67 |
| - post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session |
| 67 | + post :create, params: {<%= singular_table_name %>: valid_attributes}, session: valid_session |
68 | 68 | }.to change(<%= class_name %>, :count).by(1)
|
69 | 69 | end
|
70 | 70 |
|
71 |
| - it "renders a JSON response with the new <%= ns_file_name %>" do |
72 |
| - post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session |
| 71 | + it "renders a JSON response with the new <%= singular_table_name %>" do |
| 72 | + post :create, params: {<%= singular_table_name %>: valid_attributes}, session: valid_session |
73 | 73 | expect(response).to have_http_status(:created)
|
74 | 74 | expect(response.content_type).to eq('application/json')
|
75 |
| - expect(response.location).to eq(<%= ns_file_name %>_url(<%= class_name %>.last)) |
| 75 | + expect(response.location).to eq(<%= singular_table_name %>_url(<%= class_name %>.last)) |
76 | 76 | end
|
77 | 77 | end
|
78 | 78 |
|
79 | 79 | context "with invalid params" do
|
80 |
| - it "renders a JSON response with errors for the new <%= ns_file_name %>" do |
81 |
| - post :create, params: {<%= ns_file_name %>: invalid_attributes}, session: valid_session |
| 80 | + it "renders a JSON response with errors for the new <%= singular_table_name %>" do |
| 81 | + post :create, params: {<%= singular_table_name %>: invalid_attributes}, session: valid_session |
82 | 82 | expect(response).to have_http_status(:unprocessable_entity)
|
83 | 83 | expect(response.content_type).to eq('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 |
| - put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, session: valid_session |
| 96 | + put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: new_attributes}, session: valid_session |
97 | 97 | <%= file_name %>.reload
|
98 | 98 | skip("Add assertions for updated state")
|
99 | 99 | end
|
100 | 100 |
|
101 |
| - it "renders a JSON response with the <%= ns_file_name %>" do |
| 101 | + it "renders a JSON response with the <%= singular_table_name %>" do |
102 | 102 | <%= file_name %> = <%= class_name %>.create! valid_attributes
|
103 |
| - put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, session: valid_session |
| 103 | + put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: valid_attributes}, session: valid_session |
104 | 104 | expect(response).to have_http_status(:ok)
|
105 | 105 | expect(response.content_type).to eq('application/json')
|
106 | 106 | end
|
107 | 107 | end
|
108 | 108 |
|
109 | 109 | context "with invalid params" do
|
110 |
| - it "renders a JSON response with errors for the <%= ns_file_name %>" do |
| 110 | + it "renders a JSON response with errors for the <%= singular_table_name %>" do |
111 | 111 | <%= file_name %> = <%= class_name %>.create! valid_attributes
|
112 |
| - put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, session: valid_session |
| 112 | + put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: invalid_attributes}, session: valid_session |
113 | 113 | expect(response).to have_http_status(:unprocessable_entity)
|
114 | 114 | expect(response.content_type).to eq('application/json')
|
115 | 115 | end
|
116 | 116 | end
|
117 | 117 | end
|
118 | 118 |
|
119 | 119 | describe "DELETE #destroy" do
|
120 |
| - it "destroys the requested <%= ns_file_name %>" do |
| 120 | + it "destroys the requested <%= singular_table_name %>" do |
121 | 121 | <%= file_name %> = <%= class_name %>.create! valid_attributes
|
122 | 122 | expect {
|
123 | 123 | delete :destroy, params: {id: <%= file_name %>.to_param}, session: valid_session
|
|
0 commit comments