automated-testing: more tests
This commit is contained in:
@@ -3,53 +3,80 @@ require 'minitest/autorun'
|
||||
require_relative '../../../lib/shared/runnable'
|
||||
|
||||
describe Shared::Runnable do
|
||||
include Shared::Runnable
|
||||
|
||||
class TestClass
|
||||
include Shared::Runnable
|
||||
end
|
||||
|
||||
describe "git commands" do
|
||||
|
||||
def run_cmd (cmd)
|
||||
cmd
|
||||
end
|
||||
|
||||
before do
|
||||
@object = TestClass.new
|
||||
@branch = "branch-name"
|
||||
@run_cmd = lambda do |cmd|
|
||||
cmd
|
||||
end
|
||||
end
|
||||
|
||||
it "should show branches" do
|
||||
git_show_branches.must_equal "git branch"
|
||||
@object.stub(:run_cmd, @run_cmd) do
|
||||
@object.git_show_branches.must_equal "git branch"
|
||||
end
|
||||
end
|
||||
it "should checkout" do
|
||||
git_checkout(@branch).must_equal "git checkout branch-name"
|
||||
@object.stub(:run_cmd, @run_cmd) do
|
||||
@object.git_checkout(@branch).must_equal "git checkout branch-name"
|
||||
end
|
||||
end
|
||||
it "should remote branch delete" do
|
||||
git_remote_branch_delete(@branch).must_equal "git push origin :branch-name"
|
||||
@object.stub(:run_cmd, @run_cmd) do
|
||||
@object.git_remote_branch_delete(@branch).must_equal "git push origin :branch-name"
|
||||
end
|
||||
end
|
||||
it "should local branch delete" do
|
||||
git_local_branch_delete(@branch).must_equal "git branch -d branch-name"
|
||||
@object.stub(:run_cmd, @run_cmd) do
|
||||
@object.git_local_branch_delete(@branch).must_equal "git branch -d branch-name"
|
||||
end
|
||||
end
|
||||
it "should local branch trash" do
|
||||
git_local_branch_trash(@branch).must_equal "git branch -D branch-name"
|
||||
@object.stub(:run_cmd, @run_cmd) do
|
||||
@object.git_local_branch_trash(@branch).must_equal "git branch -D branch-name"
|
||||
end
|
||||
end
|
||||
it "should prune remote branches" do
|
||||
git_prune.must_equal "git remote prune origin"
|
||||
@object.stub(:run_cmd, @run_cmd) do
|
||||
@object.git_prune.must_equal "git remote prune origin"
|
||||
end
|
||||
end
|
||||
it "should pull" do
|
||||
git_pull(@branch).must_equal "git pull origin branch-name"
|
||||
@object.stub(:run_cmd, @run_cmd) do
|
||||
@object.git_pull(@branch).must_equal "git pull origin branch-name"
|
||||
end
|
||||
end
|
||||
it "should merge" do
|
||||
git_merge(@branch).must_equal "git merge branch-name"
|
||||
@object.stub(:run_cmd, @run_cmd) do
|
||||
@object.git_merge(@branch).must_equal "git merge branch-name"
|
||||
end
|
||||
end
|
||||
it "should push" do
|
||||
git_push(@branch).must_equal "git push origin branch-name"
|
||||
@object.stub(:run_cmd, @run_cmd) do
|
||||
@object.git_push(@branch).must_equal "git push origin branch-name"
|
||||
end
|
||||
end
|
||||
it "should rebase" do
|
||||
git_rebase(@branch).must_equal "git rebase branch-name"
|
||||
@object.stub(:run_cmd, @run_cmd) do
|
||||
@object.git_rebase(@branch).must_equal "git rebase branch-name"
|
||||
end
|
||||
end
|
||||
it "should create local branch" do
|
||||
git_local_branch_create(@branch).must_equal "git checkout -b branch-name"
|
||||
@object.stub(:run_cmd, @run_cmd) do
|
||||
@object.git_local_branch_create(@branch).must_equal "git checkout -b branch-name"
|
||||
end
|
||||
end
|
||||
it "should commit" do
|
||||
git_commit('test message').must_equal 'git commit -m "test message"'
|
||||
@object.stub(:run_cmd, @run_cmd) do
|
||||
@object.git_commit('test message').must_equal 'git commit -m "test message"'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user