Module: ActiveFixtures
- Defined in:
- lib/active-fixtures.rb,
lib/active-fixtures/time.rb,
lib/active-fixtures/state.rb,
lib/active-fixtures/context.rb,
lib/active-fixtures/railtie.rb,
lib/active-fixtures/session.rb,
lib/active-fixtures/version.rb,
lib/active-fixtures/resource.rb,
lib/active-fixtures/state_dumper.rb,
lib/active-fixtures/state_builder.rb
Defined Under Namespace
Modules: Context, StateDumper
Classes: PrepareStateError, Railtie, Resource, Session, State, StateBuilder, Time
Constant Summary
collapse
- VERSION =
'0.0.5'.freeze
Class Method Summary
collapse
Class Method Details
.cleanup! ⇒ Object
35
36
37
|
# File 'lib/active-fixtures.rb', line 35
def cleanup!
StateDumper.cleanup!
end
|
.current_state ⇒ Object
50
51
52
|
# File 'lib/active-fixtures.rb', line 50
def current_state
thread_storage[:current_state]
end
|
.current_state=(state) ⇒ Object
54
55
56
|
# File 'lib/active-fixtures.rb', line 54
def current_state=(state)
thread_storage[:current_state] = state
end
|
.init! ⇒ Object
27
28
29
|
# File 'lib/active-fixtures.rb', line 27
def init!
StateDumper.init!
end
|
.load_clean! ⇒ Object
31
32
33
|
# File 'lib/active-fixtures.rb', line 31
def load_clean!
StateDumper.load_clean!
end
|
.populate(name, &block) ⇒ Object
23
24
25
|
# File 'lib/active-fixtures.rb', line 23
def populate(name, &block)
state_builders[name] = StateBuilder.new(block)
end
|
.prepare!(name) ⇒ Object
39
40
41
42
43
44
|
# File 'lib/active-fixtures.rb', line 39
def prepare!(name)
raise PrepareStateError.new("Undefined active fixture: #{name.inspect}") unless state_builders.key?(name)
self.current_state = State.new(name)
current_state.prepare!(state_builders[name])
end
|
.thread_storage ⇒ Object
46
47
48
|
# File 'lib/active-fixtures.rb', line 46
def thread_storage
Thread.current[:__active_fixtures] ||= {}
end
|