Module: Test::Spec::TestCase::InstanceMethods

Defined in:
lib/test/spec.rb

Instance Method Summary collapse

Instance Method Details

#after_allObject



353
354
355
# File 'lib/test/spec.rb', line 353

def after_all
  self.class.after_all.each { |t| instance_eval(&t) }
end

#before_allObject



349
350
351
# File 'lib/test/spec.rb', line 349

def before_all
  self.class.before_all.each { |t| instance_eval(&t) }
end

#context(*args) ⇒ Object Also known as: describe



369
370
371
# File 'lib/test/spec.rb', line 369

def context(*args)
  raise Test::Spec::DefinitionError, "context definition is not allowed inside a specify-block"
end

#initialize(name) ⇒ Object



357
358
359
360
361
362
363
# File 'lib/test/spec.rb', line 357

def initialize(name)
  super name

  # Don't let the default_test clutter up the results and don't
  # flunk if no tests given, either.
  throw :invalid_test  if name.to_s == "default_test"
end

#positionObject



365
366
367
# File 'lib/test/spec.rb', line 365

def position
  self.class.position
end

#setupObject

:nodoc:



338
339
340
341
342
# File 'lib/test/spec.rb', line 338

def setup                 # :nodoc:
  $TEST_SPEC_TESTCASE = self
  super
  self.class.setups.each { |s| instance_eval(&s) }
end

#teardownObject

:nodoc:



344
345
346
347
# File 'lib/test/spec.rb', line 344

def teardown              # :nodoc:
  super
  self.class.teardowns.each { |t| instance_eval(&t) }
end