Sha256: 5eec069af8626f68e612cd43fb24c30b48b7b3b108ea2b1cdc8acab3ac238273

Contents?: true

Size: 1.9 KB

Versions: 6

Compression:

Stored size: 1.9 KB

Contents

require 'spec_helper'

describe "Payment Methods", type: :feature do
  stub_authorization!

  before(:each) do
    visit spree.admin_payment_methods_path
  end

  context "admin visiting payment methods listing page" do
    it "should display existing payment methods" do
      create(:check_payment_method)
      visit current_path

      within("table#listing_payment_methods") do
        expect(all("th")[0].text).to eq("Name")
        expect(all("th")[1].text).to eq("Provider")
        expect(all("th")[2].text).to eq("Display")
        expect(all("th")[3].text).to eq("Active")
      end

      within('table#listing_payment_methods') do
        expect(page).to have_content("Spree::PaymentMethod::Check")
      end
    end
  end

  context "admin creating a new payment method" do
    it "should be able to create a new payment method" do
      click_link "admin_new_payment_methods_link"
      expect(page).to have_content("New Payment Method")
      fill_in "payment_method_name", with: "check90"
      fill_in "payment_method_description", with: "check90 desc"
      select "PaymentMethod::Check", from: "gtwy-type"
      click_button "Create"
      expect(page).to have_content("successfully created!")
    end
  end

  context "admin editing a payment method", js: true do
    before(:each) do
      create(:check_payment_method)
      visit current_path

      within("table#listing_payment_methods") do
        click_icon(:edit)
      end
    end

    it "should be able to edit an existing payment method" do
      fill_in "payment_method_name", with: "Payment 99"
      click_button "Update"
      expect(page).to have_content("successfully updated!")
      expect(find_field("payment_method_name").value).to eq("Payment 99")
    end

    it "should display validation errors" do
      fill_in "payment_method_name", with: ""
      click_button "Update"
      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.0.10 spec/features/admin/configuration/payment_methods_spec.rb
spree_backend-3.0.9 spec/features/admin/configuration/payment_methods_spec.rb
spree_backend-3.0.8 spec/features/admin/configuration/payment_methods_spec.rb
spree_backend-3.0.7 spec/features/admin/configuration/payment_methods_spec.rb
spree_backend-3.0.6.1 spec/features/admin/configuration/payment_methods_spec.rb
spree_backend-3.0.6 spec/features/admin/configuration/payment_methods_spec.rb