Module: Fixation
- Defined in:
- lib/fixation.rb,
lib/fixation/version.rb
Defined Under Namespace
Classes: FixtureTable, Fixtures
Constant Summary
collapse
- VERSION =
"1.1.1"
Class Method Summary
collapse
Class Method Details
.apply_fixtures ⇒ Object
267
268
269
270
|
# File 'lib/fixation.rb', line 267
def self.apply_fixtures
build_fixtures unless @fixtures
@fixtures.apply_fixtures
end
|
.build_fixtures ⇒ Object
263
264
265
|
# File 'lib/fixation.rb', line 263
def self.build_fixtures
@fixtures = Fixtures.new
end
|
.fixture_methods ⇒ Object
272
273
274
275
|
# File 'lib/fixation.rb', line 272
def self.fixture_methods
build_fixtures unless @fixtures
@fixtures.fixture_methods
end
|
.identify(label, column_type = :integer) ⇒ Object
282
283
284
|
# File 'lib/fixation.rb', line 282
def self.identify(label, _column_type = :integer)
ActiveRecord::FixtureSet.identify(label)
end
|
.preload_for_spring ⇒ Object
295
296
297
298
299
|
# File 'lib/fixation.rb', line 295
def self.preload_for_spring
build_fixtures
unload_models!
watch_paths
end
|
.running_under_spring? ⇒ Boolean
291
292
293
|
# File 'lib/fixation.rb', line 291
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.
309
310
311
312
313
314
315
316
317
|
# File 'lib/fixation.rb', line 309
def self.unload_models!
if defined? ActiveSupport::Reloader
Rails.application.reloader.reload!
else
ActionDispatch::Reloader.cleanup!
ActionDispatch::Reloader.prepare!
end
end
|
.watch_paths ⇒ Object
301
302
303
304
305
|
# File 'lib/fixation.rb', line 301
def self.watch_paths
paths.each do |path|
Spring.watch(path)
end
end
|