This repository was archived by the owner on Jan 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
Remove rspec-collection_matchers dependency. #36
Open
voxik
wants to merge
1
commit into
dwaite:master
Choose a base branch
from
voxik:remove-rspec-collection-matchers
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ | |
| jar.set_cookie 'http://foo.com/', 'bar=baz' | ||
| jar.set_cookie 'http://auth.foo.com/', 'foo=bar' | ||
| jar.set_cookie 'http://auth.foo.com/', 'auth=135121...;domain=foo.com' | ||
| expect(jar.get_cookies('http://foo.com/')).to have(3).items | ||
| expect(jar.get_cookies('http://foo.com/').size).to eql(3) | ||
| end | ||
| it 'should let me read back a multiple cookies from 1 header' do | ||
| jar = Jar.new | ||
|
|
@@ -42,7 +42,7 @@ | |
| jar.set_cookie uri, 'c=bar;path=/a/b' | ||
| jar.set_cookie uri, 'd=bar;path=/a/' | ||
| cookies = jar.get_cookies(uri) | ||
| expect(cookies).to have(4).items | ||
| expect(cookies.size).to eql(4) | ||
| expect(cookies[0].name).to eq 'b' | ||
| expect(cookies[1].name).to eq 'a' | ||
| expect(cookies[2].name).to eq 'c' | ||
|
|
@@ -53,7 +53,7 @@ | |
| uri = 'http://localhost/' | ||
| jar.set_cookie uri, 'foo=bar;expires=Wednesday, 09-Nov-99 23:12:40 GMT' | ||
| cookies = jar.get_cookies(uri) | ||
| expect(cookies).to have(0).items | ||
| expect(cookies.size).to eql(0) | ||
| end | ||
| end | ||
| describe '.get_cookie_headers' do | ||
|
|
@@ -91,7 +91,7 @@ | |
| jar.set_cookie uri, 'c=bar;path=/a/b' | ||
| jar.set_cookie uri, 'd=bar;path=/a/' | ||
| jar.set_cookie 'http://localhost/', 'foo=bar' | ||
| expect(jar.to_a).to have(5).items | ||
| expect(jar.to_a.size).to eql(5) | ||
| end | ||
| end | ||
| describe '.expire_cookies' do | ||
|
|
@@ -103,9 +103,9 @@ | |
| jar.set_cookie uri, 'c=bar;path=/a/b' | ||
| jar.set_cookie uri, 'd=bar;path=/a/' | ||
| jar.set_cookie 'http://localhost/', 'foo=bar' | ||
| expect(jar.to_a).to have(5).items | ||
| expect(jar.to_a.size).to eql(5) | ||
| jar.expire_cookies | ||
| expect(jar.to_a).to have(4).items | ||
| expect(jar.to_a.size).to eql(4) | ||
| end | ||
| it 'should let me expire all session cookies' do | ||
| uri = 'http://foo.com/a/b/c/d' | ||
|
|
@@ -115,69 +115,69 @@ | |
| jar.set_cookie uri, 'c=bar;path=/a/b' | ||
| jar.set_cookie uri, 'd=bar;path=/a/' | ||
| jar.set_cookie 'http://localhost/', 'foo=bar' | ||
| expect(jar.to_a).to have(5).items | ||
| expect(jar.to_a.size).to eql(5) | ||
| jar.expire_cookies true | ||
| expect(jar.to_a).to have(1).items | ||
| expect(jar.to_a.size).to eql(1) | ||
| end | ||
| end | ||
| describe '#set_cookies_from_headers' do | ||
| it 'should handle a Set-Cookie header' do | ||
| jar = Jar.new | ||
| cookies = jar.set_cookies_from_headers 'http://localhost/', | ||
| 'Set-Cookie' => 'foo=bar' | ||
| expect(cookies).to have(1).items | ||
| expect(jar.to_a).to have(1).items | ||
| expect(cookies.size).to eql(1) | ||
| expect(jar.to_a.size).to eql(1) | ||
| end | ||
| it 'should handle a set-cookie header' do | ||
| jar = Jar.new | ||
| cookies = jar.set_cookies_from_headers 'http://localhost/', | ||
| 'set-cookie' => 'foo=bar' | ||
| expect(cookies).to have(1).items | ||
| expect(jar.to_a).to have(1).items | ||
| expect(cookies.size).to eql(1) | ||
| expect(jar.to_a.size).to eql(1) | ||
| end | ||
| it 'should handle multiple Set-Cookie headers' do | ||
| jar = Jar.new | ||
| cookies = jar.set_cookies_from_headers 'http://localhost/', | ||
| 'Set-Cookie' => ['foo=bar', 'bar=baz'] | ||
| expect(cookies).to have(2).items | ||
| expect(jar.to_a).to have(2).items | ||
| expect(cookies.size).to eql(2) | ||
| expect(jar.to_a.size).to eql(2) | ||
| end | ||
| it 'should handle a Set-Cookie2 header' do | ||
| jar = Jar.new | ||
| cookies = jar.set_cookies_from_headers 'http://localhost/', | ||
| 'Set-Cookie2' => 'foo=bar;Version=1' | ||
| expect(cookies).to have(1).items | ||
| expect(jar.to_a).to have(1).items | ||
| expect(cookies.size).to eql(1) | ||
| expect(jar.to_a.size).to eql(1) | ||
| end | ||
| it 'should handle a set-cookie2 header' do | ||
| jar = Jar.new | ||
| cookies = jar.set_cookies_from_headers 'http://localhost/', | ||
| 'set-cookie2' => 'foo=bar;Version=1' | ||
| expect(cookies).to have(1).items | ||
| expect(jar.to_a).to have(1).items | ||
| expect(cookies.size).to eql(1) | ||
| expect(jar.to_a.size).to eql(1) | ||
| end | ||
| it 'should handle multiple Set-Cookie2 headers' do | ||
| jar = Jar.new | ||
| cookies = jar.set_cookies_from_headers 'http://localhost/', | ||
| 'Set-Cookie2' => ['foo=bar;Version=1', 'bar=baz;Version=1'] | ||
| expect(cookies).to have(2).items | ||
| expect(jar.to_a).to have(2).items | ||
| expect(cookies.size).to eql(2) | ||
| expect(jar.to_a.size).to eql(2) | ||
| end | ||
| it 'should handle mixed distinct Set-Cookie and Set-Cookie2 headers' do | ||
| jar = Jar.new | ||
| cookies = jar.set_cookies_from_headers 'http://localhost/', | ||
| 'Set-Cookie' => 'foo=bar', | ||
| 'Set-Cookie2' => 'bar=baz;Version=1' | ||
| expect(cookies).to have(2).items | ||
| expect(jar.to_a).to have(2).items | ||
| expect(cookies.size).to eql(2) | ||
| expect(jar.to_a.size).to eql(2) | ||
| end | ||
| it 'should handle overlapping Set-Cookie and Set-Cookie2 headers' do | ||
| jar = Jar.new | ||
| cookies = jar.set_cookies_from_headers 'http://localhost/', | ||
| 'Set-Cookie' => ['foo=bar', 'bar=baz'], | ||
| 'Set-Cookie2' => 'foo=bar;Version=1' | ||
| expect(cookies).to have(2).items | ||
| expect(jar.to_a).to have(2).items | ||
| expect(cookies.size).to eql(2) | ||
| expect(jar.to_a.size).to eql(2) | ||
| # and has the version 1 cookie | ||
| expect(cookies.find do |cookie| | ||
| cookie.name == 'foo' | ||
|
|
@@ -187,8 +187,8 @@ | |
| jar = Jar.new | ||
| cookies = jar.set_cookies_from_headers 'http://localhost/', | ||
| 'Set-Cookie' => ['foo=bar', 'bar=baz;domain=.foo.com'] | ||
| expect(cookies).to have(1).items | ||
| expect(jar.to_a).to have(1).items | ||
| expect(cookies.size).to eql(1) | ||
| expect(jar.to_a.size).to eql(1) | ||
| end | ||
| end | ||
| begin | ||
|
|
@@ -208,20 +208,20 @@ | |
| array = JSON.parse json | ||
|
|
||
| jar = Jar.json_create array | ||
| expect(jar.get_cookies('https://localhost/')).to have(1).items | ||
| expect(jar.get_cookies('https://localhost/').size).to eql(1) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. |
||
| end | ||
| it 'should deserialize a JSON hash to a jar' do | ||
| json = '{"cookies":[{"name":"foo","value":"bar","domain":"localhost.local","path":"\\/","created_at":"2009-09-11 12:51:03 -0600","expiry":"2028-11-01 12:00:00 GMT","secure":true}]}' | ||
| hash = JSON.parse json | ||
|
|
||
| jar = Jar.json_create hash | ||
| expect(jar.get_cookies('https://localhost/')).to have(1).items | ||
| expect(jar.get_cookies('https://localhost/').size).to eql(1) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. |
||
| end | ||
|
|
||
| it 'should automatically deserialize to a jar' do | ||
| json = '{"json_class":"CookieJar::Jar","cookies":[{"name":"foo","value":"bar","domain":"localhost.local","path":"\\/","created_at":"2009-09-11 12:51:03 -0600","expiry":"2028-11-01 12:00:00 GMT","secure":true}]}' | ||
| jar = JSON.parse json, create_additions: true | ||
| expect(jar.get_cookies('https://localhost/')).to have(1).items | ||
| expect(jar.get_cookies('https://localhost/').size).to eql(1) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. |
||
| end | ||
| end | ||
| rescue LoadError | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| require 'cookiejar' | ||
| require 'rubygems' | ||
| require 'rspec' | ||
| require 'rspec/collection_matchers' | ||
| require 'yaml' |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.