docbrown/spec/requests/admin/extensions_spec.rb
Ridhwana 74a16beacb
Introduce "extensions" (#16840)
* feat: add the feature flag route and controller

* feat: add a ff page

* feat: update to a post with a success banner

* feat: test the feature

* feat: update the styling

* feat: change feature flag to extension witha  few more improvements like adding a model not backed by a table

* feat: update the text

* refactor: if you enable a FF, it gets added under the hood as well

* feat: accessibility name for label

* use keyword args

* use locales

* Update app/views/admin/extensions/index.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/views/admin/extensions/index.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/views/admin/extensions/index.html.erb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update config/locales/controllers/admin/fr.yml

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/controllers/admin/extensions_controller.rb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* fix: rubucop

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-03-18 11:22:17 +02:00

28 lines
664 B
Ruby

require "rails_helper"
RSpec.describe "/admin/advanced/extensions", type: :request do
let(:admin) { create(:user, :super_admin) }
before do
sign_in admin
end
after do
FeatureFlag.remove(:listing_feature)
end
it "returns the listings extension", :aggregate_failures do
get admin_extensions_path
expect(response).to have_http_status(:ok)
expect(response.body).to include("Listings")
end
it "toggles the listings extension" do
expect do
post toggle_admin_extensions_path, params: {
"listing_feature" => "1"
}
end.to change { FeatureFlag.enabled?(:listing_feature) }.from(false).to(true)
end
end