0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 08:51:31 +08:00
discourse/plugins/discourse-patreon/spec/integration/patreon_spec.rb
Jarek Radosz e372355fd0
DEV: Clean up scope resolution operators in plugins (#34979)
Co-authored-by: Loïc Guitaut <loic@discourse.org>
2025-09-30 14:36:34 +02:00

33 lines
962 B
Ruby
Vendored

# frozen_string_literal: true
RSpec.describe Patreon do
let(:user1) { Fabricate(:user) }
let(:user2) { Fabricate(:user) }
let(:group) { Fabricate(:group) }
let(:filters) { { group.id.to_s => [] } }
before do
described_class.set("filters", filters)
group.add(user1)
end
context "with donation prompt enabled" do
before { SiteSetting.patreon_donation_prompt_enabled = true }
it "should not show donation prompt to patrons" do
expect(described_class.show_donation_prompt_to_user?(user1)).to eq(false)
end
it "should show donation prompt to non-patrons" do
expect(described_class.show_donation_prompt_to_user?(user2)).to eq(true)
end
end
context "with donation prompt disabled" do
before { SiteSetting.patreon_donation_prompt_enabled = false }
it "should show donation prompt to non-patrons" do
expect(described_class.show_donation_prompt_to_user?(user2)).to eq(false)
end
end
end