Skip to content

Commit

Permalink
Remove persist_invalid from order
Browse files Browse the repository at this point in the history
This plugs up our "leaky database". You'll also notice no test removals.
Or any lines of code added at all, for that matter.

fixes #5834
  • Loading branch information
Clarke Brunsdon authored and Jeff Dutil committed Jan 5, 2015
1 parent 5c05b46 commit bc19fcb
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 20 deletions.
7 changes: 0 additions & 7 deletions core/app/models/spree/payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class Payment < Spree::Base
attr_accessor :source_attributes, :request_env

after_initialize :build_source
after_rollback :persist_invalid

validates :amount, numericality: true

Expand All @@ -55,12 +54,6 @@ def transaction_id
response_code
end

def persist_invalid
return unless ['failed', 'invalid'].include?(state)
state_will_change!
save
end

# order state machine (see http://github.com/pluginaweek/state_machine/tree/master for details)
state_machine initial: :checkout do
# With card payments, happens before purchase or authorization happens
Expand Down
3 changes: 0 additions & 3 deletions core/spec/lib/search/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

before do
include Spree::Core::ProductFilters
Spree::Product.delete_all # FIXME product leaks
Spree::Taxon.destroy_all

@taxon = create(:taxon, name: "Ruby on Rails")

@product1 = create(:product, name: "RoR Mug", price: 9.00)
Expand Down
1 change: 0 additions & 1 deletion core/spec/lib/spree/core/controller_helpers/order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class FakesController < ApplicationController

describe '#current_order' do
before {
Spree::Order.destroy_all # TODO data is leaking between specs as database_cleaner or rspec 3 was broken in Rails 4.1.6 & 4.0.10
allow(controller).to receive_messages(current_store: store)
allow(controller).to receive_messages(try_spree_current_user: user)
}
Expand Down
2 changes: 0 additions & 2 deletions core/spec/models/spree/order/tax_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ module Spree
let(:zone) { create :zone }

context "when no zones exist" do
before { Spree::Zone.destroy_all }

it "should return nil" do
expect(order.tax_zone).to be_nil
end
Expand Down
1 change: 0 additions & 1 deletion core/spec/models/spree/payment_method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
describe Spree::PaymentMethod, :type => :model do
describe "#available" do
before do
Spree::PaymentMethod.destroy_all # TODO data is leaking between specs as database_cleaner or rspec 3 was broken in Rails 4.1.6 & 4.0.10
[nil, 'both', 'front_end', 'back_end'].each do |display_on|
Spree::Gateway::Test.create(
:name => 'Display Both',
Expand Down
4 changes: 0 additions & 4 deletions core/spec/models/spree/state_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
require 'spec_helper'

describe Spree::State, :type => :model do
before(:all) do
Spree::State.destroy_all
end

it "can find a state by name or abbr" do
state = create(:state, :name => "California", :abbr => "CA")
expect(Spree::State.find_all_by_name_or_abbr("California")).to include(state)
Expand Down
2 changes: 0 additions & 2 deletions core/spec/models/spree/stock/quantifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ module Spree
module Stock
describe Quantifier, :type => :model do

before(:all) { Spree::StockLocation.destroy_all } #FIXME leaky database

let!(:stock_location) { create :stock_location_with_items }
let!(:stock_item) { stock_location.stock_items.order(:id).first }

Expand Down

0 comments on commit bc19fcb

Please sign in to comment.