aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cmd
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-23 11:04:37 +0100
committerGitHub2017-02-23 11:04:37 +0100
commitc7121f6be50e44784e3e29114617c29715bd9c0f (patch)
treee95fdcb4b57eb72df6dc883b4303b848c83f1c69 /Library/Homebrew/test/cmd
parent3f8e52e5742cdd3d992ddee79741a4c4e45ab4bf (diff)
parentb8d50beba209ed1b4b1436576b71bea4aab82251 (diff)
downloadbrew-c7121f6be50e44784e3e29114617c29715bd9c0f.tar.bz2
Merge pull request #2104 from reitermarkus/spec-integration-test-helpers
Convert `brew desc` test to spec and add integration test helper methods.
Diffstat (limited to 'Library/Homebrew/test/cmd')
-rw-r--r--Library/Homebrew/test/cmd/desc_spec.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/Library/Homebrew/test/cmd/desc_spec.rb b/Library/Homebrew/test/cmd/desc_spec.rb
new file mode 100644
index 000000000..b09819d81
--- /dev/null
+++ b/Library/Homebrew/test/cmd/desc_spec.rb
@@ -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