docbrown/spec/requests/onboardings_spec.rb
Michael Kohl 6dfabd578f
Rename SiteConfig to Settings::General (#13573)
* Rename SiteConfig

* More renaming

* Update spec

* Update mandatory settings mapping

* More renaming

* e2e test fixes

* You have a rename, and you have a rename

* Spec fix

* More changes

* Temporarily disable specs

* After-merge update

* Undo rename for migration

* undo rename of DUS

* Fix DUS

* Fix merge problem

* Remove redundant DUS

* Fix specs

* Remove unused code

* Change wrong class name

* More cleanup

* Re-add missing values to constant

* Fix constant

* Fix spec

* Remove obsolete fields

* Add accidentally removed field

* Update spec

* Move methods from Settings::General to ForemInstance

* Remove unneeded model

* Change mentions of 'site config'
2021-05-21 14:45:37 +02:00

37 lines
1.2 KiB
Ruby

require "rails_helper"
RSpec.describe "Onboardings", type: :request do
let(:user) { create(:user, saw_onboarding: false) }
describe "GET /onboarding" do
it "redirects user if unauthenticated" do
get onboarding_url
expect(response).to redirect_to("/enter")
end
it "return 200 when authenticated" do
sign_in user
get onboarding_url
expect(response).to have_http_status(:ok)
end
it "contains proper data attribute keys" do
sign_in user
get onboarding_url
expect(response.body).to include("data-community-description")
expect(response.body).to include("data-community-logo")
expect(response.body).to include("data-community-background")
expect(response.body).to include("data-community-name")
end
it "contains proper data attribute values if the onboarding config is present" do
allow(Settings::General).to receive(:onboarding_background_image).and_return("onboarding_background_image.png")
sign_in user
get onboarding_url
expect(response.body).to include(Settings::Community.community_description)
expect(response.body).to include(Settings::General.onboarding_background_image)
end
end
end