Module: Adva::Testing
- Defined in:
- lib/adva/testing.rb,
lib/adva/testing/engine.rb
Defined Under Namespace
Modules: Engine
Class Method Summary collapse
- .each_engine(&block) ⇒ Object
- .load_assertions ⇒ Object
- .load_cucumber_support ⇒ Object
- .load_factories ⇒ Object
- .load_helpers ⇒ Object
- .setup(options = {}) ⇒ Object
- .setup_active_record ⇒ Object
- .setup_logging(options) ⇒ Object
Class Method Details
.each_engine(&block) ⇒ Object
30 31 32 |
# File 'lib/adva/testing.rb', line 30 def each_engine(&block) Adva.engines.each(&block) end |
.load_assertions ⇒ Object
34 35 36 |
# File 'lib/adva/testing.rb', line 34 def load_assertions Adva.engines.each { |e| e.load_assertions } end |
.load_cucumber_support ⇒ Object
42 43 44 |
# File 'lib/adva/testing.rb', line 42 def load_cucumber_support Adva.engines.each { |e| e.load_cucumber_support } end |
.load_factories ⇒ Object
38 39 40 |
# File 'lib/adva/testing.rb', line 38 def load_factories Adva.engines.each { |e| e.load_factories } end |
.load_helpers ⇒ Object
46 47 48 |
# File 'lib/adva/testing.rb', line 46 def load_helpers Adva.engines.each { |e| e.load_helpers } end |
.setup(options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/adva/testing.rb', line 8 def setup( = {}) = { :migrate => true }.merge() Adva.out = StringIO.new('') setup_logging() setup_active_record each_engine { |e| e.setup_load_paths } ActiveSupport::Slices.register each_engine { |e| e.new.require_patches } if [:migrate] each_engine { |e| e.migrate } end load_assertions load_factories end |
.setup_active_record ⇒ Object
58 59 60 61 62 |
# File 'lib/adva/testing.rb', line 58 def setup_active_record ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:') ActiveRecord::Migration.verbose = false DatabaseCleaner.strategy = :truncation end |
.setup_logging(options) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/adva/testing.rb', line 50 def setup_logging() if log = [:log] FileUtils.touch(log) unless File.exists?(log) Rails.logger = Logger.new(log) ActiveRecord::LogSubscriber.attach_to(:active_record) end end |