workarea-circuit_breaker 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  3. data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  5. data/.github/workflows/ci.yml +66 -0
  6. data/.gitignore +20 -0
  7. data/.rubocop.yml +2 -0
  8. data/.stylelintrc.json +8 -0
  9. data/CHANGELOG.md +54 -0
  10. data/Gemfile +12 -0
  11. data/LICENSE +52 -0
  12. data/README.md +103 -0
  13. data/Rakefile +59 -0
  14. data/app/assets/stylesheets/circuit_breaker/.keep +0 -0
  15. data/app/controllers/workarea/admin/circuits_controller.rb +26 -0
  16. data/app/view_models/workarea/admin/circuit_view_model.rb +33 -0
  17. data/app/view_models/workarea/admin/circuits_view_model.rb +41 -0
  18. data/app/views/workarea/admin/circuits/index.html.haml +69 -0
  19. data/app/views/workarea/admin/shared/_circuit_breaker_link.html.haml +1 -0
  20. data/bin/rails +25 -0
  21. data/config/initializers/appends.rb +4 -0
  22. data/config/initializers/workarea.rb +11 -0
  23. data/config/locales/en.yml +29 -0
  24. data/config/routes.rb +10 -0
  25. data/lib/workarea/circuit_breaker.rb +96 -0
  26. data/lib/workarea/circuit_breaker/circuit.rb +137 -0
  27. data/lib/workarea/circuit_breaker/engine.rb +12 -0
  28. data/lib/workarea/circuit_breaker/failure_message.rb +51 -0
  29. data/lib/workarea/circuit_breaker/version.rb +5 -0
  30. data/script/admin_ci +5 -0
  31. data/script/ci +8 -0
  32. data/script/core_ci +5 -0
  33. data/script/plugins_ci +5 -0
  34. data/script/storefront_ci +5 -0
  35. data/test/dummy/.ruby-version +1 -0
  36. data/test/dummy/Rakefile +6 -0
  37. data/test/dummy/bin/bundle +3 -0
  38. data/test/dummy/bin/rails +4 -0
  39. data/test/dummy/bin/rake +4 -0
  40. data/test/dummy/bin/setup +28 -0
  41. data/test/dummy/bin/update +28 -0
  42. data/test/dummy/bin/yarn +11 -0
  43. data/test/dummy/config.ru +5 -0
  44. data/test/dummy/config/application.rb +33 -0
  45. data/test/dummy/config/boot.rb +5 -0
  46. data/test/dummy/config/environment.rb +5 -0
  47. data/test/dummy/config/environments/development.rb +52 -0
  48. data/test/dummy/config/environments/production.rb +83 -0
  49. data/test/dummy/config/environments/test.rb +45 -0
  50. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  51. data/test/dummy/config/initializers/assets.rb +14 -0
  52. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  53. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  54. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  55. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  56. data/test/dummy/config/initializers/inflections.rb +16 -0
  57. data/test/dummy/config/initializers/mime_types.rb +4 -0
  58. data/test/dummy/config/initializers/workarea.rb +5 -0
  59. data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
  60. data/test/dummy/config/locales/en.yml +33 -0
  61. data/test/dummy/config/puma.rb +34 -0
  62. data/test/dummy/config/routes.rb +5 -0
  63. data/test/dummy/config/secrets.yml +33 -0
  64. data/test/dummy/config/spring.rb +6 -0
  65. data/test/dummy/db/seeds.rb +2 -0
  66. data/test/dummy/lib/assets/.keep +0 -0
  67. data/test/dummy/log/.keep +0 -0
  68. data/test/integration/workarea/admin/circuits_integration_test.rb +27 -0
  69. data/test/lib/workarea/circuit_breaker/circuit_test.rb +135 -0
  70. data/test/lib/workarea/circuit_breaker/failure_message_test.rb +41 -0
  71. data/test/lib/workarea/circuit_breaker_test.rb +42 -0
  72. data/test/support/circuit_breaker_support.rb +16 -0
  73. data/test/teaspoon_env.rb +6 -0
  74. data/test/test_helper.rb +15 -0
  75. data/workarea-circuit_breaker.gemspec +17 -0
  76. metadata +151 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 23ec99e03bbc3e672cd681a52271cc31f3057c90d753adb0829bec7c92df7558
4
+ data.tar.gz: fb46308700aa050aca2fe6748314de5c0df4c5a19c43e8eca0041bfe51dcfa8e
5
+ SHA512:
6
+ metadata.gz: 10e887fea6316ef733b83a3bbd53c81ce539c74eafda9186e903efdc1f3da972a8a5b3a9d7b493a1330d18f0c827f67c30b1f8a7c31e9fc45368953c2e57f9da
7
+ data.tar.gz: fdfbc07e556dc5d9ac239e809cb6f47640b7f6a961b114034cc020b97fdaab11e8d05f71cf83664dfab415c32b088c436b023818386d8e25e55cd25b035584e5
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve Workarea
4
+ title: ''
5
+ labels: bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ ⚠️**Before you create**⚠️
11
+ Please verify the issue you're experiencing is not part of your Workarea project customizations. The best way to do this is with a [vanilla Workarea installation](https://developer.workarea.com/articles/create-a-new-host-application.html). This will help us spend time on fixes/improvements for the whole community. Thank you!
12
+
13
+ **Describe the bug**
14
+ A clear and concise description of what the bug is.
15
+
16
+ **To Reproduce**
17
+ Steps to reproduce the behavior:
18
+ 1. Go to '...'
19
+ 2. Click on '....'
20
+ 3. Scroll down to '....'
21
+ 4. See error
22
+
23
+ **Expected behavior**
24
+ A clear and concise description of what you expected to happen.
25
+
26
+ **Workarea Setup (please complete the following information):**
27
+ - Workarea Version: [e.g. v3.4.6]
28
+ - Plugins [e.g. workarea-blog, workarea-sitemaps]
29
+
30
+ **Attachments**
31
+ If applicable, add any attachments to help explain your problem, things like:
32
+ - screenshots
33
+ - Gemfile.lock
34
+ - test cases
35
+
36
+ **Additional context**
37
+ Add any other context about the problem here.
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: Documentation request
3
+ about: Suggest documentation
4
+ title: ''
5
+ labels: documentation
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your documentation related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm confused by [...]
12
+
13
+ **Describe the article you'd like**
14
+ A clear and concise description of what would be in the documentation article.
15
+
16
+ **Additional context**
17
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for Workarea
4
+ title: ''
5
+ labels: enhancement
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,66 @@
1
+ name: CI
2
+ on: [push]
3
+
4
+ jobs:
5
+ static_analysis:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v1
9
+ - uses: workarea-commerce/ci/bundler-audit@v1
10
+ env:
11
+ BUNDLE_GEMS__WEBLINC__COM: ${{ secrets.gem_credentials }}
12
+ - uses: workarea-commerce/ci/rubocop@v1
13
+ env:
14
+ BUNDLE_GEMS__WEBLINC__COM: ${{ secrets.gem_credentials }}
15
+
16
+ admin_tests:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v1
20
+ - uses: actions/setup-ruby@v1
21
+ with:
22
+ ruby-version: 2.6.x
23
+ - uses: workarea-commerce/ci/test@v1
24
+ with:
25
+ command: bin/rails app:workarea:test:admin
26
+ env:
27
+ BUNDLE_GEMS__WEBLINC__COM: ${{ secrets.gem_credentials }}
28
+
29
+ core_tests:
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - uses: actions/checkout@v1
33
+ - uses: actions/setup-ruby@v1
34
+ with:
35
+ ruby-version: 2.6.x
36
+ - uses: workarea-commerce/ci/test@v1
37
+ with:
38
+ command: bin/rails app:workarea:test:core
39
+ env:
40
+ BUNDLE_GEMS__WEBLINC__COM: ${{ secrets.gem_credentials }}
41
+
42
+ storefront_tests:
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - uses: actions/checkout@v1
46
+ - uses: actions/setup-ruby@v1
47
+ with:
48
+ ruby-version: 2.6.x
49
+ - uses: workarea-commerce/ci/test@v1
50
+ with:
51
+ command: bin/rails app:workarea:test:storefront
52
+ env:
53
+ BUNDLE_GEMS__WEBLINC__COM: ${{ secrets.gem_credentials }}
54
+
55
+ plugins_tests:
56
+ runs-on: ubuntu-latest
57
+ steps:
58
+ - uses: actions/checkout@v1
59
+ - uses: actions/setup-ruby@v1
60
+ with:
61
+ ruby-version: 2.6.x
62
+ - uses: workarea-commerce/ci/test@v1
63
+ with:
64
+ command: bin/rails app:workarea:test:plugins
65
+ env:
66
+ BUNDLE_GEMS__WEBLINC__COM: ${{ secrets.gem_credentials }}
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ .bundle/
2
+ .DS_Store
3
+ .byebug_history
4
+ Gemfile.lock
5
+ package.json
6
+ yarn.lock
7
+ log/*.log
8
+ pkg/
9
+ coverage/
10
+ test/dummy/log/*.log
11
+ test/dummy/node_modules/
12
+ test/dummy/yarn-error.log
13
+ test/dummy/tmp/
14
+ test/dummy/public/
15
+ test/dummy/db/*.sqlite3
16
+ test/dummy/db/*.sqlite3-journal
17
+ .sass-cache/
18
+ pkg/
19
+ node_modules
20
+ .rubocop-http*
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ inherit_from:
2
+ - https://raw.githubusercontent.com/workarea-commerce/workarea/master/.rubocop.yml
data/.stylelintrc.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "stylelint-config-recommended-scss",
3
+ "rules": {
4
+ "block-no-empty": null,
5
+ "no-descending-specificity": null,
6
+ "property-no-unknown": [true, { "ignoreProperties": ["mso-hide"] }]
7
+ }
8
+ }
data/CHANGELOG.md ADDED
@@ -0,0 +1,54 @@
1
+ Workarea Circuit Breaker 1.0.3 (2020-02-05)
2
+ --------------------------------------------------------------------------------
3
+
4
+ * Remove SENTRY_DSN from workflow
5
+
6
+ Tom Scott
7
+
8
+ * Fix Exception Capturing
9
+
10
+ Since `Raven.capture_exception` can sometimes return a blank value,
11
+ ensure that `CircuitBreaker.capture_exception` won't throw an error when
12
+ trying to get the event ID from Sentry. Fixes a test that breaks when
13
+ both the Sentry and CircuitBreaker plugins are installed.
14
+
15
+ WORKAREA-189
16
+ Tom Scott
17
+
18
+
19
+
20
+ Workarea Circuit Breaker 1.0.2 (2019-08-06)
21
+ --------------------------------------------------------------------------------
22
+
23
+ * Only run config freezing test when running tests from source
24
+
25
+ WCB-3
26
+ Jeff Yucis
27
+
28
+
29
+
30
+ Workarea Circuit Breaker 1.0.1 (2019-04-30)
31
+ --------------------------------------------------------------------------------
32
+
33
+ * Improve admin UI
34
+
35
+ Add tool tips to the circuit breaker table along with help text. Fix a bug with user name not displaying in the time line message. Add link to settings menu.
36
+
37
+ WCB-2
38
+ Eric Pigeon
39
+
40
+
41
+
42
+ Workarea Circuit Breaker 1.0.0 (2018-11-13)
43
+ --------------------------------------------------------------------------------
44
+
45
+ * Workarea Circuit Breaker
46
+
47
+ Circuit Breaker is small libray that allows you to wrap calls to
48
+ external services and provide safe fallbacks during external outages.
49
+
50
+ WCB-1
51
+ Eric Pigeon
52
+
53
+
54
+
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ gemspec
5
+
6
+ gem 'workarea'
7
+
8
+ source 'https://gems.weblinc.com' do
9
+ gem 'workarea-sentry'
10
+ end
11
+
12
+ gem 'simplecov', require: false, group: :test
data/LICENSE ADDED
@@ -0,0 +1,52 @@
1
+ WebLinc
2
+ Business Source License
3
+
4
+ Licensor: WebLinc Corporation, 22 S. 3rd Street, 2nd Floor, Philadelphia PA 19106
5
+
6
+ Licensed Work: Workarea Commerce Platform
7
+ The Licensed Work is (c) 2019 WebLinc Corporation
8
+
9
+ Additional Use Grant:
10
+ You may make production use of the Licensed Work without an additional license agreement with WebLinc so long as you do not use the Licensed Work for a Commerce Service.
11
+
12
+ A "Commerce Service" is a commercial offering that allows third parties (other than your employees and contractors) to access the functionality of the Licensed Work by creating or managing commerce functionality, the products, taxonomy, assets and/or content of which are controlled by such third parties.
13
+
14
+ For information about obtaining an additional license agreement with WebLinc, contact licensing@workarea.com.
15
+
16
+ Change Date: 2019-08-20
17
+
18
+ Change License: Version 2.0 or later of the GNU General Public License as published by the Free Software Foundation
19
+
20
+ Terms
21
+
22
+ The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use.
23
+
24
+ Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate.
25
+
26
+ If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work.
27
+
28
+ All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor.
29
+
30
+ You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work.
31
+
32
+ Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.
33
+
34
+ This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License). TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE. MariaDB hereby grants you permission to use this License’s text to license your works and to refer to it using the trademark "Business Source License" as long as you comply with the Covenants of Licensor below.
35
+
36
+ Covenants of Licensor
37
+ In consideration of the right to use this License’s text and the "Business Source License" name and trademark, Licensor covenants to MariaDB, and to all other recipients of the licensed work to be provided by Licensor:
38
+
39
+ To specify as the Change License the GPL Version 2.0 or any later version, or a license that is compatible with GPL Version 2.0 or a later version, where "compatible" means that software provided under the Change License can be included in a program with software provided under GPL Version 2.0 or a later version. Licensor may specify additional Change Licenses without limitation.
40
+
41
+ To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the right granted in this License, as the Additional Use Grant; or (b) insert the text "None."
42
+
43
+ To specify a Change Date.
44
+
45
+ Not to modify this License in any other way.
46
+
47
+ Notice
48
+ The Business Source License (this document, or the "License") is not an Open Source license. However, the Licensed Work will eventually be made available under an Open Source License, as stated in this License.
49
+
50
+ For more information on the use of the Business Source License generally, please visit the Adopting and Developing Business Source License FAQ.
51
+
52
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. "Business Source License" is a trademark of MariaDB Corporation Ab.
data/README.md ADDED
@@ -0,0 +1,103 @@
1
+ Workarea Circuit Breaker
2
+ ================================================================================
3
+
4
+ Circuit Breaker plugin for the Workarea platform.
5
+
6
+ ## Configuration
7
+
8
+ Configure how circuit breaker should handle external service calls
9
+
10
+ # window: the window of time to count failed calls to break the circuit
11
+ # max_fails: how many failed calls need to happen in the window to break the circuit
12
+ # break_for: how long the circuit should fast fail after broken
13
+ Workarea.Configure do |config|
14
+ config.circuit_breaker.circuits = {
15
+ exteral_service: { max_fails: 3, break_for: 5.minutes, window: 5.minutes }
16
+ }
17
+ end
18
+
19
+ or use `CircuitBreaker.add_service`
20
+
21
+ # configure service with circuit defaults
22
+ CircuitBreaker.add_service(:external_service)
23
+
24
+ ## Usage
25
+
26
+ # will re-raise any errors raised in the block or
27
+ #raise ::Workarea::CircuitBreaker::CircuitBreakerError if the circuit is broken
28
+ Workarea::CircuitBreaker[:service].wrap do
29
+ Net::HTTP.get_response(.....)
30
+ end
31
+
32
+ Wrap takes a parameter `fallback` which is either a symbol of a method defined in
33
+ the current scope to call when the circuit is broken or an error is raised in the block
34
+ or anything that responds to #call
35
+
36
+ Using a symbol
37
+
38
+ Workarea::CircuitBreaker[:service].wrap(fallback: :faked_response) do
39
+ Net::HTTP.get_response(.....)
40
+ end
41
+
42
+ private
43
+
44
+ def faked_response
45
+ "...."
46
+ end
47
+
48
+ Using a lambda
49
+
50
+ fallback = -> { "..." }
51
+ Workarea::CircuitBreaker[:service].wrap(fallback: fallback) do
52
+ Net::HTTP.get_response(.....)
53
+ end
54
+
55
+ ## Admin
56
+
57
+ An admin to view circuits is available at `/admin/circuits`, only viewable by
58
+ `super_admin`s. Circuit status can viewed and can be manually broken or reset.
59
+
60
+ Getting Started
61
+ --------------------------------------------------------------------------------
62
+
63
+ This gem contains a rails engine that must be mounted onto a host Rails application.
64
+
65
+ To access Workarea gems and source code, you must be an employee of WebLinc or a licensed retailer or partner.
66
+
67
+ Workarea gems are hosted privately at https://gems.weblinc.com/.
68
+ You must have individual or team credentials to install gems from this server. Add your gems server credentials to Bundler:
69
+
70
+ bundle config gems.weblinc.com my_username:my_password
71
+
72
+ Or set the appropriate environment variable in a shell startup file:
73
+
74
+ export BUNDLE_GEMS__WEBLINC__COM='my_username:my_password'
75
+
76
+ Then add the gem to your application's Gemfile specifying the source:
77
+
78
+ # ...
79
+ gem 'workarea-circuit_breaker', source: 'https://gems.weblinc.com'
80
+ # ...
81
+
82
+ Or use a source block:
83
+
84
+ # ...
85
+ source 'https://gems.weblinc.com' do
86
+ gem 'workarea-circuit_breaker'
87
+ end
88
+ # ...
89
+
90
+ Update your application's bundle.
91
+
92
+ cd path/to/application
93
+ bundle
94
+
95
+ Workarea Platform Documentation
96
+ --------------------------------------------------------------------------------
97
+
98
+ See [https://developer.workarea.com](https://developer.workarea.com) for Workarea platform documentation.
99
+
100
+ License
101
+ --------------------------------------------------------------------------------
102
+
103
+ Workarea Affirm is released under the [Business Software License](LICENSE)
data/Rakefile ADDED
@@ -0,0 +1,59 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+ RDoc::Task.new(:rdoc) do |rdoc|
9
+ rdoc.rdoc_dir = 'rdoc'
10
+ rdoc.title = 'Circuit Breaker'
11
+ rdoc.options << '--line-numbers'
12
+ rdoc.rdoc_files.include('README.md')
13
+ rdoc.rdoc_files.include('lib/**/*.rb')
14
+ end
15
+
16
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
17
+ load 'rails/tasks/engine.rake'
18
+ load 'rails/tasks/statistics.rake'
19
+ load 'workarea/changelog.rake'
20
+
21
+ require 'rake/testtask'
22
+ Rake::TestTask.new(:test) do |t|
23
+ t.libs << 'lib'
24
+ t.libs << 'test'
25
+ t.pattern = 'test/**/*_test.rb'
26
+ t.verbose = false
27
+ end
28
+ task default: :test
29
+
30
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
31
+ require 'workarea/circuit_breaker/version'
32
+
33
+ desc "Release version #{Workarea::CircuitBreaker::VERSION} of the gem"
34
+ task :release do
35
+ host = "https://#{ENV['BUNDLE_GEMS__WEBLINC__COM']}@gems.weblinc.com"
36
+
37
+ Rake::Task['workarea:changelog'].execute
38
+ system 'git add CHANGELOG.md'
39
+ system 'git commit -m "Update CHANGELOG"'
40
+ system 'git push origin HEAD'
41
+
42
+ system "git tag -a v#{Workarea::CircuitBreaker::VERSION} -m 'Tagging #{Workarea::CircuitBreaker::VERSION}'"
43
+ system 'git push --tags'
44
+
45
+ system "gem build workarea-circuit_breaker.gemspec"
46
+ system "gem push workarea-circuit_breaker-#{Workarea::CircuitBreaker::VERSION}.gem --host #{host}"
47
+ system "rm workarea-circuit_breaker-#{Workarea::CircuitBreaker::VERSION}.gem"
48
+ end
49
+
50
+ desc 'Run the JavaScript tests'
51
+ ENV['TEASPOON_RAILS_ENV'] = File.expand_path('../test/dummy/config/environment', __FILE__)
52
+ task teaspoon: 'app:teaspoon'
53
+
54
+ desc 'Start a server at http://localhost:3000/teaspoon for JavaScript tests'
55
+ task :teaspoon_server do
56
+ Dir.chdir("test/dummy")
57
+ teaspoon_env = File.expand_path('../test/teaspoon_env.rb', __FILE__)
58
+ system "RAILS_ENV=test TEASPOON_ENV=#{teaspoon_env} rails s"
59
+ end