Skip to content

Commit

Permalink
Merge pull request #63 from lostisland/disable-yaml-ruby-2.5
Browse files Browse the repository at this point in the history
Disable yaml tests in Ruby 2.5+ because of issues with Psych 3.0
  • Loading branch information
technoweenie authored May 1, 2019
2 parents 891af86 + 9fc9c72 commit f2ec34d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ matrix:
allow_failures:
- rvm: rbx-2
- rvm: jruby
- rvm: 2.5
- rvm: 2.6

notifications:
emails: false
2 changes: 2 additions & 0 deletions test/agent_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ def test_does_not_encode_non_json_content_types
end

def test_handle_yaml_dump_and_load
return unless supports_yaml?

require 'yaml'
res = Agent.new 'http://example.com', :a => 1
YAML.load(YAML.dump(res))
Expand Down
13 changes: 13 additions & 0 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,17 @@
class Sawyer::TestCase < Minitest::Test
def default_test
end

def supports_yaml?
return true if ruby_version < yaml_disabled_version
ENV["SAWYER_YAML_ENABLED"] == "1"
end

def ruby_version
Gem::Version.new(RUBY_VERSION)
end

def yaml_disabled_version
Gem::Version.new("2.5.0")
end
end
2 changes: 2 additions & 0 deletions test/resource_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ def test_simple_rel_parsing
end

def test_handle_yaml_dump
return unless supports_yaml?

require 'yaml'
res = Resource.new @agent, :a => 1
YAML.dump(res)
Expand Down

0 comments on commit f2ec34d

Please sign in to comment.