Skip to content

Instantly share code, notes, and snippets.

@wojtekmach
Created September 5, 2011 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wojtekmach/1195977 to your computer and use it in GitHub Desktop.
Save wojtekmach/1195977 to your computer and use it in GitHub Desktop.
minitest/spec hooks?
gem "minitest"
require "minitest/spec"
require "minitest/autorun"
class ControllerSpec < MiniTest::Spec
def self.inherited klass
p "id: #{klass.object_id}"
p "name: #{klass.name}"
super
end
end
MiniTest::Spec.register_spec_type /Controller/, ControllerSpec
class JobsController
end
describe JobsController do
p "id: #{object_id}"
p "name: #{name}"
end
# Output:
#
# ~% ruby test.rb
# "id: 70341984673280"
# "name: "
# "id: 70341984673280"
# "name: JobsController"
# Run options: --seed 6014
#
# # Running tests:
#
#
#
# Finished tests in 0.000490s, 0.0000 tests/s, 0.0000 assertions/s.
#
# 0 tests, 0 assertions, 0 failures, 0 errors, 0 skips
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment