spec/lib/git/git_spec.rb in git_lib-1.2.0 vs spec/lib/git/git_spec.rb in git_lib-1.3.0.pre.1
- old
+ new
@@ -2,11 +2,11 @@
require 'spec_helper'
require_relative '../../../lib/git/git.rb'
# rubocop:disable Metrics/LineLength
-describe 'Git::Git' do
+RSpec.describe 'Git::Git' do
include FakeFS::SpecHelpers
def create_mock_open_status(status)
status_object = double
allow(status_object).to receive(:success?) { status == 1 }
@@ -26,27 +26,29 @@
end
[stdout_andstderr_str, create_mock_open_status(status)]
end
end
+ let(:repository_name) { 'repository_name' }
+
it 'can be created' do
- git = Git::Git.new('repository_name')
+ git = Git::Git.new(repository_name)
expect(git.repository_url).to eq('git@github.com:repository_name.git')
expect(git.repository_path).to eq('/tmp/git/repository_name')
end
it 'can be created with a different cache path' do
- git = Git::Git.new('repository_name', git_cache_path: './mycache')
+ git = Git::Git.new(repository_name, git_cache_path: './mycache')
expect(git.repository_url).to eq('git@github.com:repository_name.git')
expect(git.repository_path).to eq('./mycache/repository_name')
end
context 'with a git repository' do
before do
- @git = Git::Git.new('repository_name')
+ @git = Git::Git.new(repository_name)
end
it 'can execute a command' do
mock_execute('sample output', 1)
expect(@git.execute('sample command')).to eq('sample output')
@@ -143,25 +145,25 @@
1
)
branch_list = []
branch_list << Git::GitBranch.new(
- 'repository_name',
+ repository_name,
'test_1',
DateTime.iso8601('2015-10-19T17:58:24-0700'),
'Nicholas Ellis',
'nellis@invoca.com'
)
branch_list << Git::GitBranch.new(
- 'repository_name',
+ repository_name,
'test_build',
DateTime.iso8601('2015-10-19T15:03:22-0700'),
'Bob Smith',
'bob@invoca.com'
)
branch_list << Git::GitBranch.new(
- 'repository_name',
+ repository_name,
'test_build_b',
DateTime.iso8601('2015-10-19T16:52:40-0700'),
'Nicholas Ellis',
'nellis@invoca.com'
)
@@ -184,11 +186,11 @@
"Automatic merge failed; fix conflicts and then commit the result.\n",
0
)
conflict = Git::GitConflict.new(
- 'repository_name',
+ repository_name,
'91/eb/WEB-1723_Ringswitch_DB_Conn_Loss',
'85/t/trello_adwords_dashboard_tiles_auto_adjust_font_size',
['test/workers/adwords_detail_worker_test.rb', 'pegasus/backdraft/pegasus_dashboard/spec/views/call_cost_tile_spec.js']
)
expect(
@@ -213,11 +215,11 @@
0
)
expect(@git).to receive(:reset)
conflict = Git::GitConflict.new(
- 'repository_name',
+ repository_name,
'91/eb/WEB-1723_Ringswitch_DB_Conn_Loss',
'85/t/trello_adwords_dashboard_tiles_auto_adjust_font_size',
[
'test/workers/adwords_detail_worker_test.rb',
'pegasus/backdraft/pegasus_dashboard/spec/views/call_cost_tile_spec.js'
@@ -375,11 +377,11 @@
describe 'commit_diff_refs' do
it 'can diff a branch' do
mocked_output = ["efd778098239838c165ffab2f12ad293f32824c8\tAuthor 1\tauthor1@email.com\t2016-07-14T10:09:45-07:00\tMerge branch 'production'\n",
"667f3e5347c48c04663209682642fd8d6d93fde2\tAuthor 2\tauthor2@email.com\t2016-07-14T16:46:35-07:00\tMerge pull request #5584 from Owner/repo/dimension_repair\n"].join
- expected_array = [Git::GitCommit.new('efd778098239838c165ffab2f12ad293f32824c8', "Merge branch 'production'", nil, 'Author 1', 'author1@email.com'),
- Git::GitCommit.new('667f3e5347c48c04663209682642fd8d6d93fde2', 'Merge pull request #5584 from Owner/repo/dimension_repair', nil, 'Author 2', 'author2@email.com')]
+ expected_array = [Git::GitCommit.new('efd778098239838c165ffab2f12ad293f32824c8', "Merge branch 'production'", nil, 'Author 1', 'author1@email.com', repository_name: repository_name),
+ Git::GitCommit.new('667f3e5347c48c04663209682642fd8d6d93fde2', 'Merge pull request #5584 from Owner/repo/dimension_repair', nil, 'Author 2', 'author2@email.com', repository_name: repository_name)]
mock_execute(
mocked_output,
1,
expected_command: "/usr/bin/git log --format=%H\t%an\t%ae\t%aI\t%s --no-color origin/ancestor_branch..origin/branch"
)