Module: Fixation
- Defined in:
- lib/fixation.rb,
lib/fixation/version.rb
Defined Under Namespace
Classes: FixtureTable, Fixtures
Constant Summary
collapse
- VERSION =
"1.3.0"
Class Method Summary
collapse
Class Method Details
.apply_fixtures ⇒ Object
268
269
270
271
|
# File 'lib/fixation.rb', line 268
def self.apply_fixtures
build_fixtures unless @fixtures
@fixtures.apply_fixtures
end
|
.build_fixtures ⇒ Object
264
265
266
|
# File 'lib/fixation.rb', line 264
def self.build_fixtures
@fixtures = Fixtures.new
end
|
.fixture_methods ⇒ Object
273
274
275
276
|
# File 'lib/fixation.rb', line 273
def self.fixture_methods
build_fixtures unless @fixtures
@fixtures.fixture_methods
end
|
.identify(label, column_type = :integer) ⇒ Object
283
284
285
|
# File 'lib/fixation.rb', line 283
def self.identify(label, _column_type = :integer)
ActiveRecord::FixtureSet.identify(label)
end
|
.preload_for_spring ⇒ Object
296
297
298
299
300
|
# File 'lib/fixation.rb', line 296
def self.preload_for_spring
build_fixtures
unload_models!
watch_paths
end
|
.running_under_spring? ⇒ Boolean
292
293
294
|
# File 'lib/fixation.rb', line 292
def self.running_under_spring?
defined?(Spring::Application)
end
|
.unload_models! ⇒ Object
reloads Rails (using the code from Spring) in order to unload the model classes that get auto-loaded when we read the fixture definitions.
310
311
312
313
314
315
316
317
318
|
# File 'lib/fixation.rb', line 310
def self.unload_models!
if defined? ActiveSupport::Reloader
Rails.application.reloader.reload!
else
ActionDispatch::Reloader.cleanup!
ActionDispatch::Reloader.prepare!
end
end
|
.watch_paths ⇒ Object
302
303
304
305
306
|
# File 'lib/fixation.rb', line 302
def self.watch_paths
paths.each do |path|
Spring.watch(path)
end
end
|