Skip to content

Commit

Permalink
Updates markup and adds tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rosschapman committed Oct 24, 2023
1 parent 1632384 commit 8f703d1
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
<%= render CardComponent.new(classes: "flex flex-col h-full
") do %>
<header class="flex font-bold">
<%= marketplace_stripe_utility&.name %>
</header>
<footer class="flex flex-row justify-between mt-3">
<%= render ButtonComponent.new(
<%- if marketplace.stripe_api_key? %>
<header class="flex font-bold">
<%= marketplace_stripe_utility.name %>
</header>
<footer class="flex flex-row justify-between mt-3">
<%= render ButtonComponent.new(
label: "View #{t('marketplace.stripe_accounts.show.link_to')}",
title: t('marketplace.stripe_accounts.show.link_to'),
href: marketplace.location(:index, child: :stripe_account),
method: :get,
scheme: :secondary) %>
</footer>
</footer>
<%- else %>
<header class="flex"
>To start accepting payments, add your Stripe Account.</header>
<footer class="flex flex-row justify-between mt-3
">
<%= render ButtonComponent.new(
label: "Add #{t('marketplace.stripe_accounts.show.link_to')}",
title: "Add #{t('marketplace.stripe_accounts.show.link_to')}",
href: marketplace.location(:index, child: :stripe_account),
method: :get,
scheme: :secondary)
%>
</footer>
<%- end %>
<%- end %>
29 changes: 20 additions & 9 deletions spec/components/marketplace/stripe_overview_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,24 @@
require "rails_helper"

RSpec.describe Marketplace::StripeOverviewComponent, type: :component do
pending "add some examples to (or delete) #{__FILE__}"

# it "renders something useful" do
# expect(
# render_inline(described_class.new(attr: "value")) { "Hello, components!" }.css("p").to_html
# ).to include(
# "Hello, components!"
# )
# end
# pending "add some examples to (or delete) #{__FILE__}"
subject(:output) { render_inline(component) }

let(:component) { described_class.new(marketplace: marketplace) }

context "when the Marketplace has a Stripe Utility" do
let(:marketplace) { create(:marketplace, :with_stripe_utility) }

it { is_expected.to have_content marketplace.stripe_utility.name }

it { is_expected.to have_link "View #{I18n.t("marketplace.stripe_accounts.show.link_to")}" }
end

context "when the Marketplace is missing a Stripe Utility" do
let(:marketplace) { create(:marketplace) }

it { is_expected.to have_link "Add #{I18n.t("marketplace.stripe_accounts.show.link_to")}" }

it { is_expected.to have_content "To start accepting payments, add your Stripe Account." }
end
end
6 changes: 3 additions & 3 deletions spec/furniture/marketplace/collecting_payments_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
end

click_on("Payment Settings")
click_on("View Stripe Account")
click_on("Stripe Account")
click_on("Add a Stripe API key to #{space.name}")
click_on("Add Utility")
select("stripe", from: "Type")
Expand All @@ -35,7 +35,7 @@

visit polymorphic_path(marketplace.location(:edit))
click_on("Payment Settings")
click_on("View Stripe Account")
click_on("Stripe Account")
expect(page).to have_content("Connect to Stripe")
end

Expand All @@ -47,7 +47,7 @@
click_on("Manage Marketplace")
end
click_on("Payment Settings")
click_on("View Stripe Account")
click_on("Stripe Account")
expect(page).to have_content("Connect to Stripe")
# @todo actually figure out how to do the connect to stripe bit :X
end
Expand Down

0 comments on commit 8f703d1

Please sign in to comment.