spec/features/admin/orders/adjustments_spec.rb in solidus_backend-1.2.3 vs spec/features/admin/orders/adjustments_spec.rb in solidus_backend-1.3.0.beta1

- old
+ new

@@ -1,8 +1,8 @@ require 'spec_helper' -describe "Adjustments", :type => :feature do +describe "Adjustments", type: :feature do stub_authorization! let!(:order) { create(:completed_order_with_totals, line_items_count: 5) } let!(:line_item) do line_item = order.line_items.first @@ -11,15 +11,15 @@ line_item end let!(:tax_adjustment) do create(:tax_adjustment, - :adjustable => line_item, - :finalized => true, - :order => order, - :label => "VAT 5%", - :amount => 10) + adjustable: line_item, + finalized: true, + order: order, + label: "VAT 5%", + amount: 10) end let!(:adjustment) { order.adjustments.create!(order: order, label: 'Rebate', amount: 10) } before(:each) do @@ -51,41 +51,40 @@ click_link "New Adjustment" end context "successfully" do it "should create a new adjustment" do - fill_in "adjustment_amount", :with => "10" - fill_in "adjustment_label", :with => "rebate" + fill_in "adjustment_amount", with: "10" + fill_in "adjustment_label", with: "rebate" click_button "Continue" order.reload.all_adjustments.each do |adjustment| expect(adjustment.order_id).to equal(order.id) end end end context "with validation errors" do it "should not create a new adjustment" do - fill_in "adjustment_amount", :with => "" - fill_in "adjustment_label", :with => "" + fill_in "adjustment_amount", with: "" + fill_in "adjustment_label", with: "" click_button "Continue" - expect(page).to have_content("Label can't be blank") + expect(page).to have_content("Description can't be blank") expect(page).to have_content("Amount is not a number") end end end context "admin editing an adjustment" do - before(:each) do within_row(2) { click_icon :edit } end context "successfully" do it "should update the adjustment" do - fill_in "adjustment_amount", :with => "99" - fill_in "adjustment_label", :with => "rebate 99" + fill_in "adjustment_amount", with: "99" + fill_in "adjustment_label", with: "rebate 99" click_button "Continue" expect(page).to have_content("successfully updated!") expect(page).to have_content("rebate 99") within(".adjustments") do expect(page).to have_content("$99.00") @@ -95,14 +94,14 @@ end end context "with validation errors" do it "should not update the adjustment" do - fill_in "adjustment_amount", :with => "" - fill_in "adjustment_label", :with => "" + fill_in "adjustment_amount", with: "" + fill_in "adjustment_label", with: "" click_button "Continue" - expect(page).to have_content("Label can't be blank") + expect(page).to have_content("Description can't be blank") expect(page).to have_content("Amount is not a number") end end end @@ -111,10 +110,10 @@ within_row(1) do expect(page).not_to have_css('.fa-trash') end end - it "should update the total", :js => true do + it "should update the total", js: true do accept_alert do within_row(2) do click_icon(:trash) end end