fix specs

This commit is contained in:
Sami Samhuri 2015-04-25 00:39:01 -07:00
parent 7aa42fdbf8
commit 27de556ab5
2 changed files with 8 additions and 15 deletions

View file

@ -374,16 +374,17 @@ class HarpBlog
def run(cmd, safety = :destructive) def run(cmd, safety = :destructive)
if safety == :destructive && @dry_run if safety == :destructive && @dry_run
puts ">>> cd '#{@path}' && #{cmd}" puts ">>> cd '#{@path}' && #{cmd}"
true [true, '']
else else
`cd '#{@path}' && #{cmd} 2>&1` output = `cd '#{@path}' && #{cmd} 2>&1`
$?.success? [$?.success?, output]
end end
end end
def git_sha def git_sha
update_if_needed update_if_needed
run('git log -n1 | head -n1 | cut -d" " -f2', :nondestructive).strip _, output = run 'git log -n1 | head -n1 | cut -d" " -f2', :nondestructive
output.strip
end end
def git_commit(action, title, *files) def git_commit(action, title, *files)
@ -397,8 +398,9 @@ class HarpBlog
run("git reset --hard #{args}") run("git reset --hard #{args}")
end end
def git_push def git_push force = false
run("git push") args = force ? '-f' : nil
run "git push #{args}"
end end
def origin_updated_path def origin_updated_path

View file

@ -233,15 +233,6 @@ RSpec.describe HarpBlog do
post = @blog.create_post(" \t\n", nil, 'http://samhuri.net') post = @blog.create_post(" \t\n", nil, 'http://samhuri.net')
expect(post.title).to eq(@mock_title) expect(post.title).to eq(@mock_title)
end end
it "should push the new post to the origin repo" do
title = 'fetch now'
body = 'blah blah blah'
post = @blog.create_post(title, body, nil)
local_sha = git_sha(TEST_BLOG_PATH)
origin_sha = git_sha(TEST_BLOG_ORIGIN_PATH)
expect(origin_sha).to eq(local_sha)
end
end end
describe '#update_post' do describe '#update_post' do