Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add store select to payment method admin #2550

Merged
merged 1 commit into from
Feb 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions backend/app/views/spree/admin/payment_methods/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
<%= f.label :description %>
<%= f.text_area :description, {cols: 60, rows: 6, class: 'fullwidth'} %>
</div>
<div data-hook="stores" class="field">
<%= f.label :store_ids, plural_resource_name(Spree::Store) %>
<%= f.collection_select :store_ids, Spree::Store.all, :id, :name, {}, multiple: true, class: "select2 fullwidth" %>
</div>
</div>
</div>
</div>
Expand Down
14 changes: 14 additions & 0 deletions backend/spec/features/admin/configuration/payment_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@
expect(page).to have_field("payment_method_name", with: "Payment 99")
end

context "with multiple stores available" do
before do
create(:store, name: "Default Store", url: "spreestore.example.com")
visit current_path
end

it "should be able to change the associated stores" do
select "Default Store", from: "Stores"
click_button "Update"
expect(page).to have_content("successfully updated!")
expect(page).to have_select("payment_method_store_ids", selected: "Default Store")
end
end

it "should display validation errors" do
fill_in "payment_method_name", with: ""
click_button "Update"
Expand Down