brew/Library/Homebrew/test/cmd/info_spec.rb

44 lines
1.3 KiB
Ruby
Raw Normal View History

2017-02-25 19:49:46 +01:00
require "cmd/info"
require "cmd/shared_examples/args_parse"
2017-02-23 06:06:48 +01:00
describe "Homebrew.info_args" do
it_behaves_like "parseable arguments"
end
2018-09-16 22:06:42 +01:00
describe "brew info", :integration_test do
2018-09-17 09:50:02 +01:00
it "prints as json with the --json=v1 flag" do
setup_test_formula "testball"
2018-09-16 22:06:42 +01:00
expect { brew "info", "testball", "--json=v1" }
.to output(a_json_string).to_stdout
2018-09-16 22:06:42 +01:00
.and not_to_output.to_stderr
.and be_a_success
2017-02-23 06:06:48 +01:00
end
end
2017-02-25 19:49:46 +01:00
describe Homebrew do
let(:remote) { "https://github.com/Homebrew/homebrew-core" }
specify "::analytics_table" do
results = { ack: 10, wget: 100 }
expect { subject.analytics_table("install", "30", results) }
.to output(/110 | 100.00%/).to_stdout
.and not_to_output.to_stderr
end
2017-02-25 19:49:46 +01:00
specify "::github_remote_path" do
expect(subject.github_remote_path(remote, "Formula/git.rb"))
.to eq("https://github.com/Homebrew/homebrew-core/blob/master/Formula/git.rb")
expect(subject.github_remote_path("#{remote}.git", "Formula/git.rb"))
.to eq("https://github.com/Homebrew/homebrew-core/blob/master/Formula/git.rb")
expect(subject.github_remote_path("git@github.com:user/repo", "foo.rb"))
.to eq("https://github.com/user/repo/blob/master/foo.rb")
expect(subject.github_remote_path("https://mywebsite.com", "foo/bar.rb"))
.to eq("https://mywebsite.com/foo/bar.rb")
end
end