Skip to content

Commit

Permalink
active_factory:install generator
Browse files Browse the repository at this point in the history
  • Loading branch information
tarasevich committed Apr 13, 2011
1 parent 5481fec commit 38320b4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
Empty file.
15 changes: 15 additions & 0 deletions lib/generators/active_factory/install/install_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module ActiveFactory
module Generators #:nodoc:
class InstallGenerator < Rails::Generators::Base #:nodoc:
source_root File.expand_path('../templates', __FILE__)

def define_factories_file
copy_file "define_factories.rb", "spec/define_factories.rb"
end

def active_factory_file
copy_file "active_factory.rb", "spec/support/active_factory.rb"
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'active_factory'

RSpec::configure do |config|
config.include ActiveFactory::API, :type => :controller
config.include ActiveFactory::API, :type => :model
config.include ActiveFactory::API, :type => :request
end

require File.expand_path "../define_factories", __FILE__
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class ActiveFactory::Define
# define your factories here, e.g.
#
# factory :post, :class => Post do
# title { "example title #{index}" }
# end
end

0 comments on commit 38320b4

Please sign in to comment.