Permalink
Browse files

Reorganised code and test files

  • Loading branch information...
1 parent 6e47225 commit 9a7a69f3a6cc41f3050e0fa8ee981ad7635eb917 quaternion committed Feb 27, 2012
View
10 lib/transfer.rb
@@ -6,11 +6,11 @@ module Transfer
autoload :Config, 'transfer/config'
autoload :Transferer, 'transfer/transferer'
- module Generator
- autoload :Sequel, 'transfer/generator/sequel'
- autoload :ActiveRecord, 'transfer/generator/active_record'
- autoload :Mongoid, 'transfer/generator/mongoid'
- autoload :Base, 'transfer/generator/base'
+ module Generators
+ autoload :Sequel, 'transfer/generators/sequel'
+ autoload :ActiveRecord, 'transfer/generators/active_record'
+ autoload :Mongoid, 'transfer/generators/mongoid'
+ autoload :Base, 'transfer/generators/base'
end
def configure name = :default, &block
View
2 lib/transfer/generator/active_record.rb → lib/transfer/generators/active_record.rb
@@ -1,4 +1,4 @@
-class Transfer::Generator::ActiveRecord < Transfer::Generator::Base
+class Transfer::Generators::ActiveRecord < Transfer::Generators::Base
def self.supports? klass
defined?(ActiveRecord) && klass.ancestors.include?(ActiveRecord::Base)
View
2 lib/transfer/generator/base.rb → lib/transfer/generators/base.rb
@@ -1,4 +1,4 @@
-class Transfer::Generator::Base
+class Transfer::Generators::Base
attr_accessor :klass
def self.supports? klass
View
2 lib/transfer/generator/mongoid.rb → lib/transfer/generators/mongoid.rb
@@ -1,4 +1,4 @@
-class Transfer::Generator::Mongoid < Transfer::Generator::Base
+class Transfer::Generators::Mongoid < Transfer::Generators::Base
def self.supports? klass
defined?(Mongoid) && klass.ancestors.include?(Mongoid::Document)
View
2 lib/transfer/generator/sequel.rb → lib/transfer/generators/sequel.rb
@@ -1,4 +1,4 @@
-class Transfer::Generator::Sequel < Transfer::Generator::Base
+class Transfer::Generators::Sequel < Transfer::Generators::Base
def self.supports? klass
defined?(Sequel) && klass.ancestors.include?(Sequel::Model)
View
8 lib/transfer/transferer.rb
@@ -66,10 +66,10 @@ def generator
private
GENERATORS = [
- Transfer::Generator::Sequel,
- Transfer::Generator::ActiveRecord,
- Transfer::Generator::Mongoid,
- Transfer::Generator::Base
+ Transfer::Generators::Sequel,
+ Transfer::Generators::ActiveRecord,
+ Transfer::Generators::Mongoid,
+ Transfer::Generators::Base
]
View
6 spec/spec_helper.rb
@@ -2,12 +2,10 @@
require 'rr'
require 'fabrication'
require 'transfer'
-require 'support/source'
-require 'support/sequel'
-require 'support/active_record'
-require 'support/mongoid'
require 'database_cleaner'
+Dir["./spec/support/**/*.rb"].each {|f| require f}
+
module TransfererHelper
def save_failure entity
if entity.kind_of?(Class)
View
1 spec/generator/shared.rb → ...support/shared_examples_for_generators.rb
@@ -1,5 +1,4 @@
require 'spec_helper'
-require 'transferer_shared'
shared_examples "a generator" do
View
0 spec/transferer_shared.rb → spec/support/shared_examples_for_transfer.rb
File renamed without changes.
View
19 spec/support_spec.rb
@@ -1,19 +0,0 @@
-require 'spec_helper'
-
-describe "support" do
-
- context SequelUserWithFalseValidation do
- it "#save" do
- subject.save(:raise_on_failure => false).should be_false
- end
- end
-
- context ActiveRecordUserWithFalseValidation do
- its(:save) { should be_false }
- end
-
- context MongoidUserWithFalseValidation do
- its(:save) { should be_false }
- end
-
-end
View
0 spec/config_spec.rb → spec/transfer/config_spec.rb
File renamed without changes.
View
3 spec/generator/active_record_spec.rb → ...transfer/generators/active_record_spec.rb
@@ -1,9 +1,8 @@
require 'spec_helper'
-require 'generator/shared'
module Transfer
- module Generator
+ module Generators
describe ActiveRecord do
it_should_behave_like "a generator" do
let!(:generator) { ActiveRecord }
View
3 spec/generator/mongoid_spec.rb → spec/transfer/generators/mongoid_spec.rb
@@ -1,9 +1,8 @@
require 'spec_helper'
-require 'generator/shared'
module Transfer
- module Generator
+ module Generators
describe Mongoid do
it_should_behave_like "a generator" do
let!(:generator) { Mongoid }
View
3 spec/generator/sequel_spec.rb → spec/transfer/generators/sequel_spec.rb
@@ -1,9 +1,8 @@
require 'spec_helper'
-require 'generator/shared'
module Transfer
- module Generator
+ module Generators
describe Sequel do
it_should_behave_like "a generator" do
let!(:generator) { Sequel }
View
14 spec/transferer_spec.rb → spec/transfer/transferer_spec.rb
@@ -1,5 +1,5 @@
require 'spec_helper'
-require 'transferer_shared'
+
module Transfer
describe Transferer do
@@ -47,17 +47,17 @@ def do_action klass, &block
describe "#generator" do
subject { Transferer.new(dataset, @klass).generator }
- it Generator::Sequel do
+ it Generators::Sequel do
@klass = SequelUser
- should be_instance_of Generator::Sequel
+ should be_instance_of Generators::Sequel
end
- it Generator::ActiveRecord do
+ it Generators::ActiveRecord do
@klass = ActiveRecordUser
- should be_instance_of Generator::ActiveRecord
+ should be_instance_of Generators::ActiveRecord
end
- it Generator::Mongoid do
+ it Generators::Mongoid do
@klass = MongoidUser
- should be_instance_of Generator::Mongoid
+ should be_instance_of Generators::Mongoid
end
end
View
2 spec/transfer_spec.rb
@@ -1,5 +1,5 @@
require 'spec_helper'
-require 'transferer_shared'
+
describe Transfer do
subject { Transfer }

0 comments on commit 9a7a69f

Please sign in to comment.