Last active
September 1, 2016 05:53
-
-
Save padi/237e41aa80e62819d81a87cceace80b3 to your computer and use it in GitHub Desktop.
Fat-free RSpec test setup for Plain Old Ruby Objects within Rails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # spec_helper for faster testing of plain old ruby objects | |
| # To check if a spec is ready for this spec_helper, | |
| # just replace `require "spec_helper"` | |
| # with `require "slim_spec_helper"` and edit | |
| # this file as necessary | |
| # Loads a subset of the gemfile using bundler/inline | |
| begin | |
| require "bundler/inline" | |
| rescue LoadError => e | |
| $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
| raise e | |
| end | |
| if File.exists?(ENV['BUNDLE_GEMFILE']) | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| gem 'rails' | |
| gem 'rspec-rails' | |
| gem 'pry' | |
| end | |
| else | |
| $stderr.puts "No BUNDLE_GEMFILE" | |
| raise e | |
| end | |
| # Add services to $LOAD_PATH | |
| $:.unshift File.expand_path('../app/services', File.dirname(__FILE__)) | |
| RSpec.configure do |config| | |
| config.mock_with :rspec | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment