Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@

# Coverage directory used by simplycov
coverage

# Bundler
vendor/bundle
.bundle
6 changes: 3 additions & 3 deletions lib/utils/bump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ def assign_pr_attributes!(pr_number)
end

def get_content_update(path)
head_branch_content = Content.new(config: @config, ref: @head_branch, path: path).content
updated_base_branch_content = update_file_contents(path, head_branch_content)
base_branch_content = Content.new(config: @config, ref: @base_branch, path: path).content
updated_base_branch_content = update_file_contents(path, base_branch_content)

if head_branch_content == updated_base_branch_content
if base_branch_content == updated_base_branch_content
puts "::notice title=Nothing to update::The desired version bump is already present for: #{path}"
return nil
end
Expand Down
26 changes: 1 addition & 25 deletions spec/lib/utils/bump_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
let(:other_version_file_paths) { ['path/to/other/version/file'] }
let(:other_version_patterns) { [] }
let(:base_content) { instance_double(Content) }
let(:head_content) { instance_double(Content) }
let(:commit) { instance_double(Commit) }

before do
Expand All @@ -25,10 +24,6 @@
config: config, ref: 'base_branch',
path: anything
).and_return(base_content)
allow(Content).to receive(:new).with(
config: config, ref: 'head_branch',
path: anything
).and_return(head_content)

allow(client).to receive(:pull_request).with(
'owner/repo',
Expand Down Expand Up @@ -61,7 +56,6 @@

describe '#bump_everything' do
it 'bumps the version and commits the changes' do
allow(head_content).to receive(:content).and_return('version: 1.0.0')
allow(base_content).to receive(:content).and_return('version: 1.0.0')

bump = Bump.new(config, 'patch')
Expand All @@ -75,25 +69,8 @@
bump.bump_everything
end

it 'skips updating if the desired version bump is already present' do
allow(head_content).to receive(:content).and_return('version: 1.0.1')
allow(base_content).to receive(:content).and_return('version: 1.0.0')

bump = Bump.new(config, 'patch')
expect(commit).not_to receive(:multiple_files)
expect do
bump.bump_everything
end.to output(
"::notice title=Nothing to update::The desired version bump is already present for: " \
"#{other_version_file_paths[0]}\n" \
"::notice title=Nothing to update::The desired version bump is already present for: " \
"#{version_file_path}\n"
).to_stdout
end

it 'retains modified version file content' do
allow(head_content).to receive(:content).and_return('version: 1.0.0 extra stuff here')
allow(base_content).to receive(:content).and_return('version: 1.0.0')
allow(base_content).to receive(:content).and_return('version: 1.0.0 extra stuff here')

bump = Bump.new(config, 'patch')
expect(commit).to receive(:multiple_files).with(
Expand All @@ -110,7 +87,6 @@
end

it 'handles python underscored version format' do
allow(head_content).to receive(:content).and_return('__version__ = "1.0.0"')
allow(base_content).to receive(:content).and_return('__version__ = "1.0.0"')

bump = Bump.new(config, 'patch')
Expand Down
Loading