diff options
-rw-r--r-- | app/views/scores/_form.html.erb | 9 | ||||
-rw-r--r-- | test/controllers/scores_controller_test.rb | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/app/views/scores/_form.html.erb b/app/views/scores/_form.html.erb index 9cbcec7..87a924e 100644 --- a/app/views/scores/_form.html.erb +++ b/app/views/scores/_form.html.erb @@ -5,10 +5,11 @@ <% criteria.each do |criterium| %> <% current_score = existing_scores.find { |score| score.scoring_criterium_id == criterium.id } %> <p> - <%= select_tag "scores[#{criterium.id}][value]", - options_for_select(1..5, current_score&.value), - required: true, - prompt: "Score" %> + <%= number_field_tag "scores[#{criterium.id}][value]", + current_score&.value, + in: 1..5, + required: true, + placeholder: "Score (1-5)" %> <%= label_tag "scores[#{criterium.id}][value]", criterium.name.capitalize %> </p> diff --git a/test/controllers/scores_controller_test.rb b/test/controllers/scores_controller_test.rb index 6a6bc9a..244c07c 100644 --- a/test/controllers/scores_controller_test.rb +++ b/test/controllers/scores_controller_test.rb @@ -11,7 +11,7 @@ class ScoresControllerTest < ActionDispatch::IntegrationTest get new_tartiflette_score_path(@tartiflette) assert_response :success assert_select "form" - assert_select "select[name=?]", "scores[#{@criterium.id}][value]" + assert_select "input[type=number][name=?]", "scores[#{@criterium.id}][value]" end test "should not create scores with invalid data" do @@ -27,7 +27,7 @@ class ScoresControllerTest < ActionDispatch::IntegrationTest get tartiflette_edit_scores_path(@tartiflette) assert_response :success assert_select "form" - assert_select "select[name=?]", "scores[#{@criterium.id}][value]" + assert_select "input[type=number][name=?]", "scores[#{@criterium.id}][value]" end test "should update scores for tartiflette" do |