Sha256: 74bcdf94f4af2377c20e7c0b57885a08c42512a1e3bfe655ac284e6571d8c3fc

Contents?: true

Size: 1.85 KB

Versions: 6

Compression:

Stored size: 1.85 KB

Contents

require 'spec_helper'

describe "new reimbursement type", type: :feature do
  stub_authorization!

  before do
    visit "/admin/reimbursement_types/new"
  end

  it "view should have select field" do
    expect(page).to have_css("div#reimbursement_type_type_field.form-group.field")
  end

  context "with valid attributes" do
    it "credit type" do
      fill_in "Name", with: "Credit"
      select "Spree::ReimbursementType::Credit", from: "reimbursement_type_type"

      expect { click_button "Create" }.to change(Spree::ReimbursementType, :count).by(1)

      expect(page).to have_content("Credit")
    end

    it "exchange type" do
      fill_in "Name", with: "Exchange"
      select "Spree::ReimbursementType::Exchange", from: "reimbursement_type_type"

      expect { click_button "Create" }.to change(Spree::ReimbursementType, :count).by(1)

      expect(page).to have_content("Exchange")
    end

    it "original payment type" do
      fill_in "Name", with: "OriginalPayment"
      select "Spree::ReimbursementType::OriginalPayment", from: "reimbursement_type_type"

      expect { click_button "Create" }.to change(Spree::ReimbursementType, :count).by(1)

      expect(page).to have_content("OriginalPayment")
    end

    it "store credit type" do
      fill_in "Name", with: "StoreCredit"
      select "Spree::ReimbursementType::StoreCredit", from: "reimbursement_type_type"

      expect { click_button "Create" }.to change(Spree::ReimbursementType, :count).by(1)

      expect(page).to have_content("StoreCredit")
    end
  end

  context "with invalid params" do
    it "without name" do
      fill_in "Name", with: ""
      select "Spree::ReimbursementType::StoreCredit", from: "reimbursement_type_type"

      expect { click_button "Create" }.not_to change(Spree::ReimbursementType, :count)

      expect(page).to have_content("Name can't be blank")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_backend-3.3.0.rc1 spec/features/admin/reimbursement_type/new_reimbursement_type_spec.rb
spree_backend-3.2.1 spec/features/admin/reimbursement_type/new_reimbursement_type_spec.rb
spree_backend-3.2.0 spec/features/admin/reimbursement_type/new_reimbursement_type_spec.rb
spree_backend-3.2.0.rc3 spec/features/admin/reimbursement_type/new_reimbursement_type_spec.rb
spree_backend-3.2.0.rc2 spec/features/admin/reimbursement_type/new_reimbursement_type_spec.rb
spree_backend-3.2.0.rc1 spec/features/admin/reimbursement_type/new_reimbursement_type_spec.rb