p3p 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1efe1a6e863dfcfc6f7150b817ac34356565baac
4
- data.tar.gz: a3707c343bcb3148b7c1b4f966ee1ec0930678dd
3
+ metadata.gz: 3fe7161ea20b91f5643bcb51b021b47063e3bba7
4
+ data.tar.gz: b0657f69d032e2a580ccbbe838b5dae81834d135
5
5
  SHA512:
6
- metadata.gz: e72a87707679893d1a54395cdbe7f53c2707e2bdc89d190637da05c3d90c21e046dcde048c18a000a3d66381d28f3eb43fe76814fb4e4a58341901df0ae5b1e3
7
- data.tar.gz: 395a8cc7c2ca967b5f639f60e9ff8e3720db698dc43e00144454f9887260f1c1a33c28017be7fe0caee4814f6cf626a26a8c07961009a6ba9c4512e6b889a0de
6
+ metadata.gz: b47f01017764bee0781788bd79f56a02c769da27428cb3633513d43c4040c31ec356f24938801593306ef6c62560c0a4d26bf120aaae831064c023cefc11a91c
7
+ data.tar.gz: 93d08285e402a4c29cbfba0038a97866df5f92c4122af85855ff5f1896d5f6fe3e123643a2cee3b20683380c704ee6e8e7d39cfab7d9ae0cfe6275a2728b0055
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --order random
3
+ --format documentation
@@ -0,0 +1,18 @@
1
+ script: rspec --order=random --format=documentation --color
2
+ bundler_args: --without development
3
+ env:
4
+ global:
5
+ - JRUBY_OPTS="$JRUBY_OPTS --debug"
6
+ gemfile:
7
+ - Gemfile
8
+ language: ruby
9
+ rvm:
10
+ - 2.2.6
11
+ - 2.3.3
12
+ - 2.4.0
13
+ - ruby-head
14
+ matrix:
15
+ allow_failures:
16
+ - rvm: ruby-head
17
+ fast_finish: true
18
+ sudo: false
data/Gemfile CHANGED
@@ -1,4 +1,12 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in p3p.gemspec
3
+ gem 'rack', '>= 1.6.2'
4
+
5
+ group :test do
6
+ gem 'coveralls', '>= 0.8.19', :require => false
7
+ gem 'rspec', '~> 3.1'
8
+ gem 'simplecov', '>= 0.12.0', :require => false
9
+ gem 'mime-types', '~> 3.1', :platforms => [:jruby, :ruby_18]
10
+ end
11
+
4
12
  gemspec
data/Rakefile CHANGED
@@ -1 +1,7 @@
1
1
  require 'bundler/gem_tasks'
2
+
3
+ desc "Run RSpec with code coverage"
4
+ task :coverage do
5
+ `COVERAGE=true rspec`
6
+ `open coverage/index.html`
7
+ end
@@ -1,4 +1,4 @@
1
1
  # Gem version information
2
2
  module P3P
3
- VERSION = '1.2.0'
3
+ VERSION = '2.0.0'
4
4
  end
@@ -17,6 +17,5 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ['lib']
19
19
 
20
- gem.add_dependency 'rack'
21
- gem.add_development_dependency 'rspec', '~> 3.1.0'
20
+ gem.add_dependency 'rack', '>= 1.6.2'
22
21
  end
@@ -1,33 +1,29 @@
1
1
  require 'spec_helper'
2
2
 
3
- shared_examples 'it returns configured P3P header' do |header, http_verb|
4
- it "should return custom P3P headers in the case of a #{http_verb} request" do
5
- headers = {'Content-Type' => 'text/html'}
6
- app = lambda { |_env| [200, headers, []] }
7
- request = Rack::MockRequest.env_for('/', :lint => true, :fatal => true, :method => http_verb)
8
- response = P3P::Middleware.new(app).call(request)
3
+ describe P3P::Configuration do
4
+ subject { P3P::Configuration.new }
5
+ let(:default_header) { P3P::Configuration::DEFAULT_HEADER }
9
6
 
10
- expect(response[1]).to include('P3P' => header)
7
+ describe '::DEFAULT_HEADER' do
8
+ it 'should contain a default header' do
9
+ expect(default_header).to_not be_nil
10
+ end
11
11
  end
12
- end
13
-
14
- describe P3P do
15
- describe '#configure' do
16
- let(:header) { 'Fake p3p header' }
17
12
 
18
- before do
19
- P3P.configure do |config|
20
- config.header = @header
21
- end
13
+ describe '.initialize' do
14
+ it 'should call set_default_header!' do
15
+ # TODO: Check call over value
16
+ expect(subject.header).to eq default_header
22
17
  end
18
+ end
19
+
20
+ describe '.set_default_header!' do
21
+ it 'should set the default header' do
22
+ subject.header = 'foo'
23
+ expect(subject.header).to eq 'foo'
23
24
 
24
- it_should_behave_like 'it returns configured P3P header', @header, 'GET'
25
- it_should_behave_like 'it returns configured P3P header', @header, 'POST'
26
- it_should_behave_like 'it returns configured P3P header', @header, 'PUT'
27
- it_should_behave_like 'it returns configured P3P header', @header, 'DELETE'
28
- it_should_behave_like 'it returns configured P3P header', @header, 'HEAD'
29
- it_should_behave_like 'it returns configured P3P header', @header, 'OPTIONS'
30
- it_should_behave_like 'it returns configured P3P header', @header, 'TRACE'
31
- it_should_behave_like 'it returns configured P3P header', @header, 'CONNECT'
25
+ subject.set_default_header!
26
+ expect(subject.header).to eq default_header
27
+ end
32
28
  end
33
29
  end
@@ -2,34 +2,22 @@ require 'spec_helper'
2
2
 
3
3
  shared_examples 'it returns P3P headers' do |http_verb|
4
4
  it "should return default P3P headers in the case of a #{http_verb} request" do
5
- headers = {'Content-Type' => 'text/html'}
6
- app = lambda { |_env| [200, headers, []] }
7
- request = Rack::MockRequest.env_for('/', :lint => true, :fatal => true, :method => http_verb)
5
+ p3p_header = Time.now.to_i
6
+ headers = {'Content-Type' => 'text/html'}
7
+ app = lambda { |_env| [200, headers, []] }
8
+ request = Rack::MockRequest.env_for('/', :lint => true, :fatal => true, :method => http_verb)
9
+
10
+ P3P.configure { |c| c.header = p3p_header }
11
+
8
12
  response = P3P::Middleware.new(app).call(request)
9
13
 
10
- expect(response[1]).to include('P3P' => P3P::Configuration::DEFAULT_HEADER)
14
+ expect(response[1]).to include('P3P' => p3p_header)
11
15
  end
12
- end
16
+ end
13
17
 
14
18
  describe P3P::Middleware do
15
- describe '.initialize' do
16
- it 'should set the default header' do
17
- expect_any_instance_of(P3P::Configuration).to receive(:set_default_header!)
18
- P3P.configure { |_config| }
19
- end
20
- end
21
-
22
- describe '.set_default_header!' do
23
- it 'should set the default header' do
24
- header = 'abc123'
25
- default_header = P3P::Configuration::DEFAULT_HEADER
26
-
27
- P3P.configure { |c| c.header = header }
28
- expect(P3P.configuration.header).to eq header
29
-
30
- P3P.configuration.set_default_header!
31
- expect(P3P.configuration.header).to eq default_header
32
- end
19
+ after do
20
+ P3P.configuration.set_default_header!
33
21
  end
34
22
 
35
23
  it_should_behave_like 'it returns P3P headers', 'GET'
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe P3P do
4
+ describe '#configuration' do
5
+ subject { P3P.configuration }
6
+
7
+ it 'should instantiate P3P::Configuration' do
8
+ expect(subject.class).to eq P3P::Configuration
9
+ end
10
+
11
+ it 'should memoize P3P::Configuration' do
12
+ expect(subject).to eq P3P.configuration
13
+ end
14
+ end
15
+
16
+ describe '#configure' do
17
+ it 'should yield :configuration' do
18
+ expect { |b| P3P.configure(&b) }.to yield_control
19
+ end
20
+ end
21
+ end
@@ -1,12 +1,10 @@
1
+ if ENV['COVERAGE']
2
+ require 'simplecov'
3
+ SimpleCov.start
4
+ elsif ENV['CI']
5
+ require 'coveralls'
6
+ Coveralls.wear!
7
+ end
8
+
1
9
  require 'rack'
2
10
  require 'p3p'
3
-
4
- RSpec.configure do |config|
5
- config.color = true
6
- config.formatter = :documentation
7
- config.order = :random
8
-
9
- config.after(:each) do
10
- P3P.configuration.set_default_header!
11
- end
12
- end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: p3p
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Milewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-19 00:00:00.000000000 Z
11
+ date: 2017-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -16,28 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.6.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 3.1.0
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 3.1.0
26
+ version: 1.6.2
41
27
  description: Inserts P3P header
42
28
  email:
43
29
  - tmilewski@gmail.com
@@ -46,7 +32,9 @@ extensions: []
46
32
  extra_rdoc_files: []
47
33
  files:
48
34
  - ".gitignore"
35
+ - ".rspec"
49
36
  - ".rubocop.yml"
37
+ - ".travis.yml"
50
38
  - Gemfile
51
39
  - LICENSE.txt
52
40
  - README.md
@@ -59,6 +47,7 @@ files:
59
47
  - p3p.gemspec
60
48
  - spec/configuration_spec.rb
61
49
  - spec/middleware_spec.rb
50
+ - spec/p3p_spec.rb
62
51
  - spec/spec_helper.rb
63
52
  homepage: https://github.com/tmilewski/p3p
64
53
  licenses: []
@@ -79,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
68
  version: '0'
80
69
  requirements: []
81
70
  rubyforge_project:
82
- rubygems_version: 2.2.2
71
+ rubygems_version: 2.6.10
83
72
  signing_key:
84
73
  specification_version: 4
85
74
  summary: Inserts P3P headers to allow cookies to be utilized in iframe scenarios with
@@ -87,5 +76,5 @@ summary: Inserts P3P headers to allow cookies to be utilized in iframe scenarios
87
76
  test_files:
88
77
  - spec/configuration_spec.rb
89
78
  - spec/middleware_spec.rb
79
+ - spec/p3p_spec.rb
90
80
  - spec/spec_helper.rb
91
- has_rdoc: