aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-12 21:16:04 +0100
committerGitHub2017-02-12 21:16:04 +0100
commit93724c0645f59ccdb4b4bf34f701957bacb5e45a (patch)
treec407e89dcb1e96d1f5d2350d82442874c3cbb15a
parent08c75616396371be93ab6129a71c5d8b91d6c2be (diff)
parent23767a378bf4c10d2e78e49050ab566d9f8cdaed (diff)
downloadbrew-93724c0645f59ccdb4b4bf34f701957bacb5e45a.tar.bz2
Merge pull request #1990 from reitermarkus/x11-requirement-spec
Convert X11Requirement test to spec.
-rw-r--r--Library/Homebrew/test/x11_requirement_spec.rb36
-rw-r--r--Library/Homebrew/test/x11_requirement_test.rb31
2 files changed, 36 insertions, 31 deletions
diff --git a/Library/Homebrew/test/x11_requirement_spec.rb b/Library/Homebrew/test/x11_requirement_spec.rb
new file mode 100644
index 000000000..f60c8bffe
--- /dev/null
+++ b/Library/Homebrew/test/x11_requirement_spec.rb
@@ -0,0 +1,36 @@
+require "requirements/x11_requirement"
+
+describe X11Requirement do
+ let(:default_name) { "x11" }
+
+ describe "#name" do
+ it "defaults to x11" do
+ expect(subject.name).to eq(default_name)
+ end
+ end
+
+ describe "#eql?" do
+ it "returns true if the names are equal" do
+ other = described_class.new(default_name)
+ expect(subject).to eql(other)
+ end
+
+ it "and returns false if the names differ" do
+ other = described_class.new("foo")
+ expect(subject).not_to eql(other)
+ end
+
+ it "returns false if the minimum version differs" do
+ other = described_class.new(default_name, ["2.5"])
+ expect(subject).not_to eql(other)
+ end
+ end
+
+ describe "#modify_build_environment" do
+ it "calls ENV#x11" do
+ allow(subject).to receive(:satisfied?).and_return(true)
+ expect(ENV).to receive(:x11)
+ subject.modify_build_environment
+ end
+ end
+end
diff --git a/Library/Homebrew/test/x11_requirement_test.rb b/Library/Homebrew/test/x11_requirement_test.rb
deleted file mode 100644
index b82a59e53..000000000
--- a/Library/Homebrew/test/x11_requirement_test.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-require "testing_env"
-require "requirements/x11_requirement"
-
-class X11RequirementTests < Homebrew::TestCase
- def test_eql_instances_are_eql
- x = X11Requirement.new
- y = X11Requirement.new
- assert_eql x, y
- assert_equal x.hash, y.hash
- end
-
- def test_not_eql_when_hashes_differ
- x = X11Requirement.new("foo")
- y = X11Requirement.new
- refute_eql x, y
- refute_equal x.hash, y.hash
- end
-
- def test_different_min_version
- x = X11Requirement.new
- y = X11Requirement.new("x11", %w[2.5])
- refute_eql x, y
- end
-
- def test_x_env
- x = X11Requirement.new
- x.stubs(:satisfied?).returns(true)
- ENV.expects(:x11)
- x.modify_build_environment
- end
-end