Sha256: e5f56bc63483e44d521c94ae0d9768fd52275bef5906722690b9e8db85a86e30

Contents?: true

Size: 995 Bytes

Versions: 1

Compression:

Stored size: 995 Bytes

Contents

require 'spec_helper'

describe AutoTagVersion do
  subject do
    AutoTagVersion
  end

  module Rails; def self.application; end; end
  module APP; end;

  let(:tag_version) { "1.2.3" }
  let(:app) { APP }
  let(:app_version_path) { "config/initializers/app_version.rb" }

  before do
    allow(Rails).to receive_message_chain("application.class.parent_name").and_return(app.to_s)
  end

  describe ".tag!" do
    context "VERSION variable available" do
      before do
        subject.tag!(tag_version)
        load(app_version_path)
      end

      it "should save the correct tag version" do
        expect(app::VERSION).to eq(tag_version)
      end
    end

    context "git integration" do
      let(:git_msg) { "git add #{app_version_path} && git commit -m \"Bumping version #{tag_version}\" && git tag #{tag_version}" }

      it "should run the correct git command" do
        expect(subject).to receive(:`).with(git_msg)
        subject.tag!(tag_version)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
auto_tag_version-1.0.0 spec/lib/auto_tag_version/utils_spec.rb