Adds ordering by billing address name

This commit is contained in:
filipefurtad0
2023-01-30 19:50:35 +00:00
parent 7f4e5d3f2e
commit 801ebe5819

View File

@@ -73,7 +73,8 @@ describe '
}
let!(:order5) {
create(:order_ready_to_ship, user: customer5, distributor: distributor5,
order_cycle: order_cycle5,)
order_cycle: order_cycle5,
bill_address_id: billing_address5.id)
}
context "logging as superadmin and visiting the orders page" do
@@ -315,6 +316,23 @@ describe '
expect(page).to have_content(/#{order2.number}.*#{order3.number}.*#{order4.number}.*#{order5.number}/m)
end
end
context "orders with different billing addresses" do
before do
billing_address2.update(lastname: "Mad Hatter")
billing_address3.update(lastname: "Duchess")
billing_address4.update(lastname: "Cheshire Cat")
billing_address5.update(lastname: "Alice")
login_as_admin_and_visit spree.admin_orders_path
end
it "orders by last name" do
find("a", text: 'NAME').click # sets ascending ordering
expect(page).to have_content(/#{order5.number}.*#{order4.number}.*#{order3.number}.*#{order2.number}/m)
find("a", text: 'NAME').click # sets descending ordering
expect(page).to have_content(/#{order2.number}.*#{order3.number}.*#{order4.number}.*#{order5.number}/m)
end
end
end
end