diff options
Diffstat (limited to 'Library/Homebrew/test/dev-cmd/audit_spec.rb')
| -rw-r--r-- | Library/Homebrew/test/dev-cmd/audit_spec.rb | 150 | 
1 files changed, 4 insertions, 146 deletions
| diff --git a/Library/Homebrew/test/dev-cmd/audit_spec.rb b/Library/Homebrew/test/dev-cmd/audit_spec.rb index c914a9a20..25a179342 100644 --- a/Library/Homebrew/test/dev-cmd/audit_spec.rb +++ b/Library/Homebrew/test/dev-cmd/audit_spec.rb @@ -1,10 +1,6 @@  require "dev-cmd/audit"  require "formulary" -RSpec::Matchers.alias_matcher :have_data, :be_data -RSpec::Matchers.alias_matcher :have_end, :be_end -RSpec::Matchers.alias_matcher :have_trailing_newline, :be_trailing_newline -  module Count    def self.increment      @count ||= 0 @@ -13,6 +9,10 @@ module Count  end  describe FormulaText do +  alias_matcher :have_data, :be_data +  alias_matcher :have_end, :be_end +  alias_matcher :have_trailing_newline, :be_trailing_newline +    let(:dir) { mktmpdir }    def formula_text(name, body = nil, options = {}) @@ -305,23 +305,6 @@ describe FormulaAuditor do      end    end -  specify "#audit_caveats" do -    fa = formula_auditor "foo", <<-EOS.undent -      class Foo < Formula -        homepage "http://example.com/foo" -        url "http://example.com/foo-1.0.tgz" - -        def caveats -          "setuid" -        end -      end -    EOS - -    fa.audit_caveats -    expect(fa.problems) -      .to eq(["Don't recommend setuid in the caveats, suggest sudo instead."]) -  end -    describe "#audit_keg_only_style" do      specify "keg_only_needs_downcasing" do        fa = formula_auditor "foo", <<-EOS.undent, strict: true @@ -385,131 +368,6 @@ describe FormulaAuditor do      end    end -  describe "#audit_homepage" do -    specify "homepage URLs" do -      fa = formula_auditor "foo", <<-EOS.undent, online: true -        class Foo < Formula -          homepage "ftp://example.com/foo" -          url "http://example.com/foo-1.0.tgz" -        end -      EOS - -      fa.audit_homepage -      expect(fa.problems) -        .to eq(["The homepage should start with http or https (URL is #{fa.formula.homepage})."]) - -      formula_homepages = { -        "bar" => "http://www.freedesktop.org/wiki/bar", -        "baz" => "http://www.freedesktop.org/wiki/Software/baz", -        "qux" => "https://code.google.com/p/qux", -        "quux" => "http://github.com/quux", -        "corge" => "http://savannah.nongnu.org/corge", -        "grault" => "http://grault.github.io/", -        "garply" => "http://www.gnome.org/garply", -        "sf1" => "http://foo.sourceforge.net/", -        "sf2" => "http://foo.sourceforge.net", -        "sf3" => "http://foo.sf.net/", -        "sf4" => "http://foo.sourceforge.io/", -        "waldo" => "http://www.gnu.org/waldo", -      } - -      formula_homepages.each do |name, homepage| -        fa = formula_auditor name, <<-EOS.undent -          class #{Formulary.class_s(name)} < Formula -            homepage "#{homepage}" -            url "http://example.com/#{name}-1.0.tgz" -          end -        EOS - -        fa.audit_homepage -        if homepage =~ %r{http:\/\/www\.freedesktop\.org} -          if homepage =~ /Software/ -            expect(fa.problems.first).to match( -              "#{homepage} should be styled " \ -              "`https://wiki.freedesktop.org/www/Software/project_name`", -            ) -          else -            expect(fa.problems.first).to match( -              "#{homepage} should be styled " \ -              "`https://wiki.freedesktop.org/project_name`", -            ) -          end -        elsif homepage =~ %r{https:\/\/code\.google\.com} -          expect(fa.problems.first) -            .to match("#{homepage} should end with a slash") -        elsif homepage =~ /foo\.(sf|sourceforge)\.net/ -          expect(fa.problems.first) -            .to match("#{homepage} should be `https://foo.sourceforge.io/`") -        else -          expect(fa.problems.first) -            .to match("Please use https:// for #{homepage}") -        end -      end -    end - -    specify "missing homepage" do -      fa = formula_auditor "foo", <<-EOS.undent, online: true -        class Foo < Formula -          url "http://example.com/foo-1.0.tgz" -        end -      EOS - -      fa.audit_homepage -      expect(fa.problems.first).to match("Formula should have a homepage.") -    end -  end - -  describe "#audit_text" do -    specify "xcodebuild suggests symroot" do -      fa = formula_auditor "foo", <<-EOS.undent -        class Foo < Formula -          url "http://example.com/foo-1.0.tgz" -          homepage "http://example.com" - -          def install -            xcodebuild "-project", "meow.xcodeproject" -          end -        end -      EOS - -      fa.audit_text -      expect(fa.problems.first) -        .to match('xcodebuild should be passed an explicit "SYMROOT"') -    end - -    specify "bare xcodebuild also suggests symroot" do -      fa = formula_auditor "foo", <<-EOS.undent -        class Foo < Formula -          url "http://example.com/foo-1.0.tgz" -          homepage "http://example.com" - -          def install -            xcodebuild -          end -        end -      EOS - -      fa.audit_text -      expect(fa.problems.first) -        .to match('xcodebuild should be passed an explicit "SYMROOT"') -    end - -    specify "disallow go get usage" do -      fa = formula_auditor "foo", <<-EOS.undent -        class Foo <Formula -          url "http://example.com/foo-1.0.tgz" - -          def install -            system "go", "get", "bar" -          end -        end -      EOS -      fa.audit_text -      expect(fa.problems.first) -        .to match("Formulae should not use `go get`. If non-vendored resources are required use `go_resource`s.") -    end -  end -    describe "#audit_revision_and_version_scheme" do      let(:origin_tap_path) { Tap::TAP_DIRECTORY/"homebrew/homebrew-foo" }      let(:formula_subpath) { "Formula/foo#{@foo_version}.rb" } | 
