diff --git a/test/checks_test.rb b/spec/checks_spec.rb similarity index 76% rename from test/checks_test.rb rename to spec/checks_spec.rb index 7d3113b..166c3a5 100644 --- a/test/checks_test.rb +++ b/spec/checks_spec.rb @@ -1,37 +1,33 @@ -require File.dirname(__FILE__) + "/helper" +require File.expand_path(File.dirname(__FILE__) + "/spec_helper") -class ChecksTest < Test::Unit::TestCase - def setup +describe "checks" do + before do @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_no_checkbox_found + it "should_fail_if_no_checkbox_found" do @response.stubs(:body).returns(<<-EOS)
EOS - assert_raises RuntimeError do - @session.checks "remember_me" - end + lambda { @session.checks "remember_me" }.should raise_error end - def test_should_fail_if_input_is_not_a_checkbox + it "should_fail_if_input_is_not_a_checkbox" do @response.stubs(:body).returns(<<-EOS) EOS - assert_raises RuntimeError do - @session.checks "remember_me" - end + lambda { @session.checks "remember_me" }.should raise_error end - def test_should_check_rails_style_checkboxes + it "should_check_rails_style_checkboxes" do @response.stubs(:body).returns(<<-EOS) EOS - assert_raises RuntimeError do - @session.unchecks "remember_me" - end + lambda { @session.unchecks "remember_me" }.should raise_error end - def test_should_fail_if_input_is_not_a_checkbox + it "should_fail_if_input_is_not_a_checkbox" do @response.stubs(:body).returns(<<-EOS) EOS - assert_raises RuntimeError do - @session.unchecks "remember_me" - end + lambda { @session.unchecks "remember_me" }.should raise_error end - def test_should_uncheck_rails_style_checkboxes + it "should_uncheck_rails_style_checkboxes" do @response.stubs(:body).returns(<<-EOS) EOS - assert_raises RuntimeError do - @session.chooses "first option" - end + lambda { @session.chooses "first option" }.should raise_error end - def test_should_fail_if_input_is_not_a_radio_button + it "should_fail_if_input_is_not_a_radio_button" do @response.stubs(:body).returns(<<-EOS) EOS - assert_raises RuntimeError do - @session.chooses "first_option" - end + lambda { @session.chooses "first_option" }.should raise_error end - def test_should_check_rails_style_radio_buttons + it "should_check_rails_style_radio_buttons" do @response.stubs(:body).returns(<<-EOS) EOS - assert_raises RuntimeError do - @session.clicks_button - end + lambda { @session.clicks_button }.should raise_error end - def test_should_fail_if_input_is_not_a_submit_button + it "should_fail_if_input_is_not_a_submit_button" do @response.stubs(:body).returns(<<-EOS) EOS - - assert_raises RuntimeError do - @session.clicks_button - end + + lambda { @session.clicks_button }.should raise_error end - def test_should_default_to_get_method + it "should_default_to_get_method" do @response.stubs(:body).returns(<<-EOS)