|
1 |
| -RSpec.describe "Admin::Organizations", type: :request do |
| 1 | +RSpec.describe "Admin::Organizations", type: :request, skip_seed: true do |
| 2 | + let(:organization) { create(:organization, skip_items: true) } |
2 | 3 | let(:default_params) do
|
3 |
| - { organization_name: @organization.id } |
| 4 | + { organization_name: organization.id } |
4 | 5 | end
|
5 | 6 |
|
6 | 7 | context "When logged in as a super admin" do
|
7 | 8 | before do
|
8 |
| - sign_in(@super_admin) |
| 9 | + sign_in(create(:super_admin, organization: organization)) |
9 | 10 | end
|
10 | 11 |
|
11 | 12 | describe "GET #new" do
|
|
15 | 16 | end
|
16 | 17 |
|
17 | 18 | context 'when given a valid account request token in the query parameters' do
|
18 |
| - let!(:account_request) { FactoryBot.create(:account_request) } |
| 19 | + let!(:account_request) { create(:account_request) } |
19 | 20 |
|
20 | 21 | it 'should render new with pre populate input fields from the account_request' do
|
21 |
| - ndbn_member = FactoryBot.create(:ndbn_member) |
| 22 | + ndbn_member = create(:ndbn_member) |
22 | 23 | account_request.ndbn_member = ndbn_member
|
23 | 24 | account_request.save
|
24 | 25 |
|
|
160 | 161 |
|
161 | 162 | describe "PUT #update" do
|
162 | 163 | it "redirect" do
|
163 |
| - put admin_organization_path({ id: @organization.id, organization: { name: "Foo" } }) |
| 164 | + put admin_organization_path({ id: organization.id, organization: { name: "Foo" } }) |
164 | 165 | expect(response).to be_redirect
|
165 | 166 | end
|
166 | 167 | end
|
167 | 168 |
|
168 | 169 | describe "DELETE #destroy" do
|
169 | 170 | it "redirects" do
|
170 |
| - delete admin_organization_path({ id: @organization.id }) |
| 171 | + delete admin_organization_path({ id: organization.id }) |
171 | 172 | expect(response).to redirect_to(admin_organizations_path)
|
172 | 173 | end
|
173 | 174 | end
|
174 | 175 | end
|
175 | 176 |
|
176 | 177 | context "When logged in as a non-admin user" do
|
177 | 178 | before do
|
178 |
| - sign_in(@user) |
| 179 | + sign_in(create(:user, organization: organization)) |
179 | 180 | end
|
180 | 181 |
|
181 | 182 | describe "GET #new" do
|
|
201 | 202 |
|
202 | 203 | describe "GET #edit" do
|
203 | 204 | it "redirects" do
|
204 |
| - get edit_admin_organization_path({ id: @organization.id }) |
| 205 | + get edit_admin_organization_path({ id: organization.id }) |
205 | 206 | expect(response).to be_redirect
|
206 | 207 | end
|
207 | 208 | end
|
208 | 209 |
|
209 | 210 | describe "PUT #update" do
|
210 | 211 | it "redirects" do
|
211 |
| - put admin_organization_path({ id: @organization.id, organization: { name: "Foo" } }) |
| 212 | + put admin_organization_path({ id: organization.id, organization: { name: "Foo" } }) |
212 | 213 | expect(response).to be_redirect
|
213 | 214 | end
|
214 | 215 | end
|
|
0 commit comments