context '(…) with a single exact match' do
setup do
@sinatra = create(:rubygem, :name => "sinatra")
create(:version, :rubygem => @sinatra)
get :show, :query => "sinatra"
end
should respond_with :redirect
should redirect_to('the gem') { rubygem_path(@sinatra) }
end
Slide 43
Slide 43 text
This was our code.
Slide 44
Slide 44 text
redirect_to rubygem_path(@exact_match) \
if @gems == [@exact_match]
Slide 45
Slide 45 text
That’s it.
Slide 46
Slide 46 text
No content
Slide 47
Slide 47 text
+34 −8
Lines
Slide 48
Slide 48 text
Pull Request
conversation
Slide 49
Slide 49 text
No content
Slide 50
Slide 50 text
" This makes it impossible to perform certain
searches. For example, if a user wanted to
search for all the gems with the omniauth
prefix, this would no longer be possible
because the omniauth gem exists.
Slide 51
Slide 51 text
No content
Slide 52
Slide 52 text
No content
Slide 53
Slide 53 text
Are you sure?
it seems to redirect only if there is only 1
element in the original search result array
Slide 54
Slide 54 text
No content
Slide 55
Slide 55 text
No content
Slide 56
Slide 56 text
No content
Slide 57
Slide 57 text
(actual response)
Slide 58
Slide 58 text
Takeaway #1
Give clear examples in
your Pull Requests
Slide 59
Slide 59 text
Takeaway #2
Don’t instantly fold, react
to feedback politely.