Skip to content

Commit

Permalink
Separate the tests for newer Ruby, Rails and new features
Browse files Browse the repository at this point in the history
  • Loading branch information
geekq committed Jan 28, 2013
1 parent 161515d commit c855840
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ end

require 'rake'
Rake::TestTask.new do |t|
t.verbose = true
t.warning = true
t.test_files = FileList['test/*_test.rb'] + FileList['test/new_versions/*_test.rb']
end

Rake::TestTask.new do |t|
t.name = 'test_without_new_versions'
t.verbose = true
t.warning = true
t.pattern = 'test/*_test.rb'
Expand Down
11 changes: 0 additions & 11 deletions test/main_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,6 @@ def assert_state(title, expected_state, klass = Order)
assert !o.shipped?
end

unless RUBY_VERSION < '1.9'
test 'compare states' do
o = assert_state 'some order', 'accepted'
assert o.current_state < :shipped
assert o.current_state > :submitted
assert_raise ArgumentError do
o.current_state > :unknown
end
end
end

test 'correct exception for event, that is not allowed in current state' do
o = assert_state 'some order', 'accepted'
assert_raise Workflow::NoTransitionAllowed do
Expand Down
32 changes: 32 additions & 0 deletions test/new_versions/compare_states_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require File.join(File.dirname(File.dirname(__FILE__)), 'test_helper')

require 'workflow'

class ComparableStatesOrder
include Workflow
workflow do
state :submitted do
event :accept, :transitions_to => :accepted, :meta => {:doc_weight => 8} do |reviewer, args|
end
end
state :accepted do
event :ship, :transitions_to => :shipped
end
state :shipped
end
end

class CompareStatesTest < ActiveRecordTestCase

test 'compare states' do
o = ComparableStatesOrder.new
o.accept!
assert_equal :accepted, o.current_state.name
assert o.current_state < :shipped
assert o.current_state > :submitted
assert_raise ArgumentError do
o.current_state > :unknown
end
end

end

0 comments on commit c855840

Please sign in to comment.