Skip to content

Commit

Permalink
actually check value presense, improve related test
Browse files Browse the repository at this point in the history
  • Loading branch information
ujifgc committed Oct 12, 2015
1 parent 49f4e90 commit 27e63d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -45,7 +45,7 @@ def blank_option(prompt)
#
def option_is_selected?(value, caption, selected_values)
Array(selected_values).any? do |selected|
value.to_s ?
value ?
value.to_s == selected.to_s :
caption.to_s == selected.to_s
end
Expand Down
4 changes: 2 additions & 2 deletions padrino-helpers/test/test_form_helpers.rb
Expand Up @@ -782,9 +782,9 @@ def protect_from_csrf; false; end

it 'should display selected options falling back to checking content' do
options = [['one'], ['two'], ['three', 'three']]
actual_html = select_tag(:number, :options => options, :selected => 'one')
actual_html = select_tag(:number, :options => options, :selected => 'one').gsub!(/value="(one|two)"/, '').html_safe
assert_has_tag('select option', :selected => 'selected', :count => 1) { actual_html }
assert_has_tag('select option', :content => 'one', :value => 'one', :selected => 'selected') { actual_html }
assert_has_tag('select option', :content => 'one', :selected => 'selected') { actual_html }
end

it 'should display options with values and accept disabled options' do
Expand Down

0 comments on commit 27e63d5

Please sign in to comment.