Commit b717ccfb31afcdd9463b70229d668b60107c9f0e
1 parent
d77668a0
Exists in
master
and in
1 other branch
List users by name on app edit forms.
Showing
3 changed files
with
15 additions
and
1 deletions
Show diff stats
app/controllers/apps_controller.rb
app/views/apps/_fields.html.haml
... | ... | @@ -55,7 +55,7 @@ |
55 | 55 | = w.radio_button :watcher_type, :email |
56 | 56 | = label_tag :watcher_type_email, 'Email Address', :for => label_for_attr(w, 'watcher_type_email') |
57 | 57 | %div.watcher_params.user{:class => w.object.email.blank? ? 'chosen' : nil} |
58 | - = w.select :user_id, User.all.map{|u| [u.name,u.id.to_s]}, :include_blank => '-- Select a User --' | |
58 | + = w.select :user_id, users.map{|u| [u.name,u.id.to_s]}, :include_blank => '-- Select a User --' | |
59 | 59 | %div.watcher_params.email{:class => w.object.email.present? ? 'chosen' : nil} |
60 | 60 | = w.text_field :email |
61 | 61 | ... | ... |
spec/controllers/apps_controller_spec.rb
... | ... | @@ -73,6 +73,16 @@ describe AppsController do |
73 | 73 | expect(response).to be_success |
74 | 74 | end |
75 | 75 | |
76 | + it "should list available watchers by name" do | |
77 | + Fabricate(:user, :name => "Carol") | |
78 | + Fabricate(:user, :name => "Alice") | |
79 | + Fabricate(:user, :name => "Betty") | |
80 | + | |
81 | + get :show, :id => app.id | |
82 | + | |
83 | + expect(controller.users.to_a).to eq(User.all.to_a.sort_by(&:name)) | |
84 | + end | |
85 | + | |
76 | 86 | context "pagination" do |
77 | 87 | before(:each) do |
78 | 88 | 35.times { Fabricate(:err, :problem => Fabricate(:problem, :app => app)) } | ... | ... |