Skip to content

Commit

Permalink
Merge pull request solidusio#225 from mdesantis/check-for-existing-br…
Browse files Browse the repository at this point in the history
…aintree-configuration-presence-on-store-creation

Skip building default config on config presence
  • Loading branch information
kennyadsl authored Jun 10, 2019
2 parents 1fe37d7 + f6d8cd6 commit e400a4e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/spree/store_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
private

def build_default_configuration
build_braintree_configuration
build_braintree_configuration unless braintree_configuration
end
end
14 changes: 14 additions & 0 deletions spec/models/spree/store_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'spec_helper'

describe Spree::Store do
describe 'before_create :build_default_configuration' do
context 'when a braintree_configuration record already exists' do
it 'does not overwrite it' do
store = build(:store)
custom_braintree_configuration = store.build_braintree_configuration
store.save!
expect(store.braintree_configuration).to be custom_braintree_configuration
end
end
end
end

0 comments on commit e400a4e

Please sign in to comment.