Sha256: adc8a792dea6aa09b71dbaf11b1651d033927fbd0c46168f5f0998d7e4c955af

Contents?: true

Size: 1.81 KB

Versions: 4

Compression:

Stored size: 1.81 KB

Contents

require File.expand_path("../spec_helper", __FILE__)

module Danger
  describe Danger::DangerIosVersionChange do
    it "should be a plugin" do
      expect(Danger::DangerIosVersionChange.new(nil)).to be_a Danger::Plugin
    end

    #
    # You should test your custom attributes and methods here
    #
    describe "with Dangerfile" do
      before do
        @dangerfile = testing_dangerfile
        @my_plugin = @dangerfile.ios_version_change
      end

      # Some examples for writing tests
      # You should replace these with your own.

      it "Cannot find Info.plist file" do
        @my_plugin.assert_version_changed("Foo/Bar/Info.plist")
        expect(@dangerfile.status_report[:errors]).to eq(["Info.plist at path Foo/Bar/Info.plist does not exist."])
      end

      it "Fails from an empty git diff message" do
        @my_plugin.assert_version_changed_diff("")
        expect(@dangerfile.status_report[:errors]).to eq(["You did not change the iOS version."])
      end

      it "Successfully detects version changed" do
        diff = File.read("spec/ChangedVersionCodeGitDiff.txt")
        @my_plugin.assert_version_changed_diff(diff)
        expect(@dangerfile.status_report[:errors]).to eq([])
      end

      it "Runs into end of git diff. This should never happen, but I need to test the built in error handling." do
        diff = File.read("spec/RunIntoEndOfFileGitDiff.txt")
        @my_plugin.assert_version_changed_diff(diff)
        expect(@dangerfile.status_report[:errors]).to eq(["You did not change the iOS version."])
      end

      it "Version code was not changed." do
        diff = File.read("spec/NotChangedVersionCodeGitDiff.txt")
        @my_plugin.assert_version_changed_diff(diff)
        expect(@dangerfile.status_report[:errors]).to eq(["You did not change the iOS version."])
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
danger-ios_version_change-0.1.3 spec/ios_version_change_spec.rb
danger-ios_version_change-0.1.2 spec/ios_version_change_spec.rb
danger-ios_version_change-0.1.1 spec/ios_version_change_spec.rb
danger-ios_version_change-0.1.0 spec/ios_version_change_spec.rb