forked from spree/spree
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved supported currencies from preferencies to store
- Loading branch information
Showing
22 changed files
with
69 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,8 @@ module Spree | |
name: 'Hack0rz', | ||
url: 'spree123.example.com', | ||
mail_from_address: '[email protected]', | ||
default_currency: 'USD' | ||
default_currency: 'USD', | ||
supported_currencies: 'USD' | ||
} | ||
api_post :create, store: store_hash | ||
expect(response.status).to eq(201) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ | |
page.fill_in 'store_mail_from_address', with: '[email protected]' | ||
page.fill_in 'store_code', with: 'SPR' | ||
page.fill_in 'store_default_currency', with: 'EUR' | ||
page.fill_in 'store_supported_currencies', with: 'EUR' | ||
click_button 'Create' | ||
|
||
expect(page).to have_current_path spree.admin_stores_path | ||
|
@@ -53,13 +54,16 @@ | |
click_link 'Edit' | ||
page.fill_in 'store_name', with: updated_name | ||
page.fill_in 'store_default_currency', with: new_currency | ||
page.fill_in 'store_supported_currencies', with: new_currency | ||
click_button 'Update' | ||
|
||
expect(page).to have_current_path spree.admin_stores_path | ||
store_table = page.find('table') | ||
expect(store_table).to have_content(updated_name) | ||
expect(store_table).to have_content(new_currency) | ||
expect(store.reload.name).to eq updated_name | ||
store.reload | ||
expect(store.name).to eq updated_name | ||
expect(store.supported_currencies).to eq new_currency | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
core/db/migrate/20191017121054_add_supported_currencies_to_store.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class AddSupportedCurrenciesToStore < ActiveRecord::Migration[6.0] | ||
def change | ||
add_column :spree_stores, :supported_currencies, :string | ||
Spree::Store.all.each do |store| | ||
store.update_attribute(:supported_currencies, store.default_currency) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
FactoryBot.define do | ||
factory :store, class: Spree::Store do | ||
sequence(:code) { |i| "spree_#{i}" } | ||
name { 'Spree Test Store' } | ||
url { 'www.example.com' } | ||
mail_from_address { '[email protected]' } | ||
default_currency { 'USD' } | ||
name { 'Spree Test Store' } | ||
url { 'www.example.com' } | ||
mail_from_address { '[email protected]' } | ||
default_currency { 'USD' } | ||
supported_currencies { 'USD,EUR,GBP' } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,8 @@ | |
name: 'My Spree Store', | ||
url: 'spreestore.example.com', | ||
mail_from_address: '[email protected]', | ||
default_currency: 'USD' | ||
default_currency: 'USD', | ||
supported_currencies: 'USD' | ||
) | ||
|
||
visit spree.root_path | ||
|