Skip to content

Commit

Permalink
test: fix database cleaner hook
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeygaychuk committed Dec 29, 2011
1 parent 84d66fa commit 5a6803d
Show file tree
Hide file tree
Showing 14 changed files with 2 additions and 97 deletions.
7 changes: 0 additions & 7 deletions spec/models/asset_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
require 'spec_helper'

describe Asset do
before(:all) do
DatabaseCleaner.start
end

after(:all) do
DatabaseCleaner.clean
end
it "should have next behaviour" do
Factory(:asset)
should validate_presence_of :tag
Expand Down
7 changes: 0 additions & 7 deletions spec/models/balance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
require 'spec_helper'

describe Balance do
before(:all) do
DatabaseCleaner.start
end

after(:all) do
DatabaseCleaner.clean
end
it "should have next behaviour" do
Factory(:balance, :side => Balance::ACTIVE)
should validate_presence_of :amount
Expand Down
7 changes: 0 additions & 7 deletions spec/models/bug133_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
require 'spec_helper'

describe "Bug133" do
before(:all) do
DatabaseCleaner.start
end

after(:all) do
DatabaseCleaner.clean
end
it "should fix bug #133" do
x = Factory(:money)
y = Factory(:asset)
Expand Down
7 changes: 0 additions & 7 deletions spec/models/chart_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
require 'spec_helper'

describe Chart do
before(:all) do
DatabaseCleaner.start
end

after(:all) do
DatabaseCleaner.clean
end
it "should have next behaviour" do
Factory(:chart)
should belong_to :currency
Expand Down
7 changes: 0 additions & 7 deletions spec/models/deal_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
require 'spec_helper'

describe Deal do
before(:all) do
DatabaseCleaner.start
end

after(:all) do
DatabaseCleaner.clean
end
it "should have next behaviour" do
Factory(:deal)
should validate_presence_of :tag
Expand Down
7 changes: 0 additions & 7 deletions spec/models/entity_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
require 'spec_helper'

describe Entity do
before(:all) do
DatabaseCleaner.start
end

after(:all) do
DatabaseCleaner.clean
end
it "should have next behaviour" do
Factory(:entity)
should validate_presence_of :tag
Expand Down
7 changes: 0 additions & 7 deletions spec/models/fact_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
require 'spec_helper'

describe Fact do
before(:all) do
DatabaseCleaner.start
end

after(:all) do
DatabaseCleaner.clean
end
it "should have next behaviour" do
should validate_presence_of :day
should validate_presence_of :amount
Expand Down
7 changes: 0 additions & 7 deletions spec/models/income_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
require 'spec_helper'

describe Income do
before(:all) do
DatabaseCleaner.start
end

after(:all) do
DatabaseCleaner.clean
end
it "should have next behaviour" do
Factory(:income)
should validate_presence_of :start
Expand Down
7 changes: 0 additions & 7 deletions spec/models/money_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
require 'spec_helper'

describe Money do
before(:all) do
DatabaseCleaner.start
end

after(:all) do
DatabaseCleaner.clean
end
it "should have next behaviour" do
Factory(:money)
should validate_presence_of :num_code
Expand Down
6 changes: 0 additions & 6 deletions spec/models/quote_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

describe Quote do
before(:all) do
DatabaseCleaner.start

@cf = Factory(:money)
@c1 = Factory(:money)
@c2 = Factory(:money)
Expand All @@ -25,10 +23,6 @@
@sy2 = Factory(:deal, :give => @y, :take => @c2, :rate => 150.0)
end

after(:all) do
DatabaseCleaner.clean
end

it "should create quote" do
q = Factory(:quote, :money => @c1, :rate => 1.5, :day => DateTime.civil(2008, 3, 24, 12, 0, 0))
@c1.quote.should eq(q)
Expand Down
7 changes: 0 additions & 7 deletions spec/models/rule_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
require 'spec_helper'

describe Rule do
before(:all) do
DatabaseCleaner.start
end

after(:all) do
DatabaseCleaner.clean
end
let(:rub) { Factory(:chart).currency }

it "should have next behaviour" do
Expand Down
7 changes: 0 additions & 7 deletions spec/models/state_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
require 'spec_helper'

describe State do
before(:all) do
DatabaseCleaner.start
end

after(:all) do
DatabaseCleaner.clean
end
it "should have next behaviour" do
Factory(:state)
should validate_presence_of :amount
Expand Down
5 changes: 0 additions & 5 deletions spec/models/txn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class TestData

describe Txn do
before(:all) do
DatabaseCleaner.start
@rub = Factory(:chart).currency
@eur = Factory(:money)
@aasii = Factory(:asset)
Expand All @@ -43,10 +42,6 @@ class TestData
@office = Factory(:deal, :rate => (1 / 2000.0), :give => @bank.give, :take => Factory(:asset))
end

after(:all) do
DatabaseCleaner.clean
end

it "should create states" do
fact = Factory(:fact, :day => DateTime.civil(2011, 11, 22, 12, 0, 0), :from => @share2,
:to => @bank, :resource => @rub, :amount => 100000.0)
Expand Down
11 changes: 2 additions & 9 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,11 @@

config.before(:all) do
PaperTrail.enabled = false
DatabaseCleaner.start
end
config.after(:all) do
DatabaseCleaner.clean
PaperTrail.enabled = true
end
#config.before(:each) do
# pp "Hello suite"
# DatabaseCleaner.start
#end
#
#config.after(:each) do
# pp "Bye suite"
# DatabaseCleaner.clean
#end
end
end

0 comments on commit 5a6803d

Please sign in to comment.