Skip to content

Commit 16dbc8c

Browse files
committed
Add missing feature tests
1 parent 2c80785 commit 16dbc8c

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

admin/spec/features/payment_methods_spec.rb

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,74 @@
5252
let(:displayed_attribute) { :name }
5353
let(:path) { solidus_admin.payment_methods_path }
5454
end
55+
56+
context "creating payment method" do
57+
before { create(:store, name: "Store") }
58+
context "with valid attributes" do
59+
it "creates payment method" do
60+
visit "/admin/payment_methods"
61+
click_on "Add new"
62+
63+
expect(page).to have_current_path("/admin/payment_methods/new")
64+
expect(page).to be_axe_clean
65+
66+
fill_in "Name", with: "Checking"
67+
fill_in "Description", with: "Payment Method Description"
68+
switch "Auto Capture"
69+
solidus_select "Check Payments", from: "Type"
70+
fill_in "Server", with: "test"
71+
switch "Test Mode"
72+
check "Active"
73+
solidus_select("Store", from: "Stores")
74+
check "Available to Admin"
75+
check "Available to Users"
76+
77+
click_on "Save"
78+
79+
expect(page).to have_content("Payment method was successfully created.")
80+
expect(page).to have_content("Checking")
81+
expect(page).to have_content("Check Payments")
82+
end
83+
end
84+
85+
context "with invalid attributes" do
86+
it "shows validation errors" do
87+
visit "/admin/payment_methods"
88+
click_on "Add new"
89+
click_on "Save"
90+
expect(page).to have_content("can't be blank")
91+
end
92+
end
93+
end
94+
95+
context "updating payment method" do
96+
before { create(:payment_method, name: "Check payments") }
97+
98+
context "with valid attributes" do
99+
it "updates payment method" do
100+
visit "/admin/payment_methods"
101+
click_on "Check payments"
102+
103+
fill_in "Name", with: "Checking payments"
104+
solidus_select "Check Payments", from: "Type"
105+
click_on "Save"
106+
107+
expect(page).to have_content("Payment method was successfully updated.")
108+
expect(page).to have_content("Checking payments")
109+
expect(page).to have_content("Check Payments")
110+
end
111+
end
112+
113+
context "with invalid attributes" do
114+
it "shows validation errors" do
115+
visit "/admin/payment_methods"
116+
click_on "Check payments"
117+
118+
fill_in "Name", with: ""
119+
click_on "Save"
120+
121+
expect(page).to have_content("can't be blank")
122+
end
123+
end
124+
end
55125
end

0 commit comments

Comments
 (0)