Skip to content

Commit

Permalink
Upgrade factory_girl_rails to 4.8.0
Browse files Browse the repository at this point in the history
This required changing some build_stubbed to create to fix

    stubbed models are not allowed to access the database
  • Loading branch information
jhawthorn committed May 8, 2017
1 parent b62eddf commit b8b16f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion common_spree_dependencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
gem 'capybara-screenshot'
gem 'database_cleaner', '~> 1.3'
gem 'email_spec'
gem 'factory_girl_rails', '~> 4.5.0'
gem 'factory_girl_rails', '~> 4.8'
gem 'launchy'
gem 'rspec-activemodel-mocks', '~>1.0.2'
gem 'rspec-collection_matchers'
Expand Down
8 changes: 5 additions & 3 deletions core/spec/models/spree/order_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require 'spec_helper'

describe Spree::Order, type: :model do
let(:store) { build_stubbed(:store) }
let(:user) { stub_model(Spree::LegacyUser, email: "spree@example.com") }
let(:order) { stub_model(Spree::Order, user: user, store: store) }
let(:store) { create(:store) }
let(:user) { create(:user, email: "spree@example.com") }
let(:order) { create(:order, user: user, store: store) }

before do
allow(Spree::LegacyUser).to receive_messages(current: mock_model(Spree::LegacyUser, id: 123))
Expand Down Expand Up @@ -680,6 +680,8 @@ def merge!(other_order, user = nil)
end

context "#generate_order_number" do
let(:order) { build(:order) }

context "when no configure" do
let(:default_length) { Spree::Order::ORDER_NUMBER_LENGTH + Spree::Order::ORDER_NUMBER_PREFIX.length }
subject(:order_number) { order.generate_order_number }
Expand Down
6 changes: 3 additions & 3 deletions core/spec/models/spree/tax/item_adjuster_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def tax_adjustments
end

context 'when the order has a taxable address' do
let(:item) { build_stubbed :line_item, order: order }
let(:item) { create :line_item, order: order }
let(:address) { order.tax_address }

before do
Expand All @@ -65,8 +65,8 @@ def tax_adjustments

context 'when there are matching rates for the zone' do
context 'and all rates have the same tax category as the item' do
let(:item) { build_stubbed :line_item, order: order, tax_category: item_tax_category }
let(:item_tax_category) { build_stubbed(:tax_category) }
let(:item) { create :line_item, order: order, tax_category: item_tax_category }
let(:item_tax_category) { create(:tax_category) }
let(:rate_1) { create :tax_rate, tax_category: item_tax_category }
let(:rate_2) { create :tax_rate }
let(:rates_for_order_zone) { [rate_1, rate_2] }
Expand Down

0 comments on commit b8b16f0

Please sign in to comment.