Module: TrueTest::DSL

Included in:
Test::Unit::TestCase
Defined in:
lib/true_test/dsl.rb

Instance Method Summary collapse

Instance Method Details

#current_contextObject



7
8
9
# File 'lib/true_test/dsl.rb', line 7

def current_context
  TrueTest::Context.current
end

#register_fixture(key, &block) ⇒ Object



3
4
5
# File 'lib/true_test/dsl.rb', line 3

def register_fixture(key, &block)
  TrueTest::Fixture.register key, &block
end

#setup(description = nil, &block) ⇒ Object



16
17
18
19
# File 'lib/true_test/dsl.rb', line 16

def setup(description = nil, &block)
  current_context.setup = description
  yield
end

#should(description = nil, &block) ⇒ Object



21
22
23
# File 'lib/true_test/dsl.rb', line 21

def should(description = nil, &block)
  TrueTest::PositiveAssertion.new(description, &block).evaluate self
end

#should_not(description = nil, &block) ⇒ Object



24
25
26
# File 'lib/true_test/dsl.rb', line 24

def should_not(description = nil, &block)
  TrueTest::NegativeAssertion.new(description, &block).evaluate self
end

#with(*fixtures, &block) ⇒ Object



10
11
12
13
14
# File 'lib/true_test/dsl.rb', line 10

def with(*fixtures, &block)
  current_context.setup_fixtures self, fixtures
  current_context.evaluate self, &block
  current_context.teardown self
end