Skip to content

Commit

Permalink
13007: add specs
Browse files Browse the repository at this point in the history
  • Loading branch information
chahmedejaz committed Dec 2, 2024
1 parent 9482579 commit d60180a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3449,6 +3449,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
ready: Ready
pending: Pending
shipped: Shipped
business_name: Business Name
js:
saving: 'Saving...'
changes_saved: 'Changes saved.'
Expand Down
23 changes: 23 additions & 0 deletions spec/mailers/producer_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,29 @@
bill_address: FactoryBot.create(:address, last_name: "smith"))
expect(mail.body.encoded).to match(/.*Abby.*Doe.*smith/m)
end

context "validate business name" do
let(:table_header) do
body_as_html(mail).find("table.order-summary.customer-order thead")
end

context "when no customer has customer code" do
it 'should not displays business name column' do
expect(table_header).not_to have_selector("th", text: 'Business Name')
end
end

context "when customer have code" do
before { order.customer.update(code: 'Test Business Name') }

it 'displays business name for the customer' do
expect(table_header).to have_selector("th", text: 'Business Name')
expect(
body_as_html(mail).find("table.order-summary.customer-order tbody tr")
).to have_selector("td", text: 'Test Business Name')
end
end
end
end

context 'when flag show_customer_names_to_suppliers is false' do
Expand Down

0 comments on commit d60180a

Please sign in to comment.