brew/Library/Homebrew/test/dev-cmd/extract_spec.rb
Mike McQuaid 59d680a626
dev-cmd: only one integration test per command.
Integration tests are useful in detecting breakages but much slower so
let's only use one per command and install formula outside the
integration test framework (which is also slow).
2019-03-27 09:45:48 +00:00

27 lines
930 B
Ruby

describe "brew extract", :integration_test do
it "retrieves the specified version of formula, defaulting to most recent" do
path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
(path/"Formula").mkpath
target = Tap.from_path(path)
core_tap = CoreTap.new
core_tap.path.cd do
system "git", "init"
formula_file = setup_test_formula "testball"
system "git", "add", "--all"
system "git", "commit", "-m", "testball 0.1"
contents = File.read(formula_file)
contents.gsub!("testball-0.1", "testball-0.2")
File.write(formula_file, contents)
system "git", "add", "--all"
system "git", "commit", "-m", "testball 0.2"
end
expect { brew "extract", "testball", target.name, "--version=0.1" }
.to be_a_success
expect(path/"Formula/testball@0.1.rb").to exist
expect(Formulary.factory(path/"Formula/testball@0.1.rb").version).to be == "0.1"
end
end