Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ruby 2.2 2.3 and 2.4 to travis #197

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ before_script:

rvm:
- 2.3.1

gemfile:
- gemfiles/Gemfile.rails-edge

Expand All @@ -17,15 +18,27 @@ matrix:
- rvm: 2.0.0
gemfile: gemfiles/Gemfile.rails-3.x

- rvm: 2.0.0
gemfile: gemfiles/Gemfile.rails-4.0
- rvm: 2.1.0
gemfile: gemfiles/Gemfile.rails-3.x

- rvm: 2.2.0
gemfile: gemfiles/Gemfile.rails-3.x

- rvm: 2.3.1
gemfile: gemfiles/Gemfile.rails-4.0

- rvm: 2.4.0
gemfile: gemfiles/Gemfile.rails-4.0

- rvm: 2.3.1
gemfile: gemfiles/Gemfile.rails-5.0

allow_failures:
- gemfile: gemfiles/Gemfile.rails-5.0
- gemfile: gemfiles/Gemfile.rails-edge
# not compatible
#
# TypeError: Cannot visit Integer
- rvm: 2.4.0
gemfile: gemfiles/Gemfile.rails-3.x

1 change: 1 addition & 0 deletions gemfiles/Gemfile.rails-3.x
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ group :development do
gem "sqlite3"
gem "mocha"
gem "rake"
gem "test-unit"
gem "ruby-graphviz", "~> 1.0.0"
end
1 change: 0 additions & 1 deletion gemfiles/Gemfile.rails-4.0
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
source "http://rubygems.org"

group :development do
gem "minitest", "< 5.0.0" # 5.0.0 introduced incompatible changes renaming all the classes
gem "rdoc", ">= 3.12"
gem "bundler", ">= 1.0.0"
gem "activerecord", "~>4.0"
Expand Down
4 changes: 1 addition & 3 deletions test/active_record_scopes_test.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
require File.join(File.dirname(__FILE__), 'test_helper')
require 'test_helper'

$VERBOSE = false
require 'active_record'
require 'sqlite3'
require 'workflow'

ActiveRecord::Migration.verbose = false

Expand Down
4 changes: 2 additions & 2 deletions test/adapter_hook_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require File.join(File.dirname(__FILE__), 'test_helper')
require 'workflow'
require 'test_helper'

class AdapterHookTest < ActiveRecordTestCase
test 'hook to choose adapter' do

Expand Down
4 changes: 2 additions & 2 deletions test/advanced_examples_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require File.join(File.dirname(__FILE__), 'test_helper')
require 'workflow'
require 'test_helper'

class AdvanceExamplesTest < ActiveRecordTestCase

class Article
Expand Down
8 changes: 3 additions & 5 deletions test/advanced_hooks_and_validation_test.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
require File.join(File.dirname(__FILE__), 'test_helper')
require 'test_helper'

$VERBOSE = false
require 'active_record'
require 'sqlite3'
require 'workflow'

ActiveRecord::Migration.verbose = false

Expand Down Expand Up @@ -88,7 +86,7 @@ def assert_state(title, expected_state, klass = Order)

test 'deny transition from new to accepted because of the missing presence of the body' do
a = Article.find_by_title('new1');
assert_raise Workflow::TransitionHalted do
assert_raises Workflow::TransitionHalted do
a.accept!
end
assert_state 'new1', 'new', Article
Expand All @@ -109,7 +107,7 @@ def assert_state(title, expected_state, klass = Order)

test 'deny transition from accepted to blamed because of no blame_reason' do
a = Article.find_by_title('accepted1');
assert_raise Workflow::TransitionHalted do
assert_raises Workflow::TransitionHalted do
assert a.blame!
end
assert_state 'accepted1', 'accepted', Article
Expand Down
2 changes: 0 additions & 2 deletions test/attr_protected_test.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
require 'test_helper'

$VERBOSE = false
require 'active_record'
require 'logger'
require 'sqlite3'
require 'workflow'
require 'mocha/setup'
require 'stringio'

Expand Down
3 changes: 1 addition & 2 deletions test/before_transition_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require File.join(File.dirname(__FILE__), 'test_helper')
require 'workflow'
require 'test_helper'

class BeforeTransitionTest < Test::Unit::TestCase
class MyFlow
Expand Down
4 changes: 2 additions & 2 deletions test/couchtiny_example.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require File.join(File.dirname(__FILE__), 'test_helper')
require 'test_helper'

require 'couchtiny'
require 'couchtiny/document'
require 'workflow'

class User < CouchTiny::Document
include Workflow
Expand Down
6 changes: 3 additions & 3 deletions test/inheritance_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require File.join(File.dirname(__FILE__), 'test_helper')
require 'workflow'
require 'test_helper'

class InheritanceTest < ActiveRecordTestCase

test '#69 inheritance' do
Expand Down Expand Up @@ -40,7 +40,7 @@ class Cat < Animal

animal.birth!

assert_raise NoMethodError, 'Methods defined by the old workflow spec should have be gone away' do
assert_raises NoMethodError, 'Methods defined by the old workflow spec should have be gone away' do
cat.birth!
end

Expand Down
15 changes: 6 additions & 9 deletions test/main_test.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
require File.join(File.dirname(__FILE__), 'test_helper')
require 'test_helper'

$VERBOSE = false
require 'active_record'
require 'sqlite3'
require 'workflow'
require 'mocha/setup'
require 'stringio'
#require 'ruby-debug'
require 'workflow/draw'

ActiveRecord::Migration.verbose = false

Expand Down Expand Up @@ -201,7 +199,7 @@ def assert_state(title, expected_state, klass = Order)
end
end
end
assert_not_nil c.workflow_spec.on_transition_proc
refute_nil c.workflow_spec.on_transition_proc
c.new.increment!
end

Expand Down Expand Up @@ -246,7 +244,7 @@ def assert_state(title, expected_state, klass = Order)

test 'correct exception for event, that is not allowed in current state' do
o = assert_state 'some order', 'accepted'
assert_raise Workflow::NoTransitionAllowed do
assert_raises Workflow::NoTransitionAllowed do
o.accept!
end
end
Expand Down Expand Up @@ -387,7 +385,7 @@ class Problem
end
end
end
assert_raise Workflow::WorkflowError do
assert_raises Workflow::WorkflowError do
Problem.new.solve!
end
end
Expand Down Expand Up @@ -445,7 +443,6 @@ def on_new_exit(new_state, event, *args)
test 'diagram generation' do
begin
$stdout = StringIO.new('', 'w')
require 'workflow/draw'
Workflow::Draw::workflow_diagram(Order, :path => '/tmp')
assert_match(/run the following/, $stdout.string,
'PDF should be generate and a hint be given to the user.')
Expand Down Expand Up @@ -496,7 +493,7 @@ def reject(reason)

article = article_class.new
assert article.new?
assert_raise Workflow::TransitionHalted do
assert_raises Workflow::TransitionHalted do
article.reject! 'Too funny'
end
assert_nil article.too_far
Expand Down
4 changes: 2 additions & 2 deletions test/multiple_workflows_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require File.join(File.dirname(__FILE__), 'test_helper')
require 'workflow'
require 'test_helper'

class MultipleWorkflowsTest < ActiveRecordTestCase

test 'multiple workflows' do
Expand Down
3 changes: 1 addition & 2 deletions test/new_versions/compare_states_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'test_helper'
require 'workflow'

class ComparableStatesOrder
include Workflow
Expand All @@ -24,7 +23,7 @@ class CompareStatesTest < Test::Unit::TestCase
assert o.current_state == :accepted
assert o.current_state < :shipped
assert o.current_state > :submitted
assert_raise ArgumentError do
assert_raises ArgumentError do
o.current_state > :unknown
end
end
Expand Down
2 changes: 0 additions & 2 deletions test/new_versions/persistence_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'test_helper'
require 'active_record'
require 'logger'
require 'sqlite3'
require 'workflow'
require 'mocha/setup'
require 'stringio'

Expand Down
12 changes: 6 additions & 6 deletions test/on_error_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require File.join(File.dirname(__FILE__), 'test_helper')
require 'workflow'
require 'test_helper'

class OnErrorTest < Test::Unit::TestCase
# A class that does not handle errors in an error block
Expand Down Expand Up @@ -38,15 +37,16 @@ def initialize

test 'that an exception is raised if there is no associated on_error block' do
flow = NoErrorBlock.new
assert_raise( RuntimeError, "This is some random runtime error" ) { flow.forward! }
assert_raises( RuntimeError, "This is some random runtime error" ) { flow.forward! }
assert_equal(true, flow.first?)
end

test 'that on_error block is called when an exception is raised and the transition is halted' do
flow = ErrorBlock.new
assert_nothing_raised { flow.forward! }
#assert_nothing_raised { flow.forward! }
flow.forward!
assert_equal({:error => RuntimeError, :from=>:first, :to=>:second, :event=>:forward, :args=>[]}, flow.errors)
# transition should not happen
assert_equal(true, flow.first?)
end
end
end
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'rubygems'
require 'test/unit'
require 'active_record'
require 'workflow'

class << Test::Unit::TestCase
def test(name, &block)
Expand Down
5 changes: 2 additions & 3 deletions test/without_active_record_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require File.join(File.dirname(__FILE__), 'test_helper')
require 'workflow'
require 'test_helper'

class WithoutWorkflowTest < Test::Unit::TestCase
class Article
Expand All @@ -26,7 +25,7 @@ def test_readme_example_article
end

test 'better error message on transitions_to typo' do
assert_raise Workflow::WorkflowDefinitionError do
assert_raises Workflow::WorkflowDefinitionError do
Class.new do
include Workflow
workflow do
Expand Down
3 changes: 2 additions & 1 deletion workflow.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rake'
gem.add_development_dependency 'test-unit'
gem.add_development_dependency 'ruby-graphviz', ['~> 1.0.0']

gem.add_development_dependency 'test-unit', ['~> 3.2.3']

gem.required_ruby_version = '>= 1.9.2'
end