require File.dirname(__FILE__) + "/helper" class SelectsTest < Test::Unit::TestCase def setup @session = ActionController::Integration::Session.new @session.stubs(:assert_response) @session.stubs(:get_via_redirect) @session.stubs(:response).returns(@response=mock) end def test_should_fail_if_option_not_found @response.stubs(:body).returns(<<-EOS)
EOS @session.expects(:flunk) @session.selects "February" end def test_should_fail_if_option_not_found_in_list_specified_by_element_name @response.stubs(:body).returns(<<-EOS) EOS @session.expects(:flunk) @session.selects "February", :from => "year" end def test_should_fail_if_specified_list_not_found @response.stubs(:body).returns(<<-EOS) EOS @session.expects(:flunk) @session.selects "February", :from => "year" end def test_should_send_value_from_option @response.stubs(:body).returns(<<-EOS) EOS @session.expects(:post_via_redirect).with("/login", "month" => "1") @session.selects "January" @session.clicks_button end def test_should_send_value_from_option_in_list_specified_by_name @response.stubs(:body).returns(<<-EOS) EOS @session.expects(:post_via_redirect).with("/login", "end_month" => "e1") @session.selects "January", :from => "end_month" @session.clicks_button end def test_should_send_value_from_option_in_list_specified_by_label @response.stubs(:body).returns(<<-EOS) EOS @session.expects(:post_via_redirect).with("/login", "end_month" => "e1") @session.selects "January", :from => "End Month" @session.clicks_button end def test_should_use_option_text_if_no_value @response.stubs(:body).returns(<<-EOS) EOS @session.expects(:post_via_redirect).with("/login", "month" => "January") @session.selects "January" @session.clicks_button end end