Skip to content

Commit

Permalink
Fix tests due to nesting within wrong context
Browse files Browse the repository at this point in the history
  • Loading branch information
waiting-for-dev committed Jun 1, 2022
1 parent 5b65a39 commit a8a7b55
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions backend/spec/features/admin/orders/adjustments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,43 +108,43 @@
expect(page).to have_content("Amount is not a number")
end
end
end

context "admin bulk editing adjustments" do
it "allows finalizing all the adjustments" do
order.all_adjustments.each(&:unfinalize!)
context "admin bulk editing adjustments" do
it "allows finalizing all the adjustments" do
order.all_adjustments.each(&:unfinalize!)

click_button "Finalize All Adjustments"
click_button "Finalize All Adjustments"

expect(order.reload.adjustments.all?(&:finalized?)).to be(true)
end
expect(order.reload.adjustments.all?(&:finalized?)).to be(true)
end

it "allows unfinalizing all the adjustments" do
order.all_adjustments.each(&:finalize!)
it "allows unfinalizing all the adjustments" do
order.all_adjustments.each(&:finalize!)

click_button "Unfinalize All Adjustments"
click_button "Unfinalize All Adjustments"

expect(order.reload.adjustments.any?(&:finalized?)).to be(false)
end
expect(order.reload.adjustments.any?(&:finalized?)).to be(false)
end

it "can't finalize via a GET request" do
order.all_adjustments.each(&:unfinalize!)
it "can't finalize via a GET request" do
order.all_adjustments.each(&:unfinalize!)

expect {
visit "/admin/orders/#{order.number}/adjustments/finalize"
}.to raise_error(ActionController::RoutingError)
expect {
visit "/admin/orders/#{order.number}/adjustments/finalize"
}.to raise_error(ActionController::RoutingError)

expect(order.reload.adjustments.any?(&:finalized?)).to be(false)
end
expect(order.reload.adjustments.any?(&:finalized?)).to be(false)
end

it "can't unfinalize via a GET request" do
order.all_adjustments.each(&:finalize!)
it "can't unfinalize via a GET request" do
order.all_adjustments.each(&:finalize!)

expect {
visit "/admin/orders/#{order.number}/adjustments/unfinalize"
}.to raise_error(ActionController::RoutingError)
expect {
visit "/admin/orders/#{order.number}/adjustments/unfinalize"
}.to raise_error(ActionController::RoutingError)

expect(order.reload.adjustments.all?(&:finalized?)).to be(true)
end
expect(order.reload.adjustments.all?(&:finalized?)).to be(true)
end
end

Expand Down

0 comments on commit a8a7b55

Please sign in to comment.