Module: WithModel
- Defined in:
- lib/with_model.rb,
lib/with_model/model.rb,
lib/with_model/table.rb,
lib/with_model/methods.rb,
lib/with_model/version.rb,
lib/with_model/model/dsl.rb,
lib/with_model/constant_stubber.rb,
lib/with_model/descendants_tracker.rb
Defined Under Namespace
Modules: DescendantsTracker, Methods
Classes: MiniTestLifeCycle, Model, Table
Constant Summary
collapse
- VERSION =
"2.2.0"
Class Attribute Summary collapse
Instance Method Summary
collapse
Class Attribute Details
.runner ⇒ Object
31
32
33
|
# File 'lib/with_model.rb', line 31
def self.runner
@runner ||= :rspec
end
|
Instance Method Details
#with_model(name, scope: nil, **options, &block) ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'lib/with_model.rb', line 39
def with_model(name, scope: nil, **options, &block)
runner = options.delete(:runner)
model = Model.new name, **options
dsl = Model::DSL.new model
dsl.instance_exec(&block) if block
setup_object(model, scope: scope, runner: runner)
end
|
#with_table(name, scope: nil, **options, &block) ⇒ Object
52
53
54
55
56
57
|
# File 'lib/with_model.rb', line 52
def with_table(name, scope: nil, **options, &block)
runner = options.delete(:runner)
table = Table.new name, options, &block
setup_object(table, scope: scope, runner: runner)
end
|