Spree is meant to be run within the context of Rails application and the source code is essentially a collection of gems. You can easily create a sandbox application inside of your cloned source directory for testing purposes.
Clone the Git repo
git clone git://github.com/spree/spree.git cd spree
Install the gem dependencies
bundle install fails that means you’re missing some required system libraries.
Firstly, please install homebew. With homebrew installed you will need to install some packages needed to run Spree and Rails applications in general:
brew install openssl mysql postgresql sqlite imagemagick
Create a sandbox Rails application for testing purposes which automatically performs all necessary database setup
bundle exec rake sandbox
Start the server
cd sandbox bundle exec rails s
config.assets.debug = false
Also in development caching is disabled by default. To turn on caching run:
bundle exec rails dev:cache
You will need to restart rails server after this change.
We use CircleCI to run the tests for Spree.
You can see the build statuses at https://circleci.com/gh/spree/spree.
Each gem contains its own series of tests, and for each directory, you need to do a quick one-time creation of a test application and then you can use it to run the tests. For example, to run the tests for the core project.
cd core BUNDLE_GEMFILE=../Gemfile bundle exec rake test_app bundle exec rspec spec
If you would like to run specs against a particular database you may specify the dummy app’s database, which defaults to sqlite3.
DB=postgres BUNDLE_GEMFILE=../Gemfile bundle exec rake test_app
If you want to run specs for only a single spec file
cd core bundle exec rspec spec/models/spree/state_spec.rb
If you want to run a particular line of spec
cd core bundle exec rspec spec/models/spree/state_spec.rb:7
We use chromedriver to run integration tests. To install it please use this command:
brew cask install chromedriver