Sha256: 122bd9704e048e22598f7daff7b7c34d3339a6c1f886e296b4e95b91d6daceb6
Contents?: true
Size: 1003 Bytes
Versions: 1
Compression:
Stored size: 1003 Bytes
Contents
require "spec_helper" RSpec.describe "rendering afterpay express checkout button", type: :view do subject(:rendered) { render "solidus_afterpay/afterpay_checkout_button", payment_method: payment_method } let(:payment_method) { SolidusAfterpay::PaymentMethod.active.first } let(:order) { create(:order) } before do create(:afterpay_payment_method) assign(:order, order) end context "when order is available for order" do before do allow(payment_method).to receive(:available_for_order?).with(order).and_return(true) end it 'displays the afterpay express checkout button' do expect(rendered).to match("Checkout with Afterpay") end end context "when order is not available for order" do before do allow(payment_method).to receive(:available_for_order?).with(order).and_return(false) end it 'does not display the afterpay express checkout button' do expect(rendered).not_to match("Checkout with Afterpay") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus_afterpay-0.2.0 | spec/views/solidus_afterpay/express_checkout_button_spec.rb |