Class: TestBench::Fixture::Evaluate

Inherits:
Object
  • Object
show all
Includes:
TestBench::Fixture
Defined in:
lib/test_bench/fixture/evaluate.rb

Instance Attribute Summary collapse

Attributes included from TestBench::Fixture

#test_session

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TestBench::Fixture

#assert, #assert_raises, #comment, comment, #context, #context!, #detail, #fail!, #fixture, #fixture_passed?, output, #refute, #refute_raises, #test, #test!

Constructor Details

#initialize(block) ⇒ Evaluate

Returns a new instance of Evaluate.



8
9
10
# File 'lib/test_bench/fixture/evaluate.rb', line 8

def initialize(block)
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



6
7
8
# File 'lib/test_bench/fixture/evaluate.rb', line 6

def block
  @block
end

Class Method Details

.build(session:, &block) ⇒ Object



12
13
14
15
16
# File 'lib/test_bench/fixture/evaluate.rb', line 12

def self.build(session:, &block)
  instance = new(block)
  Session.configure(instance, session:, attr_name: :test_session)
  instance
end

.call(session: nil, &block) ⇒ Object



18
19
20
21
22
# File 'lib/test_bench/fixture/evaluate.rb', line 18

def self.call(session: nil, &block)
  instance = build(session:, &block)
  instance.()
  instance
end

Instance Method Details

#callObject



24
25
26
# File 'lib/test_bench/fixture/evaluate.rb', line 24

def call
  instance_exec(&block)
end