This commit is contained in:
r888888888
2014-07-23 15:15:47 -07:00
parent 44b59ab18d
commit 6772566665
12 changed files with 207 additions and 15 deletions

View File

@@ -19,15 +19,16 @@ class PostsControllerTest < ActionController::TestCase
context "passing the api limit" do
setup do
User.any_instance.stubs(:api_hourly_limit).returns(5)
ApiKey.generate!(@user)
end
should "work" do
CurrentUser.user.api_hourly_limit.times do
get :index, {:format => "json", :login => @user.name, :api_key => @user.bcrypt_cookie_password_hash}
get :index, {:format => "json", :login => @user.name, :api_key => @user.api_key.key}
assert_response :success
end
get :index, {:format => "json", :login => @user.name, :api_key => @user.bcrypt_cookie_password_hash}
get :index, {:format => "json", :login => @user.name, :api_key => @user.api_key.key}
assert_response 421
end
end