#192: added specs for allowed_addresses to api defender

This commit is contained in:
Vokhmin Alexey V 2013-07-04 16:43:35 +04:00
parent 3771dd749e
commit 0c926e850c
1 changed files with 14 additions and 0 deletions

View File

@ -119,4 +119,18 @@ describe ApiDefender do
response.status.should == 200
end
end
context 'for allowed_addresses' do
let(:remote_addr) { APP_CONFIG['allowed_addresses'].first }
it "should not return the limit usage for allowed address" do
get "/api/v1/users/#{@user.id}.json", {}, {'REMOTE_ADDR' => remote_addr }
response.headers['X-RateLimit-Limit'].should_not == @rate_limit.to_s
end
it "should not forbidden allowed address" do
(@rate_limit+1).times { get "/api/v1/users/#{@user.id}.json", {}, {'REMOTE_ADDR' => remote_addr } }
response.status.should == 200
end
end
end