majoun 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +37 -0
- data/.rspec +4 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +17 -0
- data/CONTRIBUTING.md +11 -0
- data/Changelog.md +1 -0
- data/Gemfile +12 -0
- data/Gemfile.devtools +71 -0
- data/Guardfile +18 -0
- data/LICENSE +20 -0
- data/README.md +24 -0
- data/Rakefile +6 -0
- data/TODO.md +1 -0
- data/config/devtools.yml +2 -0
- data/config/flay.yml +3 -0
- data/config/flog.yml +2 -0
- data/config/mutant.yml +3 -0
- data/config/reek.yml +110 -0
- data/config/rubocop.yml +78 -0
- data/config/yardstick.yml +2 -0
- data/lib/cookie.rb +89 -0
- data/lib/cookie/header.rb +70 -0
- data/lib/cookie/header/attribute.rb +172 -0
- data/lib/cookie/registry.rb +53 -0
- data/lib/cookie/version.rb +8 -0
- data/majoun.gemspec +25 -0
- data/spec/integration/public_api_spec.rb +186 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/unit/cookie/decrypt_spec.rb +19 -0
- data/spec/unit/cookie/encrypt_spec.rb +19 -0
- data/spec/unit/cookie/header/attribute/set/each_spec.rb +22 -0
- data/spec/unit/cookie/header/attribute/set/empty/merge_spec.rb +13 -0
- data/spec/unit/cookie/header/attribute/set/empty/to_s_spec.rb +11 -0
- data/spec/unit/cookie/version_spec.rb +7 -0
- metadata +149 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'cookie'
|
4
|
+
|
5
|
+
# MUST happen after ice_nine
|
6
|
+
# got required by substation
|
7
|
+
require 'devtools/spec_helper'
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.expect_with :rspec do |c|
|
11
|
+
c.syntax = :expect
|
12
|
+
end
|
13
|
+
config.mock_with :rspec do |c|
|
14
|
+
c.syntax = :expect
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Cookie, '#decrypt' do
|
6
|
+
subject { object.decrypt(box) }
|
7
|
+
|
8
|
+
let(:object) { described_class.new(name, cipher) }
|
9
|
+
let(:name) { double('name') }
|
10
|
+
let(:cipher) { double('cipher') }
|
11
|
+
let(:box) { double('box') }
|
12
|
+
let(:value) { double('value') }
|
13
|
+
|
14
|
+
before do
|
15
|
+
expect(box).to receive(:decrypt).with(cipher).and_return(value)
|
16
|
+
end
|
17
|
+
|
18
|
+
it { should eql(described_class.new(name, value)) }
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Cookie, '#encrypt' do
|
6
|
+
subject { object.encrypt(box) }
|
7
|
+
|
8
|
+
let(:object) { described_class.new(name, value) }
|
9
|
+
let(:name) { double('name') }
|
10
|
+
let(:value) { double('value') }
|
11
|
+
let(:box) { double('box') }
|
12
|
+
let(:cipher) { double('cipher') }
|
13
|
+
|
14
|
+
before do
|
15
|
+
expect(box).to receive(:encrypt).with(value).and_return(cipher)
|
16
|
+
end
|
17
|
+
|
18
|
+
it { should eql(described_class.new(name, cipher)) }
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Cookie::Header::Attribute::Set, '#each' do
|
6
|
+
let(:attributes) { described_class.new(entries) }
|
7
|
+
let(:entries) { Hash[name => attribute] }
|
8
|
+
let(:attribute) { double('attribute', :to_s => name) }
|
9
|
+
let(:name) { double('name') }
|
10
|
+
|
11
|
+
it 'returns self when a block is given' do
|
12
|
+
expect(attributes.each { |_| }).to be(attributes)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns an enumerator when no block is given' do
|
16
|
+
expect(attributes.each).to be_instance_of(Enumerator)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'yields all attributes' do
|
20
|
+
expect { |block| attributes.each(&block) }.to yield_successive_args(attribute)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Cookie::Header::Attribute::Set::Empty, '#merge' do
|
6
|
+
subject { object.merge(attribute) }
|
7
|
+
|
8
|
+
let(:object) { described_class.new }
|
9
|
+
let(:attribute) { double('attribute', :name => name) }
|
10
|
+
let(:name) { double('name') }
|
11
|
+
|
12
|
+
it { should eql(Cookie::Header::Attribute::Set.new(name => attribute)) }
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: majoun
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Martin Gamsjaeger (snusnu)
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-04-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: adamantium
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.2.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.2.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: abstract_type
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.0.7
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.0.7
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: concord
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.1.4
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.1.4
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: bundler
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.6.1
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.6.1
|
78
|
+
description: An HTTP cookie implemented in ruby
|
79
|
+
email:
|
80
|
+
- gamsnjaga@gmail.com
|
81
|
+
executables: []
|
82
|
+
extensions: []
|
83
|
+
extra_rdoc_files:
|
84
|
+
- LICENSE
|
85
|
+
- README.md
|
86
|
+
- TODO.md
|
87
|
+
files:
|
88
|
+
- .gitignore
|
89
|
+
- .rspec
|
90
|
+
- .ruby-gemset
|
91
|
+
- .ruby-version
|
92
|
+
- .travis.yml
|
93
|
+
- CONTRIBUTING.md
|
94
|
+
- Changelog.md
|
95
|
+
- Gemfile
|
96
|
+
- Gemfile.devtools
|
97
|
+
- Guardfile
|
98
|
+
- LICENSE
|
99
|
+
- README.md
|
100
|
+
- Rakefile
|
101
|
+
- TODO.md
|
102
|
+
- config/devtools.yml
|
103
|
+
- config/flay.yml
|
104
|
+
- config/flog.yml
|
105
|
+
- config/mutant.yml
|
106
|
+
- config/reek.yml
|
107
|
+
- config/rubocop.yml
|
108
|
+
- config/yardstick.yml
|
109
|
+
- lib/cookie.rb
|
110
|
+
- lib/cookie/header.rb
|
111
|
+
- lib/cookie/header/attribute.rb
|
112
|
+
- lib/cookie/registry.rb
|
113
|
+
- lib/cookie/version.rb
|
114
|
+
- majoun.gemspec
|
115
|
+
- spec/integration/public_api_spec.rb
|
116
|
+
- spec/spec_helper.rb
|
117
|
+
- spec/unit/cookie/decrypt_spec.rb
|
118
|
+
- spec/unit/cookie/encrypt_spec.rb
|
119
|
+
- spec/unit/cookie/header/attribute/set/each_spec.rb
|
120
|
+
- spec/unit/cookie/header/attribute/set/empty/merge_spec.rb
|
121
|
+
- spec/unit/cookie/header/attribute/set/empty/to_s_spec.rb
|
122
|
+
- spec/unit/cookie/version_spec.rb
|
123
|
+
homepage: https://github.com/snusnu/cookie
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
requirements: []
|
143
|
+
rubyforge_project:
|
144
|
+
rubygems_version: 1.8.23
|
145
|
+
signing_key:
|
146
|
+
specification_version: 3
|
147
|
+
summary: Support for sending and receiving HTTP cookies on ruby servers
|
148
|
+
test_files: []
|
149
|
+
has_rdoc:
|