grape-cookies 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d5aadf208da77a6089e02ca7839a6e46460ef71b
4
+ data.tar.gz: 2bb093366259687b8790afe2eae5e5895dc0d49a
5
+ SHA512:
6
+ metadata.gz: 3a9098a7224c10965440eaac78f48b11f2e0cb90db2b48b54d65ed244262b4d954cc089df28a83fb47101564a46d723094030e4ecbad3d2f1c85ce7e0ebe3cd9
7
+ data.tar.gz: a6d9621161a89d4056c53e346c4668244b6ff5aa39457bfd508adfe9233c3ddba0fffa384c87e0e40c3596b5f9c33083c1faed075d9e4c2c05c1508522bcabf3
@@ -0,0 +1,3 @@
1
+ # This file is automatically loaded when `bundle console` is run. You can add
2
+ # fixtures and/or initialization code here to make experimenting with your gem
3
+ # easier.
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ .idea/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,21 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+
4
+ LineLength:
5
+ Max: 160
6
+
7
+ Documentation:
8
+ Enabled: false
9
+
10
+ ParameterLists:
11
+ Max: 15
12
+
13
+ MethodLength:
14
+ Max: 50
15
+
16
+ # @see http://www.rubytapas.com/episodes/24-Incidental-Change
17
+ TrailingComma:
18
+ Enabled: false
19
+
20
+ RegexpLiteral:
21
+ Enabled: false
File without changes
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1
5
+ - 2.0
6
+ script: bundle exec rake spec rubocop
7
+ cache: bundler
@@ -0,0 +1,4 @@
1
+ ruby=ruby-2.0.0
2
+ ruby-gemset=gem_grape_cookies
3
+ #ruby-gem-install=bundler rake
4
+ #ruby-bundle-install=true
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in grape-cookies.gemspec
4
+ gemspec
5
+
6
+ gem 'simplecov', require: false, group: :test
7
+ gem 'coveralls', require: false
8
+ gem 'rubocop', require: false
9
+
10
+ gem 'grape', github: 'intridea/grape'
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 FABER Lotto GmbH & Co. KG
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,65 @@
1
+ # Grape::Cookies (Project-State: Proposal)
2
+
3
+ Make Rails cookie handling available for grape. `cookies` method
4
+ will return an `ActionDispatch::Cookies::CookieJar` instead of `Grape::Cookie`.
5
+
6
+
7
+ The following classes will be monkey patched:
8
+
9
+ * `Grape::Endpoint`
10
+ * `Grape::Request`
11
+ * `Grape::Cookies` is deleted if it exists
12
+ * `ActionDispatch::Cookies::CookieJar`
13
+
14
+
15
+
16
+ ## Installation
17
+
18
+ Add this line to your application's Gemfile:
19
+
20
+ gem 'grape-cookies'
21
+
22
+ And then execute:
23
+
24
+ $ bundle
25
+
26
+ Or install it yourself as:
27
+
28
+ $ gem install grape-cookies
29
+
30
+ ## Usage
31
+
32
+ ```ruby
33
+
34
+ # Only needed if you want to use signed cookies
35
+ Grape::Cookies.configure do
36
+ signed_cookie_salt 'signed cookie'
37
+ encrypted_cookie_salt 'encrypted cookie'
38
+ encrypted_signed_cookie_salt 'signed encrypted cookie'
39
+ secret_key_base 'secret base'
40
+ cookies_serializer :json
41
+ end
42
+
43
+ class API < Grape::API
44
+ include Grape::Cookies::Ext::API
45
+
46
+
47
+ get '/test' do
48
+ cookies.signed['test_signed'] = '1234'
49
+ cookies['test_unsigned_signed'] = 'unsigned_1234'
50
+ end
51
+
52
+ end
53
+
54
+ ```
55
+
56
+ When `secret_key_base` is not set and a cookie is signed an `ArgumentError`
57
+ will be thrown.
58
+
59
+ ## Contributing
60
+
61
+ 1. Fork it ( https://github.com/faber-lotto/grape-cookies/fork )
62
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
63
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
64
+ 4. Push to the branch (`git push origin my-new-feature`)
65
+ 5. Create a new Pull Request
@@ -0,0 +1,14 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rubocop/rake_task'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :spec
9
+
10
+ desc 'Run RSpec with code coverage'
11
+ task :coverage do
12
+ ENV['SIMPLE_COVERAGE'] = 'true'
13
+ Rake::Task['spec'].execute
14
+ end
@@ -0,0 +1,51 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'grape/cookies/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'grape-cookies'
8
+ spec.version = Grape::Cookies::VERSION
9
+ spec.authors = ['Dieter Späth']
10
+ spec.email = ['d.spaeth@faber.de']
11
+ spec.summary = 'Adds Rails like cookie support to grape api '
12
+ spec.description = 'Adds Rails like cookie support to grape api '
13
+ spec.homepage = 'https://github.com/faber-lotto/grape-cookies'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_runtime_dependency 'rack', '~> 1.3', '>= 1.3.0'
23
+ spec.add_runtime_dependency 'rack-mount', '~> 0'
24
+ spec.add_runtime_dependency 'rack-accept', '~> 0'
25
+ spec.add_runtime_dependency 'activesupport', '~> 4.1', '>= 4.1.0'
26
+ spec.add_runtime_dependency 'actionpack', '~> 4.1', '>= 4.1.0'
27
+
28
+ spec.add_development_dependency 'grape', '~> 0'
29
+
30
+ spec.add_development_dependency 'bundler', '~> 1.5', '>= 1.5.2'
31
+ spec.add_development_dependency 'rake', '~> 0'
32
+
33
+ spec.add_development_dependency 'rspec'
34
+ # show nicely how many specs have to be run
35
+ spec.add_development_dependency 'fuubar'
36
+ # extended console
37
+ spec.add_development_dependency 'pry'
38
+ spec.add_development_dependency 'pry-remote'
39
+ # https://github.com/pry/pry-stack_explorer
40
+ spec.add_development_dependency 'pry-stack_explorer'
41
+ # https://github.com/deivid-rodriguez/pry-byebug
42
+ # pre-debugger / debugger does not work with ruby 2.x
43
+ spec.add_development_dependency 'pry-byebug'
44
+
45
+ # automatic execute tasks on file changes
46
+ spec.add_development_dependency 'guard'
47
+ spec.add_development_dependency 'guard-rspec'
48
+ spec.add_development_dependency 'guard-bundler'
49
+ spec.add_development_dependency 'rb-fsevent'
50
+
51
+ end
@@ -0,0 +1,50 @@
1
+ require 'grape/cookies/version'
2
+
3
+ require 'rack'
4
+ require 'active_support/concern'
5
+ require 'grape'
6
+ require 'grape/api'
7
+ require 'grape/endpoint'
8
+
9
+ if defined? Grape::Cookies
10
+ warn "[DEPRECATION] your using an older version of `Grape`. Please update your `Grape` version."
11
+ Grape.send(:remove_const, 'Cookies'.to_sym)
12
+ end
13
+
14
+ module Grape
15
+ module Cookies
16
+ require 'grape/cookies/configuration'
17
+ require 'grape/cookies/dsl/configuration'
18
+ require 'grape/cookies/middleware/env_setup'
19
+ require 'grape/cookies/ext/endpoint'
20
+ require 'grape/cookies/ext/request'
21
+ require 'grape/cookies/ext/api'
22
+ require 'grape/cookies/ext/cookie_jar'
23
+
24
+ include Configuration.module(
25
+ :signed_cookie_salt,
26
+ :encrypted_cookie_salt,
27
+ :encrypted_signed_cookie_salt,
28
+ :secret_token,
29
+ :secret_key_base,
30
+ :cookies_serializer
31
+ )
32
+
33
+ # setup defaults
34
+ configure do
35
+ signed_cookie_salt 'signed cookie'
36
+ encrypted_cookie_salt 'encrypted cookie'
37
+ encrypted_signed_cookie_salt 'signed encrypted cookie'
38
+ secret_token 'secret_token'
39
+ secret_key_base nil || ENV['SECRET_KEY_BASE']
40
+ cookies_serializer :json
41
+ end
42
+ end
43
+ end
44
+
45
+ Grape::Endpoint.send(:include, Grape::Cookies::Ext::Endpoint)
46
+ Grape::Request.send(:include, Grape::Cookies::Ext::Request)
47
+
48
+ unless ActionDispatch::Cookies::CookieJar.instance_methods.include? :read
49
+ ActionDispatch::Cookies::CookieJar.send(:include, Grape::Cookies::Ext::CookieJar)
50
+ end
@@ -0,0 +1,98 @@
1
+ module Grape
2
+ module Cookies
3
+ module Configuration
4
+ extend ActiveSupport::Concern
5
+
6
+ class SettingsContainer
7
+ def initialize
8
+ @settings = {}
9
+ end
10
+
11
+ def to_hash
12
+ @settings.to_hash
13
+ end
14
+ end
15
+
16
+ def self.config_class(*args)
17
+ new_config_class = Class.new(SettingsContainer)
18
+
19
+ args.each do |setting_name|
20
+ str = if setting_name.respond_to? :values
21
+ nested_settings_methods(setting_name)
22
+ else
23
+ simple_settings_methods(setting_name)
24
+ end
25
+
26
+ new_config_class.class_eval str
27
+ end
28
+
29
+ new_config_class
30
+ end
31
+
32
+ def self.simple_settings_methods(setting_name)
33
+ <<-EVAL
34
+ def #{setting_name}(new_value)
35
+ @settings[:#{setting_name}] = new_value
36
+ end
37
+ EVAL
38
+ end
39
+
40
+ def self.nested_settings_methods(setting_name)
41
+ StringIO.new.tap do |new_str|
42
+
43
+ setting_name.each_with_object(new_str) do |(key, value), str|
44
+ str.puts <<-EVAL
45
+ def #{key}_context
46
+ @#{key}_context ||= Grape::Cookies::Configuration.config_class(*#{value.inspect}).new
47
+ end
48
+
49
+ def #{key}(&block)
50
+ #{key}_context.instance_exec(&block)
51
+ end
52
+ EVAL
53
+ end
54
+
55
+ new_str.puts <<-EVAL
56
+ def to_hash
57
+ @settings.to_hash.merge(
58
+ #{setting_name.keys.map { |key| "#{key}: #{key}_context.to_hash" }.join(",\n")}
59
+ )
60
+ end
61
+ EVAL
62
+
63
+ end.string
64
+ end
65
+
66
+ def self.module(*args)
67
+ new_module = Module.new do
68
+ extend ActiveSupport::Concern
69
+ include Cookies::DSL::Configuration
70
+ end
71
+
72
+ new_module.tap do |mod|
73
+
74
+ class_mod = create_class_mod(args)
75
+
76
+ mod.const_set(:ClassMethods, class_mod)
77
+
78
+ end
79
+ end
80
+
81
+ def self.create_class_mod(args)
82
+ new_module = Module.new do
83
+ def config_context
84
+ @config_context ||= config_class.new
85
+ end
86
+ end
87
+
88
+ new_module.tap do |class_mod|
89
+ new_config_class = config_class(*args)
90
+
91
+ class_mod.send(:define_method, :config_class) do
92
+ @config_context ||= new_config_class
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,19 @@
1
+ module Grape
2
+ module Cookies
3
+ module DSL
4
+ module Configuration
5
+ extend ActiveSupport::Concern
6
+
7
+ module ClassMethods
8
+ def settings
9
+ config_context.to_hash
10
+ end
11
+
12
+ def configure(&block)
13
+ config_context.instance_exec(&block)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ require 'action_dispatch/middleware/cookies'
2
+ require 'action_dispatch/middleware/session/cookie_store'
3
+ module Grape
4
+ module Cookies
5
+ module Ext
6
+ module API
7
+ extend ActiveSupport::Concern
8
+
9
+ included do
10
+
11
+ use Cookies::Middleware::EnvSetup
12
+ use ActionDispatch::Cookies
13
+
14
+ end
15
+
16
+ module ClassMethods
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ require 'action_dispatch/middleware/cookies'
2
+ module Grape
3
+ module Cookies
4
+ module Ext
5
+ module CookieJar
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+
10
+ end
11
+
12
+ def read(*)
13
+ end
14
+
15
+ module ClassMethods
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,19 @@
1
+ module Grape
2
+ module Cookies
3
+ module Ext
4
+ module Endpoint
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ end
9
+
10
+ def cookies
11
+ request.cookie_jar
12
+ end
13
+
14
+ module ClassMethods
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ require 'action_dispatch/middleware/cookies'
2
+ module Grape
3
+ module Cookies
4
+ module Ext
5
+ module Request
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+
10
+ end
11
+
12
+ def cookie_jar
13
+ env['action_dispatch.cookies'] ||= ActionDispatch::Cookies::CookieJar.build(self)
14
+ end
15
+
16
+ module ClassMethods
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,51 @@
1
+ module Grape
2
+ module Cookies
3
+ module Middleware
4
+ class EnvSetup
5
+
6
+ def self.settings
7
+ Cookies.settings
8
+ end
9
+
10
+ def self.key_generator
11
+ @caching_key_generator ||= begin
12
+ if settings[:secret_key_base].blank?
13
+ raise ArgumentError, 'A secret is required to generate an integrity hash ' \
14
+ 'for cookie session data. Set a secret_key_base.'
15
+ end
16
+
17
+ key_generator = ActiveSupport::KeyGenerator.new(settings[:secret_key_base], iterations: 1000)
18
+ ActiveSupport::CachingKeyGenerator.new(key_generator)
19
+ end
20
+ end
21
+
22
+ def self.settings_for_env
23
+ @settings_for_env ||= {
24
+ ActionDispatch::Cookies::GENERATOR_KEY => key_generator,
25
+ ActionDispatch::Cookies::SIGNED_COOKIE_SALT => settings[:signed_cookie_salt],
26
+ ActionDispatch::Cookies::ENCRYPTED_COOKIE_SALT => settings[:encrypted_cookie_salt],
27
+ ActionDispatch::Cookies::ENCRYPTED_SIGNED_COOKIE_SALT => settings[:encrypted_signed_cookie_salt],
28
+ ActionDispatch::Cookies::SECRET_TOKEN => settings[:secret_token],
29
+ ActionDispatch::Cookies::SECRET_KEY_BASE => settings[:secret_key_base],
30
+ ActionDispatch::Cookies::COOKIES_SERIALIZER => settings[:cookies_serializer]
31
+ }.freeze
32
+ end
33
+
34
+ def self.reset_settings_for_env!
35
+ @caching_key_generator = nil
36
+ @settings_for_env = nil
37
+ end
38
+
39
+ def initialize(app)
40
+ @app = app
41
+ end
42
+
43
+ def call(env)
44
+ env.merge!(self.class.settings_for_env)
45
+
46
+ @app.call(env)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,5 @@
1
+ module Grape
2
+ module Cookies
3
+ VERSION = '0.0.2'
4
+ end
5
+ end
File without changes
@@ -0,0 +1,34 @@
1
+ require 'acceptance_spec_helper'
2
+
3
+ feature 'Create a configuration with an DSL' do
4
+ subject do
5
+ Class.new do
6
+ include Grape::Cookies::Configuration.module(:config1, :config2, config3: [:config4], config5: [config6: [:config7, :config8]])
7
+ end
8
+ end
9
+
10
+ scenario 'Set nested configs' do
11
+ subject.configure do
12
+ config1 'alpha'
13
+ config2 'beta'
14
+
15
+ config3 do
16
+ config4 'gamma'
17
+ end
18
+
19
+ config5 do
20
+ config6 do
21
+ config7 7
22
+ config8 8
23
+ end
24
+ end
25
+ end
26
+
27
+ expect(subject.settings).to eq(config1: 'alpha',
28
+ config2: 'beta',
29
+ config3: { config4: 'gamma' },
30
+ config5: { config6: { config7: 7, config8: 8 } }
31
+ )
32
+ end
33
+
34
+ end
@@ -0,0 +1,98 @@
1
+ require 'acceptance_spec_helper'
2
+ require 'grape'
3
+ require 'rack/test'
4
+
5
+ feature 'Encrypt a cookie' do
6
+ include Rack::Test::Methods
7
+
8
+ let(:app) do
9
+
10
+ Grape::Cookies.configure do
11
+ secret_key_base 'secret base'
12
+ end
13
+
14
+ Class.new(Grape::API) do
15
+ include Grape::Cookies::Ext::API
16
+
17
+ get '/test' do
18
+ cookies.signed['test_signed'] = '1234'
19
+ cookies['test_unsigned_signed'] = 'unsigned_1234'
20
+ end
21
+
22
+ get '/test_unsigned' do
23
+ cookies['test_unsigned_signed'] = 'unsigned_1234'
24
+ end
25
+
26
+ get '/return' do
27
+ {
28
+ cookies: [cookies.signed['test_signed'], cookies['test_unsigned_signed']]
29
+ }
30
+ end
31
+ end
32
+ end
33
+
34
+ let(:hostname) { Rack::Test::DEFAULT_HOST }
35
+ let(:port) { 80 }
36
+ let(:host) { "#{hostname}:#{port}" }
37
+
38
+ let(:response_cookies) { rack_mock_session.cookie_jar }
39
+
40
+ let(:verifier) do
41
+ key_generator = last_request.env[ActionDispatch::Cookies::GENERATOR_KEY]
42
+ signed_cookie_salt = last_request.env[ActionDispatch::Cookies::SIGNED_COOKIE_SALT]
43
+ secret = key_generator.generate_key(signed_cookie_salt)
44
+ ActiveSupport::MessageVerifier.new(secret, serializer: JSON)
45
+ end
46
+
47
+ def https?
48
+ port == 443
49
+ end
50
+
51
+ scenario 'Cookie set signed' do
52
+ get '/test'
53
+
54
+ expect(last_response.status).to eq 200
55
+
56
+ expect(response_cookies['test_signed']).not_to eq '1234'
57
+ expect(verifier.verify(response_cookies['test_signed'])).to eq '1234'
58
+
59
+ expect(response_cookies['test_unsigned_signed']).to eq 'unsigned_1234'
60
+
61
+ end
62
+
63
+ scenario 'Cookie set unsigned' do
64
+ get '/test_unsigned'
65
+
66
+ expect(last_response.status).to eq 200
67
+ expect(response_cookies['test_unsigned_signed']).to eq 'unsigned_1234'
68
+ end
69
+
70
+ scenario 'Get signed cookie' do
71
+ get '/test'
72
+
73
+ memo_unsigned = response_cookies['test_unsigned_signed']
74
+ memo_signed = response_cookies['test_signed']
75
+
76
+ clear_cookies
77
+
78
+ set_cookie "test_unsigned_signed=#{memo_unsigned}"
79
+ set_cookie "test_signed=#{memo_signed}"
80
+
81
+ get '/return'
82
+
83
+ expect(last_response.body).to eq '{:cookies=>["1234", "unsigned_1234"]}'
84
+ end
85
+
86
+ scenario 'Key base not set' do
87
+ app # initial app
88
+
89
+ # delete settings
90
+ Grape::Cookies::Middleware::EnvSetup.reset_settings_for_env!
91
+ Grape::Cookies.configure do
92
+ secret_key_base nil
93
+ end
94
+
95
+
96
+ expect{get '/test'}.to raise_error ArgumentError
97
+ end
98
+ end
File without changes
@@ -0,0 +1,31 @@
1
+ #
2
+ # taken from https://github.com/jnicklas/capybara/blob/master/lib/capybara/rspec/features.rb
3
+ #
4
+ module Capybara
5
+ module Features
6
+ def self.included(base)
7
+ base.instance_eval do
8
+ # rubocop:disable Alias
9
+ alias :background :before
10
+ alias :scenario :it
11
+ alias :xscenario :xit
12
+ alias :given :let
13
+ alias :given! :let!
14
+ alias :feature :describe
15
+ # rubocop:enable Alias
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ def self.feature(*args, &block)
22
+ options = args.last.is_a?(Hash) ? args.pop : {}
23
+ options[:capybara_feature] = true
24
+ options[:type] = :feature
25
+ options[:caller] ||= caller
26
+ args.push(options)
27
+
28
+ describe(*args, &block)
29
+ end
30
+
31
+ RSpec.configuration.include Capybara::Features, capybara_feature: true
@@ -0,0 +1,3 @@
1
+ require 'spec_helper'
2
+
3
+ Dir[File.join(File.expand_path(__dir__), 'acceptance/support/**/*.rb')].each { |f| require f }
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ require 'spec_helper'
2
+
3
+ Dir[File.join(File.expand_path(__dir__), 'integration/support/**/*.rb')].each { |f| require f }
@@ -0,0 +1,45 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ require 'bundler/setup'
4
+ Bundler.require(:development)
5
+
6
+ require 'coveralls'
7
+ Coveralls.wear! unless ENV['SIMPLE_COVERAGE']
8
+
9
+ begin
10
+ if ENV['SIMPLE_COVERAGE']
11
+ require 'simplecov'
12
+ SimpleCov.start do
13
+ add_group 'Lib', 'lib'
14
+
15
+ add_filter '/spec/'
16
+ end
17
+ end
18
+ rescue LoadError
19
+ warn '=' * 80
20
+ warn 'simplecov not installed. No coverage report'
21
+ warn '=' * 80
22
+ end
23
+
24
+ #########################################
25
+ require 'cookies'
26
+ #########################################
27
+
28
+ Dir[File.join(File.expand_path(__dir__), 'support/**/*.rb')].each { |f| require f }
29
+
30
+ # This file was generated by the `rspec --init` command. Conventionally, all
31
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
32
+ # Require this file using `require "spec_helper"` to ensure that it is only
33
+ # loaded once.
34
+ #
35
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
36
+ RSpec.configure do |config|
37
+ config.run_all_when_everything_filtered = true
38
+ config.filter_run :focus
39
+
40
+ # Run specs in random order to surface order dependencies. If you find an
41
+ # order dependency and want to debug it, you can fix the order by providing
42
+ # the seed, which is printed after each run.
43
+ # --seed 1234
44
+ config.order = 'random'
45
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ require 'spec_helper'
2
+
3
+ Dir[File.join(File.expand_path(__dir__), 'unit/support/**/*.rb')].each { |f| require f }
metadata ADDED
@@ -0,0 +1,369 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: grape-cookies
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Dieter Späth
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ - - '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 1.3.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 1.3.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: rack-mount
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rack-accept
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: activesupport
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: '4.1'
68
+ - - '>='
69
+ - !ruby/object:Gem::Version
70
+ version: 4.1.0
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '4.1'
78
+ - - '>='
79
+ - !ruby/object:Gem::Version
80
+ version: 4.1.0
81
+ - !ruby/object:Gem::Dependency
82
+ name: actionpack
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: '4.1'
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: 4.1.0
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ~>
96
+ - !ruby/object:Gem::Version
97
+ version: '4.1'
98
+ - - '>='
99
+ - !ruby/object:Gem::Version
100
+ version: 4.1.0
101
+ - !ruby/object:Gem::Dependency
102
+ name: grape
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ~>
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ type: :development
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ~>
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ - !ruby/object:Gem::Dependency
116
+ name: bundler
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ~>
120
+ - !ruby/object:Gem::Version
121
+ version: '1.5'
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.5.2
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: '1.5'
132
+ - - '>='
133
+ - !ruby/object:Gem::Version
134
+ version: 1.5.2
135
+ - !ruby/object:Gem::Dependency
136
+ name: rake
137
+ requirement: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ type: :development
143
+ prerelease: false
144
+ version_requirements: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ~>
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ - !ruby/object:Gem::Dependency
150
+ name: rspec
151
+ requirement: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ type: :development
157
+ prerelease: false
158
+ version_requirements: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - '>='
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ - !ruby/object:Gem::Dependency
164
+ name: fuubar
165
+ requirement: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - '>='
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ type: :development
171
+ prerelease: false
172
+ version_requirements: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - '>='
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ - !ruby/object:Gem::Dependency
178
+ name: pry
179
+ requirement: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - '>='
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ type: :development
185
+ prerelease: false
186
+ version_requirements: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - '>='
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
191
+ - !ruby/object:Gem::Dependency
192
+ name: pry-remote
193
+ requirement: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ type: :development
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - '>='
203
+ - !ruby/object:Gem::Version
204
+ version: '0'
205
+ - !ruby/object:Gem::Dependency
206
+ name: pry-stack_explorer
207
+ requirement: !ruby/object:Gem::Requirement
208
+ requirements:
209
+ - - '>='
210
+ - !ruby/object:Gem::Version
211
+ version: '0'
212
+ type: :development
213
+ prerelease: false
214
+ version_requirements: !ruby/object:Gem::Requirement
215
+ requirements:
216
+ - - '>='
217
+ - !ruby/object:Gem::Version
218
+ version: '0'
219
+ - !ruby/object:Gem::Dependency
220
+ name: pry-byebug
221
+ requirement: !ruby/object:Gem::Requirement
222
+ requirements:
223
+ - - '>='
224
+ - !ruby/object:Gem::Version
225
+ version: '0'
226
+ type: :development
227
+ prerelease: false
228
+ version_requirements: !ruby/object:Gem::Requirement
229
+ requirements:
230
+ - - '>='
231
+ - !ruby/object:Gem::Version
232
+ version: '0'
233
+ - !ruby/object:Gem::Dependency
234
+ name: guard
235
+ requirement: !ruby/object:Gem::Requirement
236
+ requirements:
237
+ - - '>='
238
+ - !ruby/object:Gem::Version
239
+ version: '0'
240
+ type: :development
241
+ prerelease: false
242
+ version_requirements: !ruby/object:Gem::Requirement
243
+ requirements:
244
+ - - '>='
245
+ - !ruby/object:Gem::Version
246
+ version: '0'
247
+ - !ruby/object:Gem::Dependency
248
+ name: guard-rspec
249
+ requirement: !ruby/object:Gem::Requirement
250
+ requirements:
251
+ - - '>='
252
+ - !ruby/object:Gem::Version
253
+ version: '0'
254
+ type: :development
255
+ prerelease: false
256
+ version_requirements: !ruby/object:Gem::Requirement
257
+ requirements:
258
+ - - '>='
259
+ - !ruby/object:Gem::Version
260
+ version: '0'
261
+ - !ruby/object:Gem::Dependency
262
+ name: guard-bundler
263
+ requirement: !ruby/object:Gem::Requirement
264
+ requirements:
265
+ - - '>='
266
+ - !ruby/object:Gem::Version
267
+ version: '0'
268
+ type: :development
269
+ prerelease: false
270
+ version_requirements: !ruby/object:Gem::Requirement
271
+ requirements:
272
+ - - '>='
273
+ - !ruby/object:Gem::Version
274
+ version: '0'
275
+ - !ruby/object:Gem::Dependency
276
+ name: rb-fsevent
277
+ requirement: !ruby/object:Gem::Requirement
278
+ requirements:
279
+ - - '>='
280
+ - !ruby/object:Gem::Version
281
+ version: '0'
282
+ type: :development
283
+ prerelease: false
284
+ version_requirements: !ruby/object:Gem::Requirement
285
+ requirements:
286
+ - - '>='
287
+ - !ruby/object:Gem::Version
288
+ version: '0'
289
+ description: 'Adds Rails like cookie support to grape api '
290
+ email:
291
+ - d.spaeth@faber.de
292
+ executables: []
293
+ extensions: []
294
+ extra_rdoc_files: []
295
+ files:
296
+ - .consolerc
297
+ - .gitignore
298
+ - .rspec
299
+ - .rubocop.yml
300
+ - .rubocop_todo.yml
301
+ - .travis.yml
302
+ - .versions.conf
303
+ - Gemfile
304
+ - LICENSE.txt
305
+ - README.md
306
+ - Rakefile
307
+ - grape_cookies.gemspec
308
+ - lib/cookies.rb
309
+ - lib/grape/cookies/configuration.rb
310
+ - lib/grape/cookies/dsl/configuration.rb
311
+ - lib/grape/cookies/ext/api.rb
312
+ - lib/grape/cookies/ext/cookie_jar.rb
313
+ - lib/grape/cookies/ext/endpoint.rb
314
+ - lib/grape/cookies/ext/request.rb
315
+ - lib/grape/cookies/middleware/env_setup.rb
316
+ - lib/grape/cookies/version.rb
317
+ - spec/acceptance/.gitkeep
318
+ - spec/acceptance/configuration_spec.rb
319
+ - spec/acceptance/cookie_spec.rb
320
+ - spec/acceptance/support/.keep
321
+ - spec/acceptance/support/feature.rb
322
+ - spec/acceptance_spec_helper.rb
323
+ - spec/integration/.gitkeep
324
+ - spec/integration/support/.keep
325
+ - spec/integration_spec_helper.rb
326
+ - spec/spec_helper.rb
327
+ - spec/support/.gitkeep
328
+ - spec/unit/.gitkeep
329
+ - spec/unit/support/.keep
330
+ - spec/unit_spec_helper.rb
331
+ homepage: https://github.com/faber-lotto/grape-cookies
332
+ licenses:
333
+ - MIT
334
+ metadata: {}
335
+ post_install_message:
336
+ rdoc_options: []
337
+ require_paths:
338
+ - lib
339
+ required_ruby_version: !ruby/object:Gem::Requirement
340
+ requirements:
341
+ - - '>='
342
+ - !ruby/object:Gem::Version
343
+ version: '0'
344
+ required_rubygems_version: !ruby/object:Gem::Requirement
345
+ requirements:
346
+ - - '>='
347
+ - !ruby/object:Gem::Version
348
+ version: '0'
349
+ requirements: []
350
+ rubyforge_project:
351
+ rubygems_version: 2.2.2
352
+ signing_key:
353
+ specification_version: 4
354
+ summary: Adds Rails like cookie support to grape api
355
+ test_files:
356
+ - spec/acceptance/.gitkeep
357
+ - spec/acceptance/configuration_spec.rb
358
+ - spec/acceptance/cookie_spec.rb
359
+ - spec/acceptance/support/.keep
360
+ - spec/acceptance/support/feature.rb
361
+ - spec/acceptance_spec_helper.rb
362
+ - spec/integration/.gitkeep
363
+ - spec/integration/support/.keep
364
+ - spec/integration_spec_helper.rb
365
+ - spec/spec_helper.rb
366
+ - spec/support/.gitkeep
367
+ - spec/unit/.gitkeep
368
+ - spec/unit/support/.keep
369
+ - spec/unit_spec_helper.rb