-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not display non-eligible adjustments in the admin cart overview #3585
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
let(:tax_category) { create(:tax_category) } | ||
let(:variant) { create(:variant, tax_category: tax_category) } | ||
|
||
let!(:non_eligible_adjustment) { order.adjustments.create!(order: order, label: 'Non-Eligible', amount: 10, eligible: false) } | ||
let!(:adjustment) { order.adjustments.create!(order: order, label: 'Rebate', amount: 10) } | ||
|
||
before(:each) do | ||
|
@@ -40,8 +41,11 @@ | |
end | ||
end | ||
|
||
it "only shows eligible adjustments" do | ||
expect(page).not_to have_content("ineligible") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This page shows both eligible and non-eligible adjustments, and that's correct, because it highlights if they are not eligiblew by adding the class |
||
it "shows both eligible and non-eligible adjustments" do | ||
expect(page).to have_content("Rebate") | ||
expect(page).to have_content("Non-Eligible") | ||
expect(find('tr', text: 'Rebate')[:class]).not_to eq('adjustment-ineligible') | ||
expect(find('tr', text: 'Non-Eligible')[:class]).to eq('adjustment-ineligible') | ||
end | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,6 +225,21 @@ | |
end | ||
end | ||
|
||
context "with adjustments" do | ||
let(:order) do | ||
super().tap do |o| | ||
o.adjustments.create!(order: order, label: 'Non-Eligible', amount: 10, eligible: false) | ||
o.adjustments.create!(order: order, label: 'Rebate', amount: 10) | ||
end | ||
end | ||
|
||
it "shows only eligible adjustments" do | ||
visit spree.cart_admin_order_path(order) | ||
expect(page).to have_content("Rebate") | ||
expect(page).not_to have_content("Non-Eligible") | ||
end | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the regression test. |
||
|
||
context "variant doesn't track inventory" do | ||
let(:track_inventory) { false } | ||
let(:backorderable) { false } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected to return a value at the end of function array-callback-return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coorasse I think @houndci-bot is right here, we should return something anyway.