Sha256: 79c3abc92a0d52817fa08a2a39766b735973c47991c340dc5d25df8cfc5d325b
Contents?: true
Size: 1.74 KB
Versions: 2
Compression:
Stored size: 1.74 KB
Contents
require 'spec_helper' module Spree class GatewayWithPassword < PaymentMethod preference :password, :string, default: "password" end describe Admin::PaymentMethodsController, type: :controller do stub_authorization! let(:payment_method) { GatewayWithPassword.create!(name: "Bogus", preferred_password: "haxme") } # regression test for #2094 it "does not clear password on update" do expect(payment_method.preferred_password).to eq("haxme") spree_put :update, id: payment_method.id, payment_method: { type: payment_method.class.to_s, preferred_password: "" } expect(response).to redirect_to(spree.edit_admin_payment_method_path(payment_method)) payment_method.reload expect(payment_method.preferred_password).to eq("haxme") end context "tries to save invalid payment" do it "doesn't break, responds nicely" do expect { spree_post :create, payment_method: { name: "", type: "Spree::Gateway::Bogus" } }.not_to raise_error end end it "can create a payment method of a valid type" do expect { spree_post :create, payment_method: { name: "Test Method", type: "Spree::Gateway::Bogus" } }.to change(Spree::PaymentMethod, :count).by(1) expect(response).to be_redirect expect(response).to redirect_to spree.edit_admin_payment_method_path(assigns(:payment_method)) end it "can not create a payment method of an invalid type" do expect { spree_post :create, payment_method: { name: "Invalid Payment Method", type: "Spree::InvalidType" } }.to change(Spree::PaymentMethod, :count).by(0) expect(response).to be_redirect expect(response).to redirect_to spree.new_admin_payment_method_path end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree_backend-3.2.0.rc2 | spec/controllers/spree/admin/payment_methods_controller_spec.rb |
spree_backend-3.2.0.rc1 | spec/controllers/spree/admin/payment_methods_controller_spec.rb |