From 423f22df0033f83a04a9452d2e755a96e830b039 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 21 Feb 2017 05:13:05 +0100 Subject: Convert `search_remote_tap` test to spec. --- Library/Homebrew/test/cmd/search_remote_tap_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Library/Homebrew/test/cmd/search_remote_tap_spec.rb (limited to 'Library/Homebrew/test/cmd') diff --git a/Library/Homebrew/test/cmd/search_remote_tap_spec.rb b/Library/Homebrew/test/cmd/search_remote_tap_spec.rb new file mode 100644 index 000000000..99c2cc20b --- /dev/null +++ b/Library/Homebrew/test/cmd/search_remote_tap_spec.rb @@ -0,0 +1,19 @@ +require "cmd/search" + +describe Homebrew do + specify "#search_tap" do + json_response = { + "tree" => [ + { + "path" => "Formula/not-a-formula.rb", + "type" => "blob", + }, + ], + } + + allow(GitHub).to receive(:open).and_yield(json_response) + + expect(described_class.search_tap("homebrew", "not-a-tap", "not-a-formula")) + .to eq(["homebrew/not-a-tap/not-a-formula"]) + end +end -- cgit v1.2.3 From 9ac59b99e462e648013ea3a1cbfba295e80b5837 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 18 Feb 2017 17:38:13 +0100 Subject: Convert `brew analytics` test to spec. --- Library/Homebrew/test/cmd/analytics_spec.rb | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Library/Homebrew/test/cmd/analytics_spec.rb (limited to 'Library/Homebrew/test/cmd') diff --git a/Library/Homebrew/test/cmd/analytics_spec.rb b/Library/Homebrew/test/cmd/analytics_spec.rb new file mode 100644 index 000000000..aed3a7a33 --- /dev/null +++ b/Library/Homebrew/test/cmd/analytics_spec.rb @@ -0,0 +1,52 @@ +describe "brew analytics", :integration_test do + before(:each) do + HOMEBREW_REPOSITORY.cd do + shutup do + system "git", "init" + end + end + end + + it "is disabled when HOMEBREW_NO_ANALYTICS is set" do + expect { brew "analytics", "HOMEBREW_NO_ANALYTICS" => "1" } + .to output(/Analytics is disabled \(by HOMEBREW_NO_ANALYTICS\)/).to_stdout + .and not_to_output.to_stderr + .and be_a_success + end + + context "when HOMEBREW_NO_ANALYTICS is unset" do + it "is disabled after running `brew analytics off`" do + brew "analytics", "off" + expect { brew "analytics", "HOMEBREW_NO_ANALYTICS" => nil } + .to output(/Analytics is disabled/).to_stdout + .and not_to_output.to_stderr + .and be_a_success + end + + it "is enabled after running `brew analytics on`" do + brew "analytics", "on" + expect { brew "analytics", "HOMEBREW_NO_ANALYTICS" => nil } + .to output(/Analytics is enabled/).to_stdout + .and not_to_output.to_stderr + .and be_a_success + end + end + + it "fails when running `brew analytics on off`" do + expect { brew "analytics", "on", "off" } + .to output(/Invalid usage/).to_stderr + .and not_to_output.to_stdout + .and be_a_failure + end + + it "fails when running `brew analytics testball`" do + expect { brew "analytics", "testball" } + .to output(/Invalid usage/).to_stderr + .and not_to_output.to_stdout + .and be_a_failure + end + + it "can generate a new UUID" do + expect { brew "analytics", "regenerate-uuid" }.to be_a_success + end +end -- cgit v1.2.3