Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,20 @@ | |||
## | |||
# test/spec/mini 3 | |||
# http://gist.github.com/25455 | |||
# chris@ozmm.org | |||
# file:lib/test/spec/mini.rb | |||
# | |||
def context(*args, &block) | |||
return super unless (name = args.first) && block | |||
require 'test/unit' | |||
klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do | |||
def self.test(name, &block) | |||
define_method("test_#{name.gsub(/\W/,'_')}", &block) if block | |||
end | |||
def self.xtest(*args) end | |||
def self.setup(&block) define_method(:setup, &block) end | |||
def self.teardown(&block) define_method(:teardown, &block) end | |||
end | |||
(class << klass; self end).send(:define_method, :name) { name.gsub(/\W/,'_') } | |||
klass.class_eval &block | |||
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,13 @@ | |||
require 'rubygems' | |||
require 'test/unit' | |||
require 'spec/mini' | |||
|
|||
require 'tissues' | |||
|
|||
begin | |||
require 'redgreen' | |||
rescue LoadError | |||
end | |||
|
|||
class Test::Unit::TestCase | |||
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,25 @@ | |||
require File.dirname(__FILE__) + '/test_helper' | |||
|
|||
context "String" do | |||
test "to_state" do | |||
assert_equal :open, 'open'.to_state | |||
assert_equal :closed, 'closed'.to_state | |||
end | |||
|
|||
test "to_status" do | |||
assert_equal :open, 'open'.to_status | |||
assert_equal :completed, 'closed'.to_status | |||
end | |||
end | |||
|
|||
context "Things::Todo" do | |||
test "number parsed if present" do | |||
todo = Things::Todo.new(:name => '[#2] todo') | |||
assert_equal ['2'], todo.number | |||
end | |||
|
|||
test "number ignored if not present" do | |||
todo = Things::Todo.new(:name => 'todo') | |||
assert_equal nil, todo.number | |||
end | |||
end |