Created
February 8, 2013 02:06
-
-
Save wlangstroth/4736053 to your computer and use it in GitHub Desktop.
Mixed Testing: MiniTest Unit and Spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test/minitest_helper.rb | |
require "turn/autorun" | |
require "minitest/spec" | |
require "minitest/autorun" | |
Turn.config do |c| | |
c.format = :pretty | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rake/testtask' | |
Rake::TestTask.new do |t| | |
t.libs << "lib" | |
t.libs << "test" | |
t.pattern = "test/*_test.rb" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rule | |
def self.setters(*method_names) | |
method_names.each do |name| | |
send :define_method, name do |data| | |
instance_variable_set "@#{name}".to_sym, data. | |
end | |
end | |
end | |
setters :trigger | |
def initialize &block | |
@trigger = "blank trigger special_sauce" | |
instance_eval &block | |
"in a #{@trigger}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "minitest_helper" | |
class RuleTest < MiniTest::Unit::TestCase | |
def setup | |
end | |
def teardown | |
end | |
def test_stuff | |
assert_equal true, true | |
end | |
end | |
describe Array do | |
it "can be created with no arguments" do | |
Array.new.must_be_instance_of Array | |
end | |
it "can be created with a specific size" do | |
Array.new(10).size.must_equal 10 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment