sequel-fixture 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sequel-fixture/version.rb +1 -1
- data/lib/sequel-fixture.rb +5 -0
- data/spec/sequel/fixture_spec.rb +12 -0
- metadata +1 -1
data/lib/sequel-fixture.rb
CHANGED
@@ -54,6 +54,11 @@ module Sequel
|
|
54
54
|
return super
|
55
55
|
end
|
56
56
|
|
57
|
+
# Forces the check to pass. Dangerous!
|
58
|
+
def force_checked!
|
59
|
+
@checked = true
|
60
|
+
end
|
61
|
+
|
57
62
|
# Assures that the tables are empty before proceeding
|
58
63
|
def check
|
59
64
|
return @checked if @checked # If already checked, it's alright
|
data/spec/sequel/fixture_spec.rb
CHANGED
@@ -86,6 +86,18 @@ describe Sequel::Fixture do
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
describe "#force_checked!" do
|
90
|
+
it "check should return true and should not call [] in the passed database" do
|
91
|
+
database = stub 'database'
|
92
|
+
database.should_not_receive :[]
|
93
|
+
|
94
|
+
Sequel::Fixture.any_instance.stub :load
|
95
|
+
fix = Sequel::Fixture.new :anything, database, false
|
96
|
+
fix.force_checked!.should === true
|
97
|
+
fix.check.should === true
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
89
101
|
describe "#[]" do
|
90
102
|
context "a valid fixture has been loaded" do
|
91
103
|
before do
|