class TestBench::Fixture::Session::Substitute::Session

Public Instance Methods

[](*contexts)
Alias for: scope
any_test?(*contexts, title, &block) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 59
def any_test?(*contexts, title, &block)
  test_scope = test_scope(*contexts, title)

  test_scope.finish_test_recorded?(&block)
end
Also aliased as: test?
any_test_failed?(*contexts, title) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 52
def any_test_failed?(*contexts, title)
  any_test?(*contexts, title) do |_, result|
    result == false
  end
end
Also aliased as: test_failed?
any_test_passed?(*contexts, title) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 45
def any_test_passed?(*contexts, title)
  any_test?(*contexts, title) do |_, result|
    result == true
  end
end
Also aliased as: test_passed?
asserted?(*contexts, result: nil, caller_location: nil) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 78
def asserted?(*contexts, result: nil, caller_location: nil)
  output.assert_recorded?(*contexts) do |r, cl|
    result_match = result.nil? || r == result
    caller_location_match = caller_location.nil? || cl == caller_location

    result_match && caller_location_match
  end
end
commented?(*contexts, text) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 66
def commented?(*contexts, text)
  output.comment_recorded?(*contexts) do |t|
    t == text
  end
end
context?(*outer_contexts, title) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 21
def context?(*outer_contexts, title)
  output.exit_context_recorded_once?(*outer_contexts) do |t|
    t == title
  end
end
detail?(*contexts, text) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 72
def detail?(*contexts, text)
  output.detail_recorded?(*contexts) do |t|
    t == text
  end
end
fixture?(fixture) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 104
def fixture?(fixture)
  output.finish_fixture_recorded? do |f|
    f == fixture
  end
end
load(path) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 87
def load(path)
  output.enter_file(path)

  inert_action = proc { }
  result = evaluate(inert_action)

  output.exit_file(path, result)

  result
end
loaded?(path=nil) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 98
def loaded?(path=nil)
  output.enter_file_recorded? do |p|
    path.nil? || p == path
  end
end
one_test?(*contexts, title, &block) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 39
def one_test?(*contexts, title, &block)
  test_scope = test_scope(*contexts, title)

  test_scope.finish_test_recorded_once?(&block)
end
one_test_failed?(*contexts, title) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 33
def one_test_failed?(*contexts, title)
  one_test?(*contexts, title) do |_, result|
    result == false
  end
end
one_test_passed?(*contexts, title) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 27
def one_test_passed?(*contexts, title)
  one_test?(*contexts, title) do |_, result|
    result == true
  end
end
scope(*contexts) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 10
def scope(*contexts)
  scoped_output = output.scope(*contexts)

  return nil if scoped_output.records.empty?

  scoped_session = self.class.new
  scoped_session.output = scoped_output
  scoped_session
end
Also aliased as: []
test?(*contexts, title, &block)
Alias for: any_test?
test_failed?(*contexts, title)
Alias for: any_test_failed?
test_passed?(*contexts, title)
Alias for: any_test_passed?
test_scope(*contexts, title) click to toggle source
# File lib/test_bench/fixture/session/substitute.rb, line 110
def test_scope(*contexts, title)
  context_scope = output.scope(*contexts)

  titled_test_scope = context_scope.scope do |signal, t|
    signal == :finish_test && t == title
  end

  untitled_test_scope = context_scope.scope(title) do |signal, t|
    signal == :finish_test && t.nil?
  end

  titled_test_scope + untitled_test_scope
end