Permalink
Browse files

Added tests for Credential Persistence

  • Loading branch information...
1 parent ba884f5 commit 0eef70a97304d8599fe18d1adb30d30c710731ce @n-studio n-studio committed Nov 5, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 spec/motion/http_spec.rb
View
@@ -103,6 +103,7 @@ def test_http_method(method)
before do
@credentials = { username: 'mneorr', password: '123456xx!@crazy' }
+ @credential_persistence = 0
@payload = {
user: { name: 'marin', surname: 'usalj' },
twitter: '@mneorr',
@@ -124,6 +125,7 @@ def test_http_method(method)
files: @files,
payload: @payload,
credentials: @credentials,
+ credential_persistence: @credential_persistence,
headers: @headers,
cache_policy: @cache_policy,
leftover_option: @leftover_option,
@@ -316,6 +318,14 @@ def sample_data
new_query.instance_variable_get(:@cache_policy).should.equal NSURLRequestUseProtocolCachePolicy
end
+ it "should delete :credential_persistence or set NSURLCredentialPersistenceForSession" do
+ @query.instance_variable_get(:@credential_persistence).should.equal @credential_persistence
+ @options.should.not.has_key? :credential_persistence
+
+ new_query = BubbleWrap::HTTP::Query.new( @localhost_url, :get, {})
+ new_query.instance_variable_get(:@credential_persistence).should.equal NSURLCredentialPersistenceForSession
+ end
+
it "should set the rest of options{} to ivar @options" do
@query.options.size.should.equal 1
@query.options.values[0].should.equal @leftover_option
@@ -614,8 +624,8 @@ def query_received_data
@challenge.sender.credential.password.should.equal @credentials[:password]
end
- it "always uses NSURLCredentialPersistenceForSession" do
- @challenge.sender.credential.persistence.should.equal NSURLCredentialPersistenceForSession
+ it "should use Credential Persistence set in options" do
+ @challenge.sender.credential.persistence.should.equal @credential_persistence
end
end

0 comments on commit 0eef70a

Please sign in to comment.