Skip to content

Commit

Permalink
removed return true and changed to_a.map to .map
Browse files Browse the repository at this point in the history
  • Loading branch information
cgullick committed Sep 22, 2014
1 parent 62c2722 commit fa498bf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/thegarage/gitx/cli/integrate_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def resume
end

def check_if_branch_exists?(branch)
return true if local_branches.include?(branch)
local_branches.include?(branch)
end

def local_branches
@local_branches ||= repo.branches.each_name(:local).to_a.map { |branch| branch }
@local_branches ||= repo.branches.each_name(:local).map { |branch| branch }

This comment has been minimized.

Copy link
@wireframe

wireframe Sep 22, 2014

Contributor

remove the map function and associated block.

the map function is used to transform one array into another. you're block is not doing any manipulation of the array, and is just returning the same string value.

end
end
end
Expand Down
18 changes: 17 additions & 1 deletion spec/thegarage/gitx/cli/integrate_command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,23 @@
expect(cli).to receive(:run_cmd).with("git checkout my-feature-branch").ordered

cli.integrate
# expect { cli.integrate }
end
it 'raises error' do
should meet_expectations
end
end
context 'with --resume flag with no feature branch passed' do
let(:options) do
{
resume:''
}
end
let(:repo) { cli.send(:repo) }
let(:branches) { double(each_name: ['my-feature-branch'])}
before do
expect(repo).to receive(:branches).and_return(branches)

cli.integrate
end
it 'raises error' do

This comment has been minimized.

Copy link
@wireframe

wireframe Sep 22, 2014

Contributor

is this the correct expectation? if you don't pass a feature branch, it is going to raise an error?

should meet_expectations
Expand Down

0 comments on commit fa498bf

Please sign in to comment.