Convert brew desc test to spec.
This commit is contained in:
parent
9dda84ad6b
commit
b8d50beba2
40
Library/Homebrew/test/cmd/desc_spec.rb
Normal file
40
Library/Homebrew/test/cmd/desc_spec.rb
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
describe "brew desc", :integration_test do
|
||||||
|
let(:desc_cache) { HOMEBREW_CACHE/"desc_cache.json" }
|
||||||
|
|
||||||
|
it "shows a given Formula's description" do
|
||||||
|
setup_test_formula "testball"
|
||||||
|
|
||||||
|
expect { brew "desc", "testball" }
|
||||||
|
.to output("testball: Some test\n").to_stdout
|
||||||
|
.and not_to_output.to_stderr
|
||||||
|
.and be_a_success
|
||||||
|
end
|
||||||
|
|
||||||
|
it "fails when both --search and --name are specified" do
|
||||||
|
expect { brew "desc", "--search", "--name" }
|
||||||
|
.to output(/Pick one, and only one/).to_stderr
|
||||||
|
.and not_to_output.to_stdout
|
||||||
|
.and be_a_failure
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "--search" do
|
||||||
|
it "fails when no search term is given" do
|
||||||
|
expect { brew "desc", "--search" }
|
||||||
|
.to output(/You must provide a search term/).to_stderr
|
||||||
|
.and not_to_output.to_stdout
|
||||||
|
.and be_a_failure
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "--description" do
|
||||||
|
it "creates a description cache" do
|
||||||
|
expect(desc_cache).not_to exist
|
||||||
|
|
||||||
|
shutup do
|
||||||
|
expect { brew "desc", "--description", "testball" }.to be_a_success
|
||||||
|
end
|
||||||
|
|
||||||
|
expect(desc_cache).to exist
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -1,17 +0,0 @@
|
|||||||
require "testing_env"
|
|
||||||
|
|
||||||
class IntegrationCommandTestDesc < IntegrationCommandTestCase
|
|
||||||
def test_desc
|
|
||||||
setup_test_formula "testball"
|
|
||||||
|
|
||||||
assert_equal "testball: Some test", cmd("desc", "testball")
|
|
||||||
assert_match "Pick one, and only one", cmd_fail("desc", "--search", "--name")
|
|
||||||
assert_match "You must provide a search term", cmd_fail("desc", "--search")
|
|
||||||
|
|
||||||
desc_cache = HOMEBREW_CACHE/"desc_cache.json"
|
|
||||||
refute_predicate desc_cache, :exist?, "Cached file should not exist"
|
|
||||||
|
|
||||||
cmd("desc", "--description", "testball")
|
|
||||||
assert_predicate desc_cache, :exist?, "Cached file should not exist"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Loading…
x
Reference in New Issue
Block a user