Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2025-02-09 06:27:01 +01:00
![Angus McLeod](/assets/img/avatar_default.png)
I've tweaked the subscription client gem so we can just use the gem's models and tables in this plugin's rspec, which makes duplicating and stubbing them unnecessary. See further https://github.com/paviliondev/discourse_subscription_client
21 Zeilen
608 B
Ruby
21 Zeilen
608 B
Ruby
# frozen_string_literal: true
|
|
|
|
describe CustomWizard::AdminApiController do
|
|
fab!(:admin_user) { Fabricate(:user, admin: true) }
|
|
let(:api_json) { get_wizard_fixture("api/api") }
|
|
|
|
before do
|
|
sign_in(admin_user)
|
|
end
|
|
|
|
it "does not save if user does not have relevant subscription" do
|
|
put "/admin/wizards/api/:name.json", params: api_json.to_h
|
|
expect(response.status).to eq(400)
|
|
end
|
|
|
|
it "saves when user does have relevant subscription" do
|
|
enable_subscription("business")
|
|
put "/admin/wizards/api/:name.json", params: api_json.to_h
|
|
expect(response.status).to eq(200)
|
|
end
|
|
end
|