Re-organise spec

Best viewed with whitespac ignored.
This commit is contained in:
David Cook
2024-07-16 13:19:24 +10:00
parent 9d89b4726b
commit 5d0f55b8c3
2 changed files with 26 additions and 24 deletions

View File

@@ -28,36 +28,38 @@ RSpec.describe "Connected Apps", feature: :connected_apps, vcr: true do
expect(page).to have_content "CONNECTED APPS"
end
it "can be enabled and disabled" do
visit edit_admin_enterprise_path(enterprise)
describe "Discover Regenerative" do
it "can be enabled and disabled" do
visit edit_admin_enterprise_path(enterprise)
scroll_to :bottom
click_link "Connected apps"
expect(page).to have_content "Discover Regenerative"
scroll_to :bottom
click_link "Connected apps"
expect(page).to have_content "Discover Regenerative"
click_button "Allow data sharing"
expect(page).not_to have_button "Allow data sharing"
expect(page).to have_button "Loading", disabled: true
click_button "Allow data sharing"
expect(page).not_to have_button "Allow data sharing"
expect(page).to have_button "Loading", disabled: true
perform_enqueued_jobs(only: ConnectAppJob)
expect(page).not_to have_button "Loading", disabled: true
expect(page).to have_content "account is connected"
expect(page).to have_link "Manage listing"
perform_enqueued_jobs(only: ConnectAppJob)
expect(page).not_to have_button "Loading", disabled: true
expect(page).to have_content "account is connected"
expect(page).to have_link "Manage listing"
click_button "Stop sharing"
expect(page).to have_button "Allow data sharing"
expect(page).not_to have_button "Stop sharing"
expect(page).not_to have_content "account is connected"
expect(page).not_to have_link "Manage listing"
end
click_button "Stop sharing"
expect(page).to have_button "Allow data sharing"
expect(page).not_to have_button "Stop sharing"
expect(page).not_to have_content "account is connected"
expect(page).not_to have_link "Manage listing"
end
it "can't be enabled by non-manager" do
login_as create(:admin_user)
it "can't be enabled by non-manager" do
login_as create(:admin_user)
visit "#{edit_admin_enterprise_path(enterprise)}#/connected_apps_panel"
expect(page).to have_content "Discover Regenerative"
visit "#{edit_admin_enterprise_path(enterprise)}#/connected_apps_panel"
expect(page).to have_content "Discover Regenerative"
expect(page).to have_button("Allow data sharing", disabled: true)
expect(page).to have_content "Only managers can connect apps."
expect(page).to have_button("Allow data sharing", disabled: true)
expect(page).to have_content "Only managers can connect apps."
end
end
end