Sha256: 33fc6e4ae109ef4beb3d4e6817988c25ad1ef518ae1f7dde97bd88391014f302

Contents?: true

Size: 1.35 KB

Versions: 15

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'
require 'awestruct/deploy/base_deploy'

describe Awestruct::Scm::Git do
  specify 'should respond_to :uncommitted_changes?' do
    expect(subject).to respond_to :uncommitted_changes?
  end
  context "#uncommitted_changes?('.')" do
    specify 'when there are no changes, returns false' do
      Open3.should_receive(:popen3).with('git status --porcelain', :chdir => '.').and_yield(nil, StringIO.new(''), StringIO.new(''), nil)
      expect(subject.uncommitted_changes? '.').to be_false
    end

    specify 'when there are changes to untracked files, returns true' do
      Open3.should_receive(:popen3).with('git status --porcelain', :chdir => '.').and_yield(nil, StringIO.new('?? test.rb'), StringIO.new(''), nil)
      expect(subject.uncommitted_changes? '.').to be_true
    end

    specify 'when there are modifications, returns true' do
      Open3.should_receive(:popen3).with('git status --porcelain', :chdir => '.').and_yield(nil, StringIO.new(' M test.rb'), StringIO.new(''), nil)
      expect(subject.uncommitted_changes? '.').to be_true
    end

    specify 'when there are additions and modifications, returns true' do
      Open3.should_receive(:popen3).with('git status --porcelain', :chdir => '.').and_yield(nil, StringIO.new('AM test.rb'), StringIO.new(''), nil)
      expect(subject.uncommitted_changes? '.').to be_true
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
awestruct-0.5.6.beta8 spec/awestruct/scm/git_spec.rb
awestruct-0.5.6.beta7 spec/awestruct/scm/git_spec.rb
awestruct-0.5.6.beta6 spec/awestruct/scm/git_spec.rb
awestruct-0.5.6.beta5 spec/awestruct/scm/git_spec.rb
awestruct-0.5.6.beta4 spec/awestruct/scm/git_spec.rb
awestruct-0.5.6.beta3 spec/awestruct/scm/git_spec.rb
awestruct-0.5.6.beta2 spec/awestruct/scm/git_spec.rb
awestruct-0.5.6.beta spec/awestruct/scm/git_spec.rb
awestruct-0.5.5 spec/awestruct/scm/git_spec.rb
awestruct-0.5.4.2 spec/awestruct/scm/git_spec.rb
awestruct-0.5.4.1 spec/awestruct/scm/git_spec.rb
awestruct-0.5.4 spec/awestruct/scm/git_spec.rb
awestruct-0.5.4.rc3 spec/awestruct/scm/git_spec.rb
awestruct-0.5.4.rc2 spec/awestruct/scm/git_spec.rb
awestruct-0.5.4.rc spec/awestruct/scm/git_spec.rb