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