flip_fab 1.0.0 → 1.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) 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/.gitignore +2 -0
  7. data/.rubocop.yml +31 -0
  8. data/.rubocop_todo.yml +58 -0
  9. data/.ruby-version +1 -0
  10. data/.semaphore/semaphore.yml +49 -0
  11. data/CODEOWNERS +3 -0
  12. data/Gemfile +0 -12
  13. data/README.md +8 -2
  14. data/_pipeline/step_build_gem.sh +5 -0
  15. data/_pipeline/step_test_gem.sh +6 -0
  16. data/catalog-info.yaml +8 -0
  17. data/example/rails_app/Gemfile +4 -21
  18. data/example/rails_app/Rakefile +1 -1
  19. data/example/rails_app/app/assets/config/manifest.js +3 -0
  20. data/example/rails_app/app/assets/javascripts/application.js +0 -1
  21. data/example/rails_app/app/controllers/beavers_controller.rb +12 -13
  22. data/example/rails_app/bin/bundle +1 -1
  23. data/example/rails_app/bin/rails +1 -1
  24. data/example/rails_app/config/application.rb +2 -2
  25. data/example/rails_app/config/boot.rb +1 -1
  26. data/example/rails_app/config/environment.rb +1 -1
  27. data/example/rails_app/config/environments/development.rb +1 -1
  28. data/example/rails_app/config/environments/test.rb +2 -2
  29. data/example/rails_app/config/initializers/cookies_serializer.rb +1 -1
  30. data/example/rails_app/config.ru +1 -1
  31. data/example/rails_app/db/schema.rb +5 -8
  32. data/example/rails_app/spec/rails_helper.rb +2 -2
  33. data/example/rails_app/spec/spec_helper.rb +0 -1
  34. data/example/rails_app/test/controllers/beavers_controller_test.rb +12 -12
  35. data/example/rails_app/test/test_helper.rb +1 -1
  36. data/flip_fab.gemspec +11 -5
  37. data/lib/flip_fab/contextual_feature.rb +23 -19
  38. data/lib/flip_fab/cookie_persistence.rb +10 -17
  39. data/lib/flip_fab/feature.rb +2 -3
  40. data/lib/flip_fab/features_by_name.rb +5 -4
  41. data/lib/flip_fab/helper.rb +0 -1
  42. data/lib/flip_fab/persistence.rb +2 -3
  43. data/lib/flip_fab/version.rb +6 -1
  44. data/lib/flip_fab.rb +4 -4
  45. data/script/cibuild +10 -0
  46. data/spec/lib/flip_fab/contextual_feature_spec.rb +54 -57
  47. data/spec/lib/flip_fab/cookie_persistence.feature +3 -3
  48. data/spec/lib/flip_fab/cookie_persistence_spec.rb +36 -43
  49. data/spec/lib/flip_fab/feature_spec.rb +6 -9
  50. data/spec/lib/flip_fab/features_by_name_spec.rb +3 -6
  51. data/spec/lib/flip_fab/helper_spec.rb +35 -38
  52. data/spec/lib/flip_fab/persistence_spec.rb +2 -5
  53. data/spec/lib/flip_fab_spec.rb +11 -15
  54. data/spec/spec_helper.rb +47 -49
  55. data/spec/support/test_app.rb +2 -2
  56. data/spec/support/test_context.rb +1 -1
  57. data/spec/support/test_multiple_persistence.rb +2 -3
  58. data/spec/support/test_persistence.rb +2 -3
  59. data/spec/support/test_rack_context.rb +3 -3
  60. metadata +103 -11
  61. data/Gemfile.lock +0 -92
  62. data/example/rails_app/Gemfile.lock +0 -178
  63. data/example/rails_app/README.rdoc +0 -28
  64. data/example/rails_app/config/rabbit_feed.yml +0 -8
  65. data/example/rails_app/config/unicorn.rb +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c662a0d2b36601ff4d1f9c1424d966ae7419bca0
4
- data.tar.gz: 5ed8d698d9acee0615df1b146e2048b87743ba18
2
+ SHA256:
3
+ metadata.gz: f7f880a207dde1105f807623c68b6f3911883cab9f930760b33b372addc7aa5c
4
+ data.tar.gz: 38824c24a924aab3f4bd486c3595e83a98630420a300afc89d1f554e38c4d930
5
5
  SHA512:
6
- metadata.gz: ccbe037678c9b7d1c8e6eb5e6dde83f70733159485dfbdf47ccb2a8070ce356f9b3204807bf5e346f3fb877abe5a7328b8041001a6961f327c40ea2167a198e5
7
- data.tar.gz: 87b1d482757418bcc5c77b0bcb6868c001cd3d35149dd4f470144fb0012a2bd97eeae5d40e9bdfe97fb00219a8a3327a0cff333130384b88b3f6adf716375a0a
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/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *.gem
2
+ Gemfile.lock
data/.rubocop.yml ADDED
@@ -0,0 +1,31 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ DisplayCopNames: true
5
+ DisplayStyleGuide: true
6
+
7
+ Lint/EndAlignment:
8
+ Enabled: true
9
+
10
+ Lint/UnusedMethodArgument:
11
+ Exclude:
12
+ - 'lib/flip_fab/persistence.rb'
13
+
14
+ Metrics/AbcSize:
15
+ Exclude:
16
+ - 'spec/support/test_app.rb'
17
+
18
+ Metrics/LineLength:
19
+ Enabled: false
20
+
21
+ Metrics/ModuleLength:
22
+ Exclude:
23
+ - 'spec/lib/flip_fab/contextual_feature_spec.rb'
24
+
25
+ Style/ClassAndModuleChildren:
26
+ Exclude:
27
+ - 'example/rails_app/test/test_helper.rb'
28
+
29
+ Style/Documentation:
30
+ Enabled: false
31
+
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/Gemfile CHANGED
@@ -2,15 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in flip_fab.gemspec
4
4
  gemspec
5
-
6
- group :development, :test do
7
- gem 'pry-plus'
8
- end
9
-
10
- group :test do
11
- gem 'rack'
12
- gem 'rack-test'
13
- gem 'rspec'
14
- gem 'rutabaga'
15
- gem 'timecop'
16
- end
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,36 +1,19 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
4
- gem 'rails', '4.2.0'
4
+ gem 'rails', '~> 5.0'
5
5
  # Use sqlite3 as the database for Active Record
6
6
  gem 'sqlite3'
7
7
  # Use SCSS for stylesheets
8
- gem 'sass-rails', '~> 4.0.3'
8
+ gem 'sass-rails'
9
9
  # Use Uglifier as compressor for JavaScript assets
10
10
  gem 'uglifier', '>= 1.3.0'
11
11
  # Use CoffeeScript for .js.coffee assets and views
12
- gem 'coffee-rails', '~> 4.0.0'
13
- # See https://github.com/sstephenson/execjs#readme for more supported runtimes
14
- # gem 'therubyracer', platforms: :ruby
15
-
12
+ gem 'coffee-rails'
16
13
  # Use jquery as the JavaScript library
17
14
  gem 'jquery-rails'
18
- # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
19
- gem 'turbolinks'
20
- # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
21
- gem 'jbuilder', '~> 2.0'
22
- # bundle exec rake doc:rails generates the API under doc/api.
23
- gem 'sdoc', '~> 0.4.0', group: :doc
24
-
25
- # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
26
- gem 'spring', group: :development
27
-
28
- # Use unicorn as the app server
29
- gem 'unicorn'
30
-
31
- # Use Capistrano for deployment
32
- # gem 'capistrano-rails', group: :development
33
15
 
34
16
  gem 'flip_fab', path: '../../'
35
17
 
18
+ gem 'rails-controller-testing', group: :test
36
19
  gem 'rspec-rails', group: :test
@@ -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
@@ -12,5 +12,4 @@
12
12
  //
13
13
  //= require jquery
14
14
  //= require jquery_ujs
15
- //= require turbolinks
16
15
  //= require_tree .
@@ -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
@@ -9,8 +9,7 @@ class BeaversController < ApplicationController
9
9
 
10
10
  # GET /beavers/1
11
11
  # GET /beavers/1.json
12
- def show
13
- end
12
+ def show; end
14
13
 
15
14
  # GET /beavers/new
16
15
  def new
@@ -18,8 +17,7 @@ class BeaversController < ApplicationController
18
17
  end
19
18
 
20
19
  # GET /beavers/1/edit
21
- def edit
22
- end
20
+ def edit; end
23
21
 
24
22
  # POST /beavers
25
23
  # POST /beavers.json
@@ -62,13 +60,14 @@ class BeaversController < ApplicationController
62
60
  end
63
61
 
64
62
  private
65
- # Use callbacks to share common setup or constraints between actions.
66
- def set_beaver
67
- @beaver = Beaver.find(params[:id])
68
- end
69
63
 
70
- # Never trust parameters from the scary internet, only allow the white list through.
71
- def beaver_params
72
- params.require(:beaver).permit(:name)
73
- end
64
+ # Use callbacks to share common setup or constraints between actions.
65
+ def set_beaver
66
+ @beaver = Beaver.find(params[:id])
67
+ end
68
+
69
+ # Never trust parameters from the scary internet, only allow the white list through.
70
+ def beaver_params
71
+ params.require(:beaver).permit(:name)
72
+ end
74
73
  end
@@ -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!
@@ -20,7 +20,7 @@ Rails.application.configure do
20
20
  # config.action_dispatch.rack_cache = true
21
21
 
22
22
  # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_files = false
23
+ config.public_file_server.enabled = false
24
24
 
25
25
  # Compress JavaScripts and CSS.
26
26
  config.assets.js_compressor = :uglifier
@@ -13,8 +13,8 @@ Rails.application.configure do
13
13
  config.eager_load = false
14
14
 
15
15
  # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
17
- config.static_cache_control = 'public, max-age=3600'
16
+ config.public_file_server.enabled = true
17
+ config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
18
18
 
19
19
  # Show full error reports and disable caching.
20
20
  config.consider_all_requests_local = true
@@ -1,3 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Rails.application.config.action_dispatch.cookies_serializer = :json
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -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.
@@ -11,12 +10,10 @@
11
10
  #
12
11
  # It's strongly recommended that you check this file into your version control system.
13
12
 
14
- ActiveRecord::Schema.define(version: 20140424102400) do
15
-
16
- create_table "beavers", force: true do |t|
17
- t.string "name"
18
- t.datetime "created_at"
19
- t.datetime "updated_at"
13
+ ActiveRecord::Schema.define(version: 20_140_424_102_400) do
14
+ create_table 'beavers', force: true do |t|
15
+ t.string 'name'
16
+ t.datetime 'created_at'
17
+ t.datetime 'updated_at'
20
18
  end
21
-
22
19
  end
@@ -1,7 +1,7 @@
1
1
  # This file is copied to spec/ when you run 'rails generate rspec:install'
2
- ENV["RAILS_ENV"] ||= 'test'
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,4 @@
1
1
  RSpec.configure do |config|
2
-
3
2
  # Run specs in random order to surface order dependencies. If you find an
4
3
  # order dependency and want to debug it, you can fix the order by providing
5
4
  # the seed, which is printed after each run.
@@ -5,43 +5,43 @@ class BeaversControllerTest < ActionController::TestCase
5
5
  @beaver = beavers(:one)
6
6
  end
7
7
 
8
- test "should get index" do
8
+ test 'should get index' do
9
9
  get :index
10
10
  assert_response :success
11
11
  assert_not_nil assigns(:beavers)
12
12
  end
13
13
 
14
- test "should get new" do
14
+ test 'should get new' do
15
15
  get :new
16
16
  assert_response :success
17
17
  end
18
18
 
19
- test "should create beaver" do
19
+ test 'should create beaver' do
20
20
  assert_difference('Beaver.count') do
21
- post :create, beaver: { name: @beaver.name }
21
+ post :create, params: { beaver: { name: @beaver.name } }
22
22
  end
23
23
 
24
24
  assert_redirected_to beaver_path(assigns(:beaver))
25
25
  end
26
26
 
27
- test "should show beaver" do
28
- get :show, id: @beaver
27
+ test 'should show beaver' do
28
+ get :show, params: { id: @beaver }
29
29
  assert_response :success
30
30
  end
31
31
 
32
- test "should get edit" do
33
- get :edit, id: @beaver
32
+ test 'should get edit' do
33
+ get :edit, params: { id: @beaver }
34
34
  assert_response :success
35
35
  end
36
36
 
37
- test "should update beaver" do
38
- patch :update, id: @beaver, beaver: { name: @beaver.name }
37
+ test 'should update beaver' do
38
+ patch :update, params: { id: @beaver, beaver: { name: @beaver.name } }
39
39
  assert_redirected_to beaver_path(assigns(:beaver))
40
40
  end
41
41
 
42
- test "should destroy beaver" do
42
+ test 'should destroy beaver' do
43
43
  assert_difference('Beaver.count', -1) do
44
- delete :destroy, id: @beaver
44
+ delete :destroy, params: { id: @beaver }
45
45
  end
46
46
 
47
47
  assert_redirected_to beavers_path
@@ -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