require 'rails_helper'

RSpec.describe 'Donations page', type: :feature do
  let(:user) { create :user }

  before do
    login_as user, :scope => :user
  end

  describe "Donation methods" do
    scenario "Only BTCPay enabled" do
      Setting.btcpay_enabled = true
      Setting.lndhub_enabled = false
      Setting.opencollective_enabled = false
      visit contributions_donations_url

      within ".donation-methods" do
        expect(page).to have_content("Bitcoin")
        expect(page).not_to have_content("OpenCollective")
      end
    end

    scenario "Only OpenCollective enabled" do
      Setting.btcpay_enabled = false
      Setting.lndhub_enabled = false
      Setting.opencollective_enabled = true
      visit contributions_donations_url

      within ".donation-methods" do
        expect(page).not_to have_content("Bitcoin")
        expect(page).to have_content("OpenCollective")
      end
    end
  end
end
