makes 'pending' filter the default in /admin/orgs
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
class Admin::OrganizationsController < Admin::BaseController
|
class Admin::OrganizationsController < Admin::BaseController
|
||||||
has_filters %w{all pending verified rejected}, only: :index
|
has_filters %w{pending all verified rejected}, only: :index
|
||||||
|
|
||||||
load_and_authorize_resource except: :search
|
load_and_authorize_resource except: :search
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,9 @@ feature 'Admin::Organizations' do
|
|||||||
organization = create(:organization, :verified)
|
organization = create(:organization, :verified)
|
||||||
|
|
||||||
visit admin_organizations_path
|
visit admin_organizations_path
|
||||||
expect(current_path).to eq(admin_organizations_path)
|
|
||||||
|
click_on "Verified"
|
||||||
|
|
||||||
within("#organization_#{organization.id}") do
|
within("#organization_#{organization.id}") do
|
||||||
expect(page).to have_content ('Verified')
|
expect(page).to have_content ('Verified')
|
||||||
expect(page).to_not have_link('Verify')
|
expect(page).to_not have_link('Verify')
|
||||||
@@ -96,7 +98,11 @@ feature 'Admin::Organizations' do
|
|||||||
click_on 'Reject'
|
click_on 'Reject'
|
||||||
end
|
end
|
||||||
expect(current_path).to eq(admin_organizations_path)
|
expect(current_path).to eq(admin_organizations_path)
|
||||||
|
expect(page).to_not have_content (organization.name)
|
||||||
|
|
||||||
|
click_on 'Rejected'
|
||||||
expect(page).to have_content ('Rejected')
|
expect(page).to have_content ('Rejected')
|
||||||
|
expect(page).to have_content (organization.name)
|
||||||
|
|
||||||
expect(organization.reload.rejected?).to eq(true)
|
expect(organization.reload.rejected?).to eq(true)
|
||||||
end
|
end
|
||||||
@@ -105,7 +111,8 @@ feature 'Admin::Organizations' do
|
|||||||
organization = create(:organization, :rejected)
|
organization = create(:organization, :rejected)
|
||||||
|
|
||||||
visit admin_organizations_path
|
visit admin_organizations_path
|
||||||
expect(current_path).to eq(admin_organizations_path)
|
click_on "Rejected"
|
||||||
|
|
||||||
within("#organization_#{organization.id}") do
|
within("#organization_#{organization.id}") do
|
||||||
expect(page).to have_link('Verify')
|
expect(page).to have_link('Verify')
|
||||||
expect(page).to_not have_link('Reject', exact: true)
|
expect(page).to_not have_link('Reject', exact: true)
|
||||||
@@ -113,15 +120,18 @@ feature 'Admin::Organizations' do
|
|||||||
click_on 'Verify'
|
click_on 'Verify'
|
||||||
end
|
end
|
||||||
expect(current_path).to eq(admin_organizations_path)
|
expect(current_path).to eq(admin_organizations_path)
|
||||||
expect(page).to have_content ('Verified')
|
expect(page).to_not have_content (organization.name)
|
||||||
|
click_on('Verified')
|
||||||
|
|
||||||
|
expect(page).to have_content (organization.name)
|
||||||
|
|
||||||
expect(organization.reload.verified?).to eq(true)
|
expect(organization.reload.verified?).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Current filter is properly highlighted" do
|
scenario "Current filter is properly highlighted" do
|
||||||
visit admin_organizations_path
|
visit admin_organizations_path
|
||||||
expect(page).to_not have_link('All')
|
expect(page).to_not have_link('Pending')
|
||||||
expect(page).to have_link('Pending')
|
expect(page).to have_link('All')
|
||||||
expect(page).to have_link('Verified')
|
expect(page).to have_link('Verified')
|
||||||
expect(page).to have_link('Rejected')
|
expect(page).to have_link('Rejected')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user