Sha256: 0c9eb109169390cbc5fc6692593651962671504d05a464682b0681fa9dc85742

Contents?: true

Size: 1.35 KB

Versions: 17

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_falsey
    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_truthy
    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_truthy
    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_truthy
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
awestruct-0.6.7 spec/awestruct/scm/git_spec.rb
awestruct-0.6.6 spec/awestruct/scm/git_spec.rb
awestruct-0.6.5 spec/awestruct/scm/git_spec.rb
awestruct-0.6.4 spec/awestruct/scm/git_spec.rb
awestruct-0.6.3 spec/awestruct/scm/git_spec.rb
awestruct-0.6.2 spec/awestruct/scm/git_spec.rb
awestruct-0.6.1 spec/awestruct/scm/git_spec.rb
awestruct-0.6.0 spec/awestruct/scm/git_spec.rb
awestruct-0.6.0.RC1 spec/awestruct/scm/git_spec.rb
awestruct-0.6.0.alpha4 spec/awestruct/scm/git_spec.rb
awestruct-0.6.0.alpha3 spec/awestruct/scm/git_spec.rb
awestruct-0.6.0.alpha1 spec/awestruct/scm/git_spec.rb
awestruct-0.5.7 spec/awestruct/scm/git_spec.rb
awestruct-0.5.7.RC2 spec/awestruct/scm/git_spec.rb
awestruct-0.5.7.RC1 spec/awestruct/scm/git_spec.rb
awestruct-0.5.6 spec/awestruct/scm/git_spec.rb
awestruct-0.5.6.beta9 spec/awestruct/scm/git_spec.rb