diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-03 17:51:09 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-03 17:51:09 +0000 |
commit | 818988c4190c97db095b6df5c30d32b7797a0cea (patch) | |
tree | efa5b6496dc3dd5d5563b1cf064817e08655a193 /test/functional/welcome_controller_test.rb | |
parent | 610a92c4d1e8b69c4f5671e5cb7c8b0cfd6ff080 (diff) | |
download | redmine-818988c4190c97db095b6df5c30d32b7797a0cea.tar.gz redmine-818988c4190c97db095b6df5c30d32b7797a0cea.zip |
Removed ApplicationControllerTest.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8486 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/welcome_controller_test.rb')
-rw-r--r-- | test/functional/welcome_controller_test.rb | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/test/functional/welcome_controller_test.rb b/test/functional/welcome_controller_test.rb index 30d235beb..fa22514d3 100644 --- a/test/functional/welcome_controller_test.rb +++ b/test/functional/welcome_controller_test.rb @@ -91,4 +91,65 @@ class WelcomeControllerTest < ActionController::TestCase :attributes => {:type => "text/javascript"}, :content => %r{new WarnLeavingUnsaved} end + + def test_call_hook_mixed_in + assert @controller.respond_to?(:call_hook) + end + + context "test_api_offset_and_limit" do + context "without params" do + should "return 0, 25" do + assert_equal [0, 25], @controller.api_offset_and_limit({}) + end + end + + context "with limit" do + should "return 0, limit" do + assert_equal [0, 30], @controller.api_offset_and_limit({:limit => 30}) + end + + should "not exceed 100" do + assert_equal [0, 100], @controller.api_offset_and_limit({:limit => 120}) + end + + should "not be negative" do + assert_equal [0, 25], @controller.api_offset_and_limit({:limit => -10}) + end + end + + context "with offset" do + should "return offset, 25" do + assert_equal [10, 25], @controller.api_offset_and_limit({:offset => 10}) + end + + should "not be negative" do + assert_equal [0, 25], @controller.api_offset_and_limit({:offset => -10}) + end + + context "and limit" do + should "return offset, limit" do + assert_equal [10, 50], @controller.api_offset_and_limit({:offset => 10, :limit => 50}) + end + end + end + + context "with page" do + should "return offset, 25" do + assert_equal [0, 25], @controller.api_offset_and_limit({:page => 1}) + assert_equal [50, 25], @controller.api_offset_and_limit({:page => 3}) + end + + should "not be negative" do + assert_equal [0, 25], @controller.api_offset_and_limit({:page => 0}) + assert_equal [0, 25], @controller.api_offset_and_limit({:page => -2}) + end + + context "and limit" do + should "return offset, limit" do + assert_equal [0, 100], @controller.api_offset_and_limit({:page => 1, :limit => 100}) + assert_equal [200, 100], @controller.api_offset_and_limit({:page => 3, :limit => 100}) + end + end + end + end end |