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