mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-24 14:27:41 +00:00
fix specs
This commit is contained in:
parent
7aa42fdbf8
commit
27de556ab5
2 changed files with 8 additions and 15 deletions
|
|
@ -374,16 +374,17 @@ class HarpBlog
|
|||
def run(cmd, safety = :destructive)
|
||||
if safety == :destructive && @dry_run
|
||||
puts ">>> cd '#{@path}' && #{cmd}"
|
||||
true
|
||||
[true, '']
|
||||
else
|
||||
`cd '#{@path}' && #{cmd} 2>&1`
|
||||
$?.success?
|
||||
output = `cd '#{@path}' && #{cmd} 2>&1`
|
||||
[$?.success?, output]
|
||||
end
|
||||
end
|
||||
|
||||
def git_sha
|
||||
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
|
||||
|
||||
def git_commit(action, title, *files)
|
||||
|
|
@ -397,8 +398,9 @@ class HarpBlog
|
|||
run("git reset --hard #{args}")
|
||||
end
|
||||
|
||||
def git_push
|
||||
run("git push")
|
||||
def git_push force = false
|
||||
args = force ? '-f' : nil
|
||||
run "git push #{args}"
|
||||
end
|
||||
|
||||
def origin_updated_path
|
||||
|
|
|
|||
|
|
@ -233,15 +233,6 @@ RSpec.describe HarpBlog do
|
|||
post = @blog.create_post(" \t\n", nil, 'http://samhuri.net')
|
||||
expect(post.title).to eq(@mock_title)
|
||||
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
|
||||
|
||||
describe '#update_post' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue