Skip to content

Commit

Permalink
Updates tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rosschapman committed Oct 31, 2023
1 parent 178ef2d commit 5f1b942
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
8 changes: 8 additions & 0 deletions spec/factories/furniture/marketplace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions spec/furniture/marketplace/buying_products_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down

0 comments on commit 5f1b942

Please sign in to comment.