Skip to content
Browse files

Remove the explicit mongoid and sequel generators

  • Loading branch information...
1 parent 42f0c96 commit 381d480d326958d78138ec0a8bade01537879365 Paul Elliott committed Feb 13, 2011
View
7 lib/fabrication/generator/mongoid.rb
@@ -1,7 +0,0 @@
-class Fabrication::Generator::Mongoid < Fabrication::Generator::Base
-
- def self.supports?(klass)
- defined?(Mongoid) && klass.ancestors.include?(Mongoid::Document)
- end
-
-end
View
7 lib/fabrication/generator/sequel.rb
@@ -1,7 +0,0 @@
-class Fabrication::Generator::Sequel < Fabrication::Generator::Base
-
- def self.supports?(klass)
- defined?(Sequel) && klass.ancestors.include?(Sequel::Model)
- end
-
-end
View
2 lib/fabrication/schematic.rb
@@ -2,8 +2,6 @@ class Fabrication::Schematic
GENERATORS = [
Fabrication::Generator::ActiveRecord,
- Fabrication::Generator::Mongoid,
- Fabrication::Generator::Sequel,
Fabrication::Generator::Base
]
View
17 spec/fabrication/generator/base_spec.rb
@@ -71,4 +71,21 @@
end
+ describe "#after_generation" do
+ let(:instance) { mock(:instance) }
+ let(:generator) { Fabrication::Generator::Base.new(Object) }
+
+ before { generator.send(:instance=, instance) }
+
+ it "saves with a true save flag" do
+ instance.should_receive(:save!)
+ generator.send(:after_generation, {:save => true})
+ end
+
+ it "does not save without a true save flag" do
+ instance.should_not_receive(:save)
+ generator.send(:after_generation, {})
+ end
+ end
+
end
View
32 spec/fabrication/generator/mongoid_spec.rb
@@ -1,32 +0,0 @@
-require 'spec_helper'
-
-describe Fabrication::Generator::Mongoid do
-
- describe ".supports?" do
- subject { Fabrication::Generator::Mongoid }
- it "returns true for mongoid objects" do
- subject.supports?(Author).should be_true
- end
- it "returns false for non-mongoid objects" do
- subject.supports?(Person).should be_false
- end
- end
-
- describe "#after_generation" do
- let(:instance) { mock(:instance) }
- let(:generator) { Fabrication::Generator::Mongoid.new(Object) }
-
- before { generator.send(:instance=, instance) }
-
- it "saves with a true save flag" do
- instance.should_receive(:save!)
- generator.send(:after_generation, {:save => true})
- end
-
- it "does not save without a true save flag" do
- instance.should_not_receive(:save)
- generator.send(:after_generation, {})
- end
- end
-
-end
View
32 spec/fabrication/generator/sequel_spec.rb
@@ -1,32 +0,0 @@
-require 'spec_helper'
-
-describe Fabrication::Generator::Sequel do
-
- describe ".supports?" do
- subject { Fabrication::Generator::Sequel }
- it "returns true for sequel objects" do
- subject.supports?(Artist).should be_true
- end
- it "returns false for non-sequel objects" do
- subject.supports?(Person).should be_false
- end
- end
-
- describe "#after_generation" do
- let(:instance) { mock(:instance) }
- let(:generator) { Fabrication::Generator::Sequel.new(Object) }
-
- before { generator.send(:instance=, instance) }
-
- it "saves with a true save flag" do
- instance.should_receive(:save!)
- generator.send(:after_generation, {:save => true})
- end
-
- it "does not save without a true save flag" do
- instance.should_not_receive(:save)
- generator.send(:after_generation, {})
- end
- end
-
-end
View
8 spec/fabrication/schematic_spec.rb
@@ -17,13 +17,13 @@
end
end
context "for a mongoid object" do
- it "uses the mongoid generator" do
- Fabrication::Schematic.new(Author).generator.should == Fabrication::Generator::Mongoid
+ it "uses the base generator" do
+ Fabrication::Schematic.new(Author).generator.should == Fabrication::Generator::Base
end
end
context "for a sequel object" do
- it "uses the sequel generator" do
- Fabrication::Schematic.new(Artist).generator.should == Fabrication::Generator::Sequel
+ it "uses the base generator" do
+ Fabrication::Schematic.new(Artist).generator.should == Fabrication::Generator::Base
end
end
end

0 comments on commit 381d480

Please sign in to comment.
Something went wrong with that request. Please try again.