flip_fab 1.0.2 → 1.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +5 -5
  2. data/.github/dependabot.yml +18 -0
  3. data/.github/workflows/dobby-actions.yml +29 -0
  4. data/.github/workflows/gem-publish.yml +46 -0
  5. data/.github/workflows/version-forget-me-not.yml +19 -0
  6. data/.rubocop.yml +2 -0
  7. data/.rubocop_todo.yml +58 -0
  8. data/.ruby-version +1 -0
  9. data/.semaphore/semaphore.yml +49 -0
  10. data/CODEOWNERS +3 -0
  11. data/README.md +8 -2
  12. data/_pipeline/step_build_gem.sh +5 -0
  13. data/_pipeline/step_test_gem.sh +6 -0
  14. data/catalog-info.yaml +8 -0
  15. data/example/rails_app/Rakefile +1 -1
  16. data/example/rails_app/app/assets/config/manifest.js +3 -0
  17. data/example/rails_app/app/controllers/beavers_controller.rb +1 -1
  18. data/example/rails_app/bin/bundle +1 -1
  19. data/example/rails_app/bin/rails +1 -1
  20. data/example/rails_app/config/application.rb +2 -2
  21. data/example/rails_app/config/boot.rb +1 -1
  22. data/example/rails_app/config/environment.rb +1 -1
  23. data/example/rails_app/config.ru +1 -1
  24. data/example/rails_app/db/schema.rb +0 -1
  25. data/example/rails_app/spec/rails_helper.rb +1 -1
  26. data/example/rails_app/test/test_helper.rb +1 -1
  27. data/flip_fab.gemspec +5 -6
  28. data/lib/flip_fab/contextual_feature.rb +12 -2
  29. data/lib/flip_fab/cookie_persistence.rb +3 -5
  30. data/lib/flip_fab/features_by_name.rb +1 -0
  31. data/lib/flip_fab/version.rb +6 -1
  32. data/lib/flip_fab.rb +1 -1
  33. data/spec/lib/flip_fab/contextual_feature_spec.rb +7 -1
  34. data/spec/lib/flip_fab/cookie_persistence.feature +3 -3
  35. data/spec/lib/flip_fab/cookie_persistence_spec.rb +4 -8
  36. metadata +31 -22
  37. data/example/rails_app/Gemfile.lock +0 -168
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 41ce116c1d345217c1e9b1eb22afb50ae36cf0b5
4
- data.tar.gz: 30446aedb0dab73151be9b4bb1744b9dbad8d15e
2
+ SHA256:
3
+ metadata.gz: f7f880a207dde1105f807623c68b6f3911883cab9f930760b33b372addc7aa5c
4
+ data.tar.gz: 38824c24a924aab3f4bd486c3595e83a98630420a300afc89d1f554e38c4d930
5
5
  SHA512:
6
- metadata.gz: f39f8b192ab5a888ef29d325ee94de4eb88f86a78b09b76ef872a61e3895ff1018ce1223185cb8cd53df92edfb34823ed05106ca2b2792f23b15ea334a21a26f
7
- data.tar.gz: 8758cb9740f64f0abe4035ef0048c000e9e671fc88ea52cf36f81b37ff03f09948c21e77f80f71e23dc1952c03e0c9d759e9ca8ebf3846f01843ec0734f67e19
6
+ metadata.gz: 6854f1e7fab3aa484661e0228808e40f04a5cc39be460d1d543c44ee828aa4aba01aea6338c27c1f96749a563483d20a2d8bc71c5f22c7388af385a4e7dc26fa
7
+ data.tar.gz: 610b9b7ae75eaafbc3bcc02076fc4bb519d08727cc75909a93f9d51cd0ea1a0ffe03a93a870fa2be1d4bdadad1fa1c1d7c74f0883c7c9f38072c8a04451d4344
@@ -0,0 +1,18 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "07:00"
8
+ open-pull-requests-limit: 99
9
+ labels:
10
+ - dependencies
11
+ - package-ecosystem: github-actions
12
+ directory: "/"
13
+ schedule:
14
+ interval: daily
15
+ time: "07:00"
16
+ open-pull-requests-limit: 99
17
+ labels:
18
+ - dependencies
@@ -0,0 +1,29 @@
1
+
2
+ name: "Dobby action"
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ permissions:
7
+ contents: read
8
+ jobs:
9
+ pr_commented:
10
+ runs-on: ubuntu-20.04
11
+ if: startsWith(github.event.comment.body, '/dobby')
12
+ env:
13
+ BUNDLE_WITHOUT: "development:test"
14
+ steps:
15
+ - name: Chekcout action
16
+ uses: actions/checkout@v3
17
+ with:
18
+ repository: 'simplybusiness/dobby'
19
+ ref: 'v3.0.1'
20
+ - name: Set up ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ bundler-cache: true
24
+ - name: Bump version
25
+ uses: simplybusiness/dobby@v3.0.1
26
+ env:
27
+ DOBBY_APP_ID: ${{ secrets.DOBBY_APP_ID }}
28
+ DOBBY_PRIVATE_KEY: ${{ secrets.DOBBY_PRIVATE_KEY }}
29
+ VERSION_FILE_PATH: lib/flip_fab/version.rb
@@ -0,0 +1,46 @@
1
+ name: Publish Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+
7
+ permissions:
8
+ contents: write
9
+
10
+ jobs:
11
+ build:
12
+ name: Build and Publish
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+ - name: Set up Ruby
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ bundler-cache: true
20
+ - name: Publish to RubyGems
21
+ run: |
22
+ mkdir -p $HOME/.gem
23
+ touch $HOME/.gem/credentials
24
+ chmod 0600 $HOME/.gem/credentials
25
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
26
+ gem build *.gemspec
27
+ gem push *.gem
28
+ env:
29
+ GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
30
+ - name: Get Gem Version
31
+ id: get-gem-version
32
+ run: echo "::set-output name=GEM_VERSION::$(bundle exec ruby -e 'puts FlipFab::VERSION')"
33
+ - name: Create Release
34
+ uses: actions/github-script@v6
35
+ env:
36
+ GEM_VERSION: ${{ steps.get-gem-version.outputs.GEM_VERSION }}
37
+ with:
38
+ result-encoding: string
39
+ script: |
40
+ const { GEM_VERSION } = process.env
41
+ github.rest.repos.createRelease({
42
+ owner: context.repo.owner,
43
+ repo: context.repo.repo,
44
+ tag_name: GEM_VERSION,
45
+ generate_release_notes: true,
46
+ })
@@ -0,0 +1,19 @@
1
+ name: Check version
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - master
7
+ types: [opened, synchronize]
8
+ permissions:
9
+ contents: read
10
+ statuses: write
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-18.04
14
+
15
+ steps:
16
+ - uses: simplybusiness/version-forget-me-not@v2.3.0
17
+ env:
18
+ ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19
+ VERSION_FILE_PATH: "lib/flip_fab/version.rb"
data/.rubocop.yml CHANGED
@@ -1,3 +1,5 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  AllCops:
2
4
  DisplayCopNames: true
3
5
  DisplayStyleGuide: true
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,58 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2021-11-22 12:55:16 UTC using RuboCop version 1.12.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
13
+ Exclude:
14
+ - 'flip_fab.gemspec'
15
+
16
+ # Offense count: 3
17
+ # Cop supports --auto-correct.
18
+ # Configuration parameters: AllowComments.
19
+ Lint/UselessMethodDefinition:
20
+ Exclude:
21
+ - 'lib/flip_fab/cookie_persistence.rb'
22
+ - 'spec/support/test_multiple_persistence.rb'
23
+ - 'spec/support/test_persistence.rb'
24
+
25
+ # Offense count: 13
26
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
27
+ # IgnoredMethods: refine
28
+ Metrics/BlockLength:
29
+ Max: 262
30
+
31
+ # Offense count: 58
32
+ # Cop supports --auto-correct.
33
+ # Configuration parameters: EnforcedStyle.
34
+ # SupportedStyles: always, always_true, never
35
+ Style/FrozenStringLiteralComment:
36
+ Enabled: false
37
+
38
+ # Offense count: 1
39
+ # Cop supports --auto-correct.
40
+ Style/HashTransformValues:
41
+ Exclude:
42
+ - 'lib/flip_fab/features_by_name.rb'
43
+
44
+ # Offense count: 1
45
+ # Cop supports --auto-correct.
46
+ # Configuration parameters: EnforcedStyle.
47
+ # SupportedStyles: literals, strict
48
+ Style/MutableConstant:
49
+ Exclude:
50
+ - 'lib/flip_fab/cookie_persistence.rb'
51
+
52
+ # Offense count: 1
53
+ # Cop supports --auto-correct.
54
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
55
+ # AllowedMethods: present?, blank?, presence, try, try!
56
+ Style/SafeNavigation:
57
+ Exclude:
58
+ - 'lib/flip_fab/cookie_persistence.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.0.4
@@ -0,0 +1,49 @@
1
+ version: v1.0
2
+ name: Semaphore v2 tests
3
+ agent:
4
+ machine:
5
+ type: e1-standard-2
6
+ os_image: ubuntu2004
7
+ auto_cancel:
8
+ running:
9
+ when: branch != 'master'
10
+ global_job_config:
11
+ prologue:
12
+ commands:
13
+ - checkout
14
+ - sem-version ruby $RUBY_VERSION -f
15
+ - gem update --system
16
+ - bundle config set --local path 'vendor/bundle'
17
+ - cache restore bundle-$RUBY_VERSION-$SEMAPHORE_GIT_BRANCH-$SEMAPHORE_WORKFLOW_ID,bundle-$RUBY_VERSION-$SEMAPHORE_GIT_BRANCH,bundle-$RUBY_VERSION-master
18
+ - bundle install
19
+ - bundle clean --force
20
+ - cache store bundle-$RUBY_VERSION-$SEMAPHORE_GIT_BRANCH-$SEMAPHORE_WORKFLOW_ID vendor/bundle
21
+ secrets:
22
+ - name: bundler-global
23
+ blocks:
24
+ - name: Semaphore v2 tests
25
+ dependencies: []
26
+ execution_time_limit:
27
+ minutes: 30
28
+ task:
29
+ jobs:
30
+ - name: Tests
31
+ matrix:
32
+ - env_var: RUBY_VERSION
33
+ values: ["2.7", "3.0"]
34
+ commands:
35
+ - bundle exec rspec
36
+ - name: Semaphore v2 Compliance
37
+ dependencies: []
38
+ skip:
39
+ when: branch = 'master'
40
+ execution_time_limit:
41
+ minutes: 10
42
+ task:
43
+ jobs:
44
+ - name: Rubocop
45
+ commands:
46
+ - bundle exec rubocop
47
+ env_vars:
48
+ - name: RUBY_VERSION
49
+ value: 2.6.5
data/CODEOWNERS ADDED
@@ -0,0 +1,3 @@
1
+ # Add your project owners info here
2
+ # More information: https://help.github.com/articles/about-codeowners/
3
+ * @simplybusiness/alchemists
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- Flip Fab
2
- --------
1
+ # Flip Fab
3
2
 
4
3
  **Feature flipping... Made FaBuLoUs!**
5
4
 
@@ -166,3 +165,10 @@ Perform the following to try the example:
166
165
  1. Start rails: `bundle exec rails s`
167
166
  1. View the page with the feature disabled: `open 'http://localhost:3000/beavers?justin_beaver=disabled'`
168
167
  1. View the page with the feature enabled: `open 'http://localhost:3000/beavers?justin_beaver=enabled'`
168
+
169
+ ## Contributing
170
+
171
+ 1. Make your changes in a branch
172
+ 1. Update the version using semantic versioning in `lib/flip_fab/version.rb`
173
+ 1. Once signed off, merge
174
+ 1. The gem will automatically be pushed to gemstash
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ source "/opt/sb/sb-pipeline.sh"
3
+ set -e
4
+
5
+ gem_deploy flip_fab.gemspec
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+ source "/opt/sb/sb-pipeline.sh"
3
+ set -e
4
+
5
+ bundle install
6
+ bundle exec rspec
data/catalog-info.yaml ADDED
@@ -0,0 +1,8 @@
1
+ apiVersion: backstage.io/v1alpha1
2
+ kind: Component
3
+ metadata:
4
+ name: flip_fab
5
+ description: A gem providing persistent, per-user feature flipping to Rack applications
6
+ spec:
7
+ type: library
8
+ lifecycle: production
@@ -1,6 +1,6 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require File.expand_path('../config/application', __FILE__)
4
+ require File.expand_path('config/application', __dir__)
5
5
 
6
6
  Rails.application.load_tasks
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
@@ -1,5 +1,5 @@
1
1
  class BeaversController < ApplicationController
2
- before_action :set_beaver, only: [:show, :edit, :update, :destroy]
2
+ before_action :set_beaver, only: %i[show edit update destroy]
3
3
 
4
4
  # GET /beavers
5
5
  # GET /beavers.json
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
3
  load Gem.bin_path('bundler', 'bundle')
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
3
  require_relative '../config/boot'
4
4
  require 'rails/commands'
@@ -1,4 +1,4 @@
1
- require File.expand_path('../boot', __FILE__)
1
+ require File.expand_path('boot', __dir__)
2
2
 
3
3
  require 'rails/all'
4
4
 
@@ -20,6 +20,6 @@ module RailsApp
20
20
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
21
  # config.i18n.default_locale = :de
22
22
 
23
- config.eager_load_paths += %W(#{config.root}/lib)
23
+ config.eager_load_paths += %W[#{config.root}/lib]
24
24
  end
25
25
  end
@@ -1,4 +1,4 @@
1
1
  # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
3
 
4
4
  require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
@@ -1,5 +1,5 @@
1
1
  # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
2
+ require File.expand_path('application', __dir__)
3
3
 
4
4
  # Initialize the Rails application.
5
5
  Rails.application.initialize!
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path('config/environment', __dir__)
4
4
  run Rails.application
@@ -1,4 +1,3 @@
1
- # encoding: UTF-8
2
1
  # This file is auto-generated from the current state of the database. Instead
3
2
  # of editing this file, please use the migrations feature of Active Record to
4
3
  # incrementally modify your database, and then regenerate this schema definition.
@@ -1,7 +1,7 @@
1
1
  # This file is copied to spec/ when you run 'rails generate rspec:install'
2
2
  ENV['RAILS_ENV'] ||= 'test'
3
3
  require 'spec_helper'
4
- require File.expand_path('../../config/environment', __FILE__)
4
+ require File.expand_path('../config/environment', __dir__)
5
5
  require 'rspec/rails'
6
6
  # Add additional requires below this line. Rails is not loaded until this point!
7
7
 
@@ -1,5 +1,5 @@
1
1
  ENV['RAILS_ENV'] ||= 'test'
2
- require File.expand_path('../../config/environment', __FILE__)
2
+ require File.expand_path('../config/environment', __dir__)
3
3
  require 'rails/test_help'
4
4
 
5
5
  class ActiveSupport::TestCase
data/flip_fab.gemspec CHANGED
@@ -1,5 +1,4 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'flip_fab/version'
5
4
 
@@ -18,10 +17,10 @@ Gem::Specification.new do |spec|
18
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
18
  spec.require_paths = ['lib']
20
19
 
21
- spec.add_development_dependency 'rack', '~> 2.0'
22
- spec.add_development_dependency 'rack-test', '~> 0.6'
20
+ spec.add_development_dependency 'rack', '>=2.1.1'
21
+ spec.add_development_dependency 'rack-test'
23
22
  spec.add_development_dependency 'rspec', '~> 3.5'
24
- spec.add_development_dependency 'rutabaga', '~> 2.1'
23
+ spec.add_development_dependency 'rutabaga', '~> 3.0'
24
+ spec.add_development_dependency 'simplycop', '~> 1.9'
25
25
  spec.add_development_dependency 'timecop', '~> 0.8'
26
- spec.add_development_dependency 'rubocop', '~> 0.46'
27
26
  end
@@ -6,10 +6,17 @@ module FlipFab
6
6
  @feature = feature
7
7
  @context = context
8
8
  return unless overridden?
9
+
9
10
  @state = override
10
11
  persist
11
12
  end
12
13
 
14
+ def as_json(options = {})
15
+ {
16
+ 'feature' => feature.as_json(options)
17
+ }
18
+ end
19
+
13
20
  def enabled?
14
21
  state == :enabled
15
22
  end
@@ -27,8 +34,9 @@ module FlipFab
27
34
  end
28
35
 
29
36
  def state=(value)
30
- raise "Invalid state provided: `#{value}`, possible states are :enabled, :disabled" unless %i(enabled disabled).include? value
37
+ raise "Invalid state provided: `#{value}`, possible states are :enabled, :disabled" unless %i[enabled disabled].include? value
31
38
  return if overridden?
39
+
32
40
  @state = value
33
41
  persist
34
42
  end
@@ -65,8 +73,10 @@ module FlipFab
65
73
 
66
74
  def override
67
75
  return unless context.respond_to? :params
76
+
68
77
  override = context.params[feature.name.to_s]
69
- return unless %w(enabled disabled).include? override
78
+ return unless %w[enabled disabled].include? override
79
+
70
80
  override.to_sym
71
81
  end
72
82
 
@@ -14,11 +14,9 @@ module FlipFab
14
14
  end
15
15
 
16
16
  def write(state)
17
- cookie_domain = ".#{top_level_domain}" unless top_level_domain.nil?
18
- context.response.set_cookie key, value: state,
17
+ context.response.set_cookie key, value: state,
19
18
  expires: cookie_expiration,
20
- domain: cookie_domain,
21
- path: COOKIE_PATH
19
+ path: COOKIE_PATH
22
20
  end
23
21
 
24
22
  private
@@ -33,7 +31,7 @@ module FlipFab
33
31
 
34
32
  # See: https://github.com/rails/rails/blob/b1124a2ac88778c0feb0157ac09367cbd204bf01/actionpack/lib/action_dispatch/middleware/cookies.rb#L286-L294
35
33
  def top_level_domain
36
- $& if (host !~ /^[\d.]+$/) && (host =~ DOMAIN_REGEXP)
34
+ Regexp.last_match(0) if (host !~ /^[\d.]+$/) && (host =~ DOMAIN_REGEXP)
37
35
  end
38
36
 
39
37
  def cookie_expiration
@@ -10,6 +10,7 @@ module FlipFab
10
10
 
11
11
  def [](name)
12
12
  raise "no feature has been defined with the name: #{name}" if @features_by_name[name].nil?
13
+
13
14
  @features_by_name[name]
14
15
  end
15
16
 
@@ -1,3 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FlipFab
2
- VERSION = '1.0.2'.freeze
4
+ base = '1.0.16'
5
+
6
+ # SB-specific versioning "algorithm" to accommodate BNW/Jenkins/gemstash
7
+ VERSION = (pre = ENV.fetch('GEM_PRE_RELEASE', '')).empty? ? base : "#{base}.#{pre}"
3
8
  end
data/lib/flip_fab.rb CHANGED
@@ -19,6 +19,6 @@ module FlipFab
19
19
  end
20
20
 
21
21
  if defined?(ActionController)
22
- ActionController::Base.send :include, FlipFab::Helper
22
+ ActionController::Base.include FlipFab::Helper
23
23
  ActionController::Base.helper FlipFab::Helper
24
24
  end
@@ -1,5 +1,5 @@
1
1
  module FlipFab
2
- describe ContextualFeature do
2
+ describe ContextualFeature do # rubocop:disable Metrics/BlockLength
3
3
  let(:override) {}
4
4
  let(:default) { :disabled }
5
5
  let(:persistence_adapters) { [TestPersistence] }
@@ -8,6 +8,12 @@ module FlipFab
8
8
  let(:context) { TestContext.new feature_states, 'example_feature' => override }
9
9
  subject { described_class.new feature, context }
10
10
 
11
+ describe '.as_json' do
12
+ it 'returns only the feature' do
13
+ expect(subject.as_json.keys).to eq(['feature'])
14
+ end
15
+ end
16
+
11
17
  describe '.new' do
12
18
  it 'assigns the feature' do
13
19
  expect(subject.feature).to eq(feature)
@@ -10,10 +10,10 @@ Feature: Persisting the feature state in a cookie
10
10
  When I persist the feature state in a cookie
11
11
  Then the cookie has the path '/'
12
12
 
13
- Scenario Outline: The cookie should apply for all domains under the top-level domain (no domain for localhost or IP addresses, however)
13
+ Scenario Outline: The cookie populated should not contain domain
14
14
  Given the host is '<host>'
15
15
  When I persist the feature state in a cookie
16
- Then the cookie has the domain '<cookie domain>'
16
+ Then the cookie does not have domain '<cookie domain>'
17
17
 
18
18
  Examples:
19
19
  | host | cookie domain |
@@ -37,7 +37,7 @@ Feature: Persisting the feature state in a cookie
37
37
 
38
38
  Scenario: The cookie should expire after 1 year
39
39
  When I persist the feature state in a cookie
40
- Then the cookie expires at 'Fri, 22 Jan 2016 15:26:31 -0000'
40
+ Then the cookie expires at 'Fri, 22 Jan 2016 15:26:31 GMT'
41
41
 
42
42
  Scenario Outline: The cookie's value should be the state of the feature
43
43
  Given the state of the feature is '<feature state>'
@@ -36,12 +36,8 @@ module FlipFab
36
36
  expect(@cookie).to match(/path=#{path};/)
37
37
  end
38
38
 
39
- step 'the cookie has the domain :domain' do |domain|
40
- if domain == ''
41
- expect(@cookie).not_to match(/domain/)
42
- else
43
- expect(@cookie).to match(/domain=#{domain};/)
44
- end
39
+ step 'the cookie does not have domain :domain' do |domain|
40
+ expect(@cookie).not_to match(/domain=#{domain};/)
45
41
  end
46
42
 
47
43
  step 'the cookie has the name :name' do |name|
@@ -53,7 +49,7 @@ module FlipFab
53
49
  end
54
50
 
55
51
  step 'the cookie value is :value' do |value|
56
- expect(@cookie).to match(/\=#{value};/)
52
+ expect(@cookie).to match(/=#{value};/)
57
53
  end
58
54
  end
59
55
 
@@ -80,7 +76,7 @@ module FlipFab
80
76
  after { Timecop.return }
81
77
 
82
78
  it 'saves the feature state' do
83
- expect { subject.write :enabled }.to change { context.response_cookies }.from(nil).to('flip_fab.example_feature=enabled; domain=.simplybusiness.co.uk; path=/; expires=Tue, 01 Jan 1991 00:00:00 -0000')
79
+ expect { subject.write :enabled }.to change { context.response_cookies }.from(nil).to('flip_fab.example_feature=enabled; path=/; expires=Tue, 01 Jan 1991 00:00:00 GMT')
84
80
  end
85
81
  end
86
82
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flip_fab
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simply Business
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-29 00:00:00.000000000 Z
11
+ date: 2022-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: 2.1.1
20
20
  type: :development
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: '2.0'
26
+ version: 2.1.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rack-test
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.6'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0.6'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,42 +58,42 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.1'
61
+ version: '3.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.1'
68
+ version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: timecop
70
+ name: simplycop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.8'
75
+ version: '1.9'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.8'
82
+ version: '1.9'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rubocop
84
+ name: timecop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.46'
89
+ version: '0.8'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.46'
96
+ version: '0.8'
97
97
  description: A gem providing persistent, per-user feature flipping to Rack applications.
98
98
  email:
99
99
  - tech@simplybusiness.co.uk
@@ -101,16 +101,27 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - ".github/dependabot.yml"
105
+ - ".github/workflows/dobby-actions.yml"
106
+ - ".github/workflows/gem-publish.yml"
107
+ - ".github/workflows/version-forget-me-not.yml"
104
108
  - ".gitignore"
105
109
  - ".rspec"
106
110
  - ".rubocop.yml"
111
+ - ".rubocop_todo.yml"
112
+ - ".ruby-version"
113
+ - ".semaphore/semaphore.yml"
114
+ - CODEOWNERS
107
115
  - Gemfile
108
116
  - LICENSE.txt
109
117
  - README.md
118
+ - _pipeline/step_build_gem.sh
119
+ - _pipeline/step_test_gem.sh
120
+ - catalog-info.yaml
110
121
  - example/rails_app/.gitignore
111
122
  - example/rails_app/Gemfile
112
- - example/rails_app/Gemfile.lock
113
123
  - example/rails_app/Rakefile
124
+ - example/rails_app/app/assets/config/manifest.js
114
125
  - example/rails_app/app/assets/images/.keep
115
126
  - example/rails_app/app/assets/images/justin_beaver.jpg
116
127
  - example/rails_app/app/assets/images/regular_beaver.jpg
@@ -226,8 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
237
  - !ruby/object:Gem::Version
227
238
  version: '0'
228
239
  requirements: []
229
- rubyforge_project:
230
- rubygems_version: 2.4.5.1
240
+ rubygems_version: 3.2.33
231
241
  signing_key:
232
242
  specification_version: 4
233
243
  summary: A gem providing persistent, per-user feature flipping to Rack applications.
@@ -248,4 +258,3 @@ test_files:
248
258
  - spec/support/test_multiple_persistence.rb
249
259
  - spec/support/test_persistence.rb
250
260
  - spec/support/test_rack_context.rb
251
- has_rdoc:
@@ -1,168 +0,0 @@
1
- PATH
2
- remote: ../../
3
- specs:
4
- flip_fab (1.0.2)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- actioncable (5.0.1)
10
- actionpack (= 5.0.1)
11
- nio4r (~> 1.2)
12
- websocket-driver (~> 0.6.1)
13
- actionmailer (5.0.1)
14
- actionpack (= 5.0.1)
15
- actionview (= 5.0.1)
16
- activejob (= 5.0.1)
17
- mail (~> 2.5, >= 2.5.4)
18
- rails-dom-testing (~> 2.0)
19
- actionpack (5.0.1)
20
- actionview (= 5.0.1)
21
- activesupport (= 5.0.1)
22
- rack (~> 2.0)
23
- rack-test (~> 0.6.3)
24
- rails-dom-testing (~> 2.0)
25
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
26
- actionview (5.0.1)
27
- activesupport (= 5.0.1)
28
- builder (~> 3.1)
29
- erubis (~> 2.7.0)
30
- rails-dom-testing (~> 2.0)
31
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
32
- activejob (5.0.1)
33
- activesupport (= 5.0.1)
34
- globalid (>= 0.3.6)
35
- activemodel (5.0.1)
36
- activesupport (= 5.0.1)
37
- activerecord (5.0.1)
38
- activemodel (= 5.0.1)
39
- activesupport (= 5.0.1)
40
- arel (~> 7.0)
41
- activesupport (5.0.1)
42
- concurrent-ruby (~> 1.0, >= 1.0.2)
43
- i18n (~> 0.7)
44
- minitest (~> 5.1)
45
- tzinfo (~> 1.1)
46
- arel (7.1.4)
47
- builder (3.2.2)
48
- coffee-rails (4.2.1)
49
- coffee-script (>= 2.2.0)
50
- railties (>= 4.0.0, < 5.2.x)
51
- coffee-script (2.4.1)
52
- coffee-script-source
53
- execjs
54
- coffee-script-source (1.12.2)
55
- concurrent-ruby (1.0.4)
56
- diff-lcs (1.2.5)
57
- erubis (2.7.0)
58
- execjs (2.7.0)
59
- globalid (0.3.7)
60
- activesupport (>= 4.1.0)
61
- i18n (0.7.0)
62
- jquery-rails (4.2.2)
63
- rails-dom-testing (>= 1, < 3)
64
- railties (>= 4.2.0)
65
- thor (>= 0.14, < 2.0)
66
- loofah (2.0.3)
67
- nokogiri (>= 1.5.9)
68
- mail (2.6.4)
69
- mime-types (>= 1.16, < 4)
70
- method_source (0.8.2)
71
- mime-types (3.1)
72
- mime-types-data (~> 3.2015)
73
- mime-types-data (3.2016.0521)
74
- mini_portile2 (2.1.0)
75
- minitest (5.10.1)
76
- nio4r (1.2.1)
77
- nokogiri (1.7.0)
78
- mini_portile2 (~> 2.1.0)
79
- rack (2.0.1)
80
- rack-test (0.6.3)
81
- rack (>= 1.0)
82
- rails (5.0.1)
83
- actioncable (= 5.0.1)
84
- actionmailer (= 5.0.1)
85
- actionpack (= 5.0.1)
86
- actionview (= 5.0.1)
87
- activejob (= 5.0.1)
88
- activemodel (= 5.0.1)
89
- activerecord (= 5.0.1)
90
- activesupport (= 5.0.1)
91
- bundler (>= 1.3.0, < 2.0)
92
- railties (= 5.0.1)
93
- sprockets-rails (>= 2.0.0)
94
- rails-controller-testing (1.0.1)
95
- actionpack (~> 5.x)
96
- actionview (~> 5.x)
97
- activesupport (~> 5.x)
98
- rails-dom-testing (2.0.2)
99
- activesupport (>= 4.2.0, < 6.0)
100
- nokogiri (~> 1.6)
101
- rails-html-sanitizer (1.0.3)
102
- loofah (~> 2.0)
103
- railties (5.0.1)
104
- actionpack (= 5.0.1)
105
- activesupport (= 5.0.1)
106
- method_source
107
- rake (>= 0.8.7)
108
- thor (>= 0.18.1, < 2.0)
109
- rake (12.0.0)
110
- rspec-core (3.5.4)
111
- rspec-support (~> 3.5.0)
112
- rspec-expectations (3.5.0)
113
- diff-lcs (>= 1.2.0, < 2.0)
114
- rspec-support (~> 3.5.0)
115
- rspec-mocks (3.5.0)
116
- diff-lcs (>= 1.2.0, < 2.0)
117
- rspec-support (~> 3.5.0)
118
- rspec-rails (3.5.2)
119
- actionpack (>= 3.0)
120
- activesupport (>= 3.0)
121
- railties (>= 3.0)
122
- rspec-core (~> 3.5.0)
123
- rspec-expectations (~> 3.5.0)
124
- rspec-mocks (~> 3.5.0)
125
- rspec-support (~> 3.5.0)
126
- rspec-support (3.5.0)
127
- sass (3.4.23)
128
- sass-rails (5.0.6)
129
- railties (>= 4.0.0, < 6)
130
- sass (~> 3.1)
131
- sprockets (>= 2.8, < 4.0)
132
- sprockets-rails (>= 2.0, < 4.0)
133
- tilt (>= 1.1, < 3)
134
- sprockets (3.7.1)
135
- concurrent-ruby (~> 1.0)
136
- rack (> 1, < 3)
137
- sprockets-rails (3.2.0)
138
- actionpack (>= 4.0)
139
- activesupport (>= 4.0)
140
- sprockets (>= 3.0.0)
141
- sqlite3 (1.3.12)
142
- thor (0.19.4)
143
- thread_safe (0.3.5)
144
- tilt (2.0.5)
145
- tzinfo (1.2.2)
146
- thread_safe (~> 0.1)
147
- uglifier (3.0.4)
148
- execjs (>= 0.3.0, < 3)
149
- websocket-driver (0.6.4)
150
- websocket-extensions (>= 0.1.0)
151
- websocket-extensions (0.1.2)
152
-
153
- PLATFORMS
154
- ruby
155
-
156
- DEPENDENCIES
157
- coffee-rails
158
- flip_fab!
159
- jquery-rails
160
- rails (~> 5.0)
161
- rails-controller-testing
162
- rspec-rails
163
- sass-rails
164
- sqlite3
165
- uglifier (>= 1.3.0)
166
-
167
- BUNDLED WITH
168
- 1.11.2