mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Re-organise spec
Best viewed with whitespac ignored.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user