Skip to content

Commit

Permalink
Fix: correctly detect that shard has no dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ysbaddaden committed Dec 23, 2016
1 parent 9ef3fb3 commit 3e7afcd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/commands/check.cr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module Shards
end

private def has_dependencies?
spec.dependencies.any? || !Shards.production? || spec.development_dependencies.any?
spec.dependencies.any? || (!Shards.production? && spec.development_dependencies.any?)
end

private def verify(dependencies)
Expand Down
2 changes: 1 addition & 1 deletion src/commands/list.cr
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module Shards

# FIXME: duplicates Check#has_dependencies?
private def has_dependencies?
spec.dependencies.any? || !Shards.production? || spec.development_dependencies.any?
spec.dependencies.any? || (!Shards.production? && spec.development_dependencies.any?)
end
end
end
Expand Down
6 changes: 6 additions & 0 deletions test/integration/check_test.cr
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ class CheckCommandTest < Minitest::Test
end
end

def test_succeeds_without_dependencies_and_lockfile
with_shard({ name: "no_dependencies" }) do
run "shards check --no-color"
end
end

def test_fails_when_dependencies_are_missing
with_shard({ dependencies: { web: "*" } }) do
run "shards install"
Expand Down

0 comments on commit 3e7afcd

Please sign in to comment.