Skip to content

Commit

Permalink
adds code to icla signatures controller to allow a user to search icl…
Browse files Browse the repository at this point in the history
…a signatures
  • Loading branch information
nellshamrell committed Feb 10, 2016
1 parent 004764c commit 05a6a5d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/controllers/icla_signatures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ class IclaSignaturesController < ApplicationController
# Displays a list of all users who have a signed ICLA.
#
def index
@icla_signatures = IclaSignature.by_user.page(params[:page]).per(50)
@icla_signatures = IclaSignature.by_user

if params[:contributors_q]
@icla_signatures = @icla_signatures.search(params[:contributors_q])
end

@icla_signatures = @icla_signatures.page(params[:page]).per(50)
end

#
Expand Down
11 changes: 11 additions & 0 deletions spec/controllers/icla_signatures_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
it 'assigns @icla_signatures' do
expect(assigns(:icla_signatures)).to include(icla_signature)
end

context 'when searching for an icla signature' do
let!(:jimmy_icla) { create(:icla_signature, first_name: 'Jimmy', last_name: 'John', email: 'someotheremail@chef.io') }
let!(:billy_icla) { create(:icla_signature, first_name: 'Billy', last_name: 'Bob', email: 'thisdude@chef.io') }

it 'returns icla signatures that match the search' do
get :index, contributors_q: 'Jimmy'
expect(assigns[:icla_signatures]).to include(jimmy_icla)
expect(assigns[:icla_signatures]).to_not include(billy_icla)
end
end
end

describe 'GET #agreement' do
Expand Down

0 comments on commit 05a6a5d

Please sign in to comment.