diff options
| author | Markus Reiter | 2017-02-20 13:02:54 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-02-20 13:58:30 +0100 |
| commit | f33efbe7c46d4a148af00c83dff73c14717ed0d1 (patch) | |
| tree | efcf3e29fd1aaec2d0f30a7e43ee5da87a6182a4 /Library/Homebrew/test/language_module_requirement_spec.rb | |
| parent | 398de9cf3ce10988d7863a72a472a09e8252554a (diff) | |
| download | brew-f33efbe7c46d4a148af00c83dff73c14717ed0d1.tar.bz2 | |
Convert LanguageModuleRequirement test to spec.
Diffstat (limited to 'Library/Homebrew/test/language_module_requirement_spec.rb')
| -rw-r--r-- | Library/Homebrew/test/language_module_requirement_spec.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Library/Homebrew/test/language_module_requirement_spec.rb b/Library/Homebrew/test/language_module_requirement_spec.rb new file mode 100644 index 000000000..7f2666855 --- /dev/null +++ b/Library/Homebrew/test/language_module_requirement_spec.rb @@ -0,0 +1,49 @@ +require "requirements/language_module_requirement" + +describe LanguageModuleRequirement do + specify "unique dependencies are not equal" do + x = described_class.new(:node, "less") + y = described_class.new(:node, "coffee-script") + expect(x).not_to eq(y) + expect(x.hash).not_to eq(y.hash) + end + + context "when module and import name differ" do + subject { described_class.new(:python, mod_name, import_name) } + let(:mod_name) { "foo" } + let(:import_name) { "bar" } + + its(:message) { is_expected.to include(mod_name) } + its(:the_test) { is_expected.to include("import #{import_name}") } + end + + context "when the language is Perl" do + it "does not satisfy invalid dependencies" do + expect(described_class.new(:perl, "notapackage")).not_to be_satisfied + end + + it "satisfies valid dependencies" do + expect(described_class.new(:perl, "Env")).to be_satisfied + end + end + + context "when the language is Python", :needs_python do + it "does not satisfy invalid dependencies" do + expect(described_class.new(:python, "notapackage")).not_to be_satisfied + end + + it "satisfies valid dependencies" do + expect(described_class.new(:python, "datetime")).to be_satisfied + end + end + + context "when the language is Ruby" do + it "does not satisfy invalid dependencies" do + expect(described_class.new(:ruby, "notapackage")).not_to be_satisfied + end + + it "satisfies valid dependencies" do + expect(described_class.new(:ruby, "date")).to be_satisfied + end + end +end |
