Add needs_linux tag to specs that fails on MacOS

This commit is contained in:
Gabriel 2019-05-29 15:50:17 -03:00
parent 41f39939ca
commit b2969e6063
3 changed files with 25 additions and 36 deletions

View File

@ -171,7 +171,7 @@ class SoftwareSpec
end
def uses_from_macos(deps, **_args)
deps.is_a?(Hash) && deps = Hash[*deps.shift]
deps = Hash[*deps.shift] if deps.is_a?(Hash)
depends_on(deps)
end

View File

@ -1,35 +0,0 @@
# frozen_string_literal: true
require "software_spec"
describe SoftwareSpec do
subject(:spec) { described_class.new }
describe "#uses_from_macos" do
before do
allow(OS).to receive(:linux?).and_return(true)
end
it "allows specifying dependencies" do
spec.uses_from_macos("foo")
expect(spec.deps.first.name).to eq("foo")
end
it "works with tags" do
spec.uses_from_macos("foo" => :head, :after => :mojave)
expect(spec.deps.first.name).to eq("foo")
expect(spec.deps.first.tags).to include(:head)
end
it "ignores OS version specifications" do
spec.uses_from_macos("foo", after: :mojave)
spec.uses_from_macos("bar" => :head, :after => :mojave)
expect(spec.deps.first.name).to eq("foo")
expect(spec.deps.last.name).to eq("bar")
expect(spec.deps.last.tags).to include(:head)
end
end
end

View File

@ -132,6 +132,30 @@ describe SoftwareSpec do
end
end
describe "#uses_from_macos" do
it "allows specifying dependencies", :needs_linux do
spec.uses_from_macos("foo")
expect(spec.deps.first.name).to eq("foo")
end
it "works with tags", :needs_linux do
spec.uses_from_macos("foo" => :head, :after => :mojave)
expect(spec.deps.first.name).to eq("foo")
expect(spec.deps.first.tags).to include(:head)
end
it "ignores OS version specifications", :needs_linux do
spec.uses_from_macos("foo", after: :mojave)
spec.uses_from_macos("bar" => :head, :after => :mojave)
expect(spec.deps.first.name).to eq("foo")
expect(spec.deps.last.name).to eq("bar")
expect(spec.deps.last.tags).to include(:head)
end
end
specify "explicit options override defaupt depends_on option description" do
subject.option("with-foo", "blah")
subject.depends_on("foo" => :optional)