Skip to content

Commit

Permalink
[webui] Fix handling of stringified bolleans in index action of proje…
Browse files Browse the repository at this point in the history
…ct controller

When a browser, or capybara, provided the (boolean) value of show_all parameter as
a string, the setting were always interpreted as true. This caused one of our tests
to fail and was also reproducable in firefox (44.0.2).

=======

3) Webui::ProjectController GET #index showing not home projects should eq 1

     Failure/Error: it { expect(assigns(:projects).length).to eq(1) }
       expected: 1
            got: 2

       (compared using ==)

     # ./spec/controllers/webui/project_controller_spec.rb:53:in `block (4 levels) in <top (required)>'
     # ./spec/support/logging.rb:4:in `block (2 levels) in <top (required)>'
  • Loading branch information
bgeuken committed Aug 25, 2016
1 parent e2fb231 commit dbef268
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/app/controllers/webui/project_controller.rb
Expand Up @@ -45,7 +45,7 @@ class Webui::ProjectController < Webui::WebuiController
after_action :verify_authorized, only: [:save_new, :new_incident, :save_meta]

def index
@show_all = params[:show_all]
@show_all = (params[:show_all].to_s == "true")
projects = Project.all
projects = projects.not_home unless @show_all
@projects = projects.pluck(:name, :title)
Expand Down

0 comments on commit dbef268

Please sign in to comment.