Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Conversation

@voxik
Copy link

@voxik voxik commented May 5, 2021

This does not really really add to readability while one less dependency is beneficial.

This does not really really add to readability while one less dependency
is beneficial.
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)
Copy link
Collaborator

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.


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)
Copy link
Collaborator

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.


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)
Copy link
Collaborator

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.

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)
Copy link
Collaborator

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.

@voxik
Copy link
Author

voxik commented May 5, 2021

Just FTR, it seems that the have is used in the test suite more or less just for historic reasons, since it was available up until RSpec 3.x

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants