https://github.com/knapsackpro/rails-app-with-knapsack
Example of Ruby on Rails app with knapsack gem. Knapsack is a free gem, see https://github.com/ArturT/knapsack
https://github.com/knapsackpro/rails-app-with-knapsack
Last synced: about 1 year ago
JSON representation
Example of Ruby on Rails app with knapsack gem. Knapsack is a free gem, see https://github.com/ArturT/knapsack
- Host: GitHub
- URL: https://github.com/knapsackpro/rails-app-with-knapsack
- Owner: KnapsackPro
- License: mit
- Created: 2015-05-01T10:57:25.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2024-06-06T15:06:11.000Z (almost 2 years ago)
- Last Synced: 2024-06-06T17:40:15.612Z (almost 2 years ago)
- Language: Ruby
- Size: 143 KB
- Stars: 2
- Watchers: 3
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rails app with knapsack
[](https://circleci.com/gh/KnapsackPro/rails-app-with-knapsack)
This is example Ruby on Rails app with knapsack gem. Knapsack splits tests across CI nodes and makes sure that tests will run comparable time on each node.
__You can read more about free [knapsack gem here](https://github.com/ArturT/knapsack). You will find there info how to set up your test suite and how to do it on your favorite CI server.__
## How to load knapsack rake tasks
See [Rakefile](Rakefile).
## Parallel rspec test suite with knapsack
### How to set up knapsack
See [spec/spec_helper.rb](spec/spec_helper.rb)
### Step 1
First generate only once a report `knapsack_rspec_report.json` on your CI with command:
$ KNAPSACK_GENERATE_REPORT=true bundle exec rspec spec
Add the report into your repository and commit.
### Step 2
You can use below command on CI to run tests:
# Run this on first CI server
$ CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:rspec
# Run this on second CI server
$ CI_NODE_TOTAL=2 CI_NODE_INDEX=1 bundle exec rake knapsack:rspec
See [.circleci/config.yml](.circleci/config.yml) to see how we set up CircleCI.
## Parallel cucumber test suite with knapsack
### How to set up knapsack
See [features/support/knapsack.rb](features/support/knapsack.rb)
### Step 1
First generate only once a report `knapsack_cucumber_report.json` on your CI with command:
$ KNAPSACK_GENERATE_REPORT=true bundle exec cucumber features
Add the report into your repository and commit.
### Step 2
You can use below command on CI to run tests:
# Run this on first CI server
$ CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:cucumber
# Run this on second CI server
$ CI_NODE_TOTAL=2 CI_NODE_INDEX=1 bundle exec rake knapsack:cucumber
See [.circleci/config.yml](.circleci/config.yml) to see how we set up CircleCI.
## Parallel minitest test suite with knapsack
### How to set up knapsack
See [test/test_helper.rb](test/test_helper.rb)
### Step 1
First generate only once a report `knapsack_minitest_report.json` on your CI with command:
$ KNAPSACK_GENERATE_REPORT=true bundle exec rake test
Add the report into your repository and commit.
### Step 2
You can use below command on CI to run tests:
# Run this on first CI server
$ CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:minitest
# Run this on second CI server
$ CI_NODE_TOTAL=2 CI_NODE_INDEX=1 bundle exec rake knapsack:minitest
See [.circleci/config.yml](.circleci/config.yml) to see how we set up CircleCI.
## Parallel spinach test suite with knapsack
### How to set up knapsack
See [spinach_features/support/env.rb](spinach_features/support/env.rb)
### Step 1
First generate only once a report `knapsack_spinach_report.json` on your CI with command:
$ KNAPSACK_GENERATE_REPORT=true bundle exec spinach -f spinach_features
Add the report into your repository and commit.
### Step 2
You can use below command on CI to run tests:
# Run this on first CI server
$ CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="spinach_features/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_features]"
# Run this on second CI server
$ CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="spinach_features/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_features]"
See [.circleci/config.yml](.circleci/config.yml) to see how we set up CircleCI.