diff --git a/spec/factories/furniture/marketplace.rb b/spec/factories/furniture/marketplace.rb index 78a1ebf18..c6e5f3b0c 100644 --- a/spec/factories/furniture/marketplace.rb +++ b/spec/factories/furniture/marketplace.rb @@ -65,6 +65,14 @@ with_delivery_areas with_notification_methods end + + trait :with_square do + square_location_id { ENV.fetch("MARKETPLACE_VENDOR_SQUARE_LOCATION", "123456789") } + square_environment { "sandbox" } + secrets { + square_access_token { "MARKETPLACE_VENDOR_SQUARE_ACCESS_TOKEN" } + } + end end factory :marketplace_bazaar, class: "Marketplace::Bazaar" do diff --git a/spec/furniture/marketplace/buying_products_system_spec.rb b/spec/furniture/marketplace/buying_products_system_spec.rb index 0f55f9e96..dd058df8c 100644 --- a/spec/furniture/marketplace/buying_products_system_spec.rb +++ b/spec/furniture/marketplace/buying_products_system_spec.rb @@ -6,6 +6,7 @@ include MoneyRails::ActionViewExtension include ActiveJob::TestHelper include Spec::StripeCLI::Helpers + include Spec::Square::Helpers let(:space) { create(:space, :with_entrance, :with_members) } let(:marketplace) { create(:marketplace, :ready_for_shopping, room: space.entrance) } @@ -58,6 +59,18 @@ def url_options expect(order_placed_notifications).to be_present expect(order_placed_notifications.length).to eq 1 + + it "Works when Square is active and Guests" do + let(:marketplace) { + create( + :marketplace, + :with_stripe_utility, + :ready_for_shopping, + :with_square + ) + } + # TODO + end end def add_product_to_cart(product) diff --git a/spec/furniture/marketplace/stripe_events_controller_request_spec.rb b/spec/furniture/marketplace/stripe_events_controller_request_spec.rb index 88a7508d4..5d9c16f30 100644 --- a/spec/furniture/marketplace/stripe_events_controller_request_spec.rb +++ b/spec/furniture/marketplace/stripe_events_controller_request_spec.rb @@ -93,7 +93,7 @@ end context "when Square notifications are enabled" do - let(:marketplace) { create(:marketplace, :with_stripe_utility, stripe_account: "sa_1234", stripe_webhook_endpoint_secret: "whsec_1234", square_location_id: "123456789", square_environment: "sandbox", secrets: {square_access_token: "fake_square_access_token"}) } + let(:marketplace) { create_marketplace_with_square } let(:person) { create(:person) } let(:shopper) { create(:marketplace_shopper, person: person) } let(:order) { create(:marketplace_order, :with_products, status: :pre_checkout, marketplace: marketplace, shopper: shopper) }