Sha256: eb7dd96ae3895c8bb1621d6dc62523a960b1328391c08d6519c1f3fc44321a57

Contents?: true

Size: 1.7 KB

Versions: 4

Compression:

Stored size: 1.7 KB

Contents

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

module Danger
  describe Danger::DangerIosVersionChange do
    #
    # 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.7 spec/ios_version_change_spec.rb
danger-ios_version_change-0.1.6 spec/ios_version_change_spec.rb
danger-ios_version_change-0.1.5 spec/ios_version_change_spec.rb
danger-ios_version_change-0.1.4 spec/ios_version_change_spec.rb