Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Medeiros committed Jul 5, 2020
1 parent 715aeb3 commit 23982d8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
GEM
remote: https://rubygems.org/
specs:
minispec-metadata (3.3.1)
minitest
minitest (5.14.1)
minitest-hooks (1.5.0)
minitest (> 5.3)
Expand All @@ -10,6 +12,7 @@ PLATFORMS
ruby

DEPENDENCIES
minispec-metadata (~> 3.3.1)
minitest (~> 5.14.1)
minitest-hooks (~> 1.5.0)
rake (~> 13.0.1)
Expand Down
28 changes: 18 additions & 10 deletions integration/dependencies/ruby_test.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
require 'test_helper'

class TestRuby < Loon::Test
def test_versions
def test_ruby_versions
dependency_test :ruby
%w(2.6.6 2.7.1).each do |version|
with_payload(deps: {'ruby' => version}) do
loon %w(exec ruby --version)

assert_status 0
assert_stdout version
end
test_ruby_dep version: version, match: version
end
end

def test_default
with_payload(deps: 'ruby') do
dependency_test :ruby
test_ruby_dep match: '2.7.1'
end

private

def test_ruby_dep(version: nil, match:)
dep = if version
{'ruby' => version}
else
'ruby'
end

with_payload(deps: dep) do
loon %w(exec ruby --version)

assert_status 0
assert_stdout '2.7.1'
assert_stdout match
end
end
end

6 changes: 5 additions & 1 deletion integration/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ def assert_path(path)
end

module Loon
class Test < Minitest::Test
class Test < Minitest::Spec
include Minitest::Hooks
include Assertions

def dependency_test(dep)
skip "Not running dependency tests for #{dep}" unless ENV['DEPENDENCY'] && ENV["DEPENDENCY_#{lang.to_s.upcase}"]
end

def with_payload(name: "Test", url: "Test", deps: [], tasks: [])
deps = deps.is_a?(Array) ? deps : [deps]
tasks = tasks.is_a?(Array) ? tasks : [tasks]
Expand Down

0 comments on commit 23982d8

Please sign in to comment.