-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3567255
commit 6821cff
Showing
6 changed files
with
70 additions
and
136 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
#!/usr/bin/env ruby | ||
# | ||
# This file was generated by Bundler. | ||
# | ||
# The application 'rails' is installed as part of a gem, and | ||
# this file is here to facilitate running it. | ||
# | ||
|
||
require 'pathname' | ||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", | ||
Pathname.new(__FILE__).realpath) | ||
|
||
require 'rubygems' | ||
require 'bundler/setup' | ||
|
||
load Gem.bin_path('railties', 'rails') | ||
APP_PATH = File.expand_path('../../config/application', __FILE__) | ||
require_relative '../config/boot' | ||
require 'rails/commands' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
#!/usr/bin/env ruby | ||
# | ||
# This file was generated by Bundler. | ||
# | ||
# The application 'rake' is installed as part of a gem, and | ||
# this file is here to facilitate running it. | ||
# | ||
|
||
require 'pathname' | ||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", | ||
Pathname.new(__FILE__).realpath) | ||
|
||
require 'rubygems' | ||
require 'bundler/setup' | ||
|
||
load Gem.bin_path('rake', 'rake') | ||
require_relative '../config/boot' | ||
require 'rake' | ||
Rake.application.run |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,70 @@ | ||
require 'rubygems' | ||
require 'spork' | ||
|
||
Spork.prefork do | ||
# Loading more in this block will cause your tests to run faster. However, | ||
# if you change any configuration or code from libraries loaded here, you'll | ||
# need to restart spork for it take effect. | ||
ENV["RAILS_ENV"] = 'test' | ||
|
||
unless ENV['DRB'] | ||
require 'simplecov' | ||
require 'rubygems' | ||
require 'simplecov' | ||
require File.expand_path("../../config/environment", __FILE__) | ||
require 'rspec/rails' | ||
require 'rspec/autorun' | ||
#require 'sunspot/rails/spec_helper' | ||
|
||
$original_sunspot_session = Sunspot.session | ||
Sunspot::Rails::Tester.start_original_sunspot_session | ||
|
||
# Requires supporting ruby files with custom matchers and macros, etc, | ||
# in spec/support/ and its subdirectories. | ||
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| load f} | ||
|
||
Sugar.redis = Redis.connect(RedisHelper::CONFIG) | ||
|
||
RSpec.configure do |config| | ||
# == Mock Framework | ||
# | ||
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: | ||
# | ||
# config.mock_with :mocha | ||
# config.mock_with :flexmock | ||
# config.mock_with :rr | ||
config.mock_with :rspec | ||
|
||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures | ||
#config.fixture_path = "#{::Rails.root}/spec/fixtures" | ||
|
||
# Stub Sunspot | ||
config.before do | ||
Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session) | ||
end | ||
|
||
ENV["RAILS_ENV"] = 'test' | ||
|
||
require File.expand_path("../../config/environment", __FILE__) | ||
require 'rspec/rails' | ||
require 'rspec/autorun' | ||
#require 'sunspot/rails/spec_helper' | ||
|
||
$original_sunspot_session = Sunspot.session | ||
Sunspot::Rails::Tester.start_original_sunspot_session | ||
|
||
RSpec.configure do |config| | ||
# == Mock Framework | ||
# | ||
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: | ||
# | ||
# config.mock_with :mocha | ||
# config.mock_with :flexmock | ||
# config.mock_with :rr | ||
config.mock_with :rspec | ||
|
||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures | ||
#config.fixture_path = "#{::Rails.root}/spec/fixtures" | ||
|
||
# Stub Sunspot | ||
config.before do | ||
Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session) | ||
end | ||
config.before :each, solr: true do | ||
Sunspot::Rails::Tester.start_original_sunspot_session | ||
Sunspot.session = $original_sunspot_session | ||
Sunspot.remove_all! | ||
end | ||
|
||
# Use FactoryGirl shorthand | ||
config.include FactoryGirl::Syntax::Methods | ||
|
||
# If you're not using ActiveRecord, or you'd prefer not to run each of your | ||
# examples within a transaction, remove the following line or assign false | ||
# instead of true. | ||
config.use_transactional_fixtures = true | ||
|
||
# If true, the base class of anonymous controllers will be inferred | ||
# automatically. This will be the default behavior in future versions of | ||
# rspec-rails. | ||
config.infer_base_class_for_anonymous_controllers = false | ||
config.before :each, solr: true do | ||
Sunspot::Rails::Tester.start_original_sunspot_session | ||
Sunspot.session = $original_sunspot_session | ||
Sunspot.remove_all! | ||
end | ||
|
||
end | ||
# Use FactoryGirl shorthand | ||
config.include FactoryGirl::Syntax::Methods | ||
|
||
Spork.each_run do | ||
# If you're not using ActiveRecord, or you'd prefer not to run each of your | ||
# examples within a transaction, remove the following line or assign false | ||
# instead of true. | ||
config.use_transactional_fixtures = true | ||
|
||
if ENV['DRB'] | ||
require 'simplecov' | ||
end | ||
|
||
# This code will be run each time you run your specs. | ||
# If true, the base class of anonymous controllers will be inferred | ||
# automatically. This will be the default behavior in future versions of | ||
# rspec-rails. | ||
config.infer_base_class_for_anonymous_controllers = false | ||
|
||
# Requires supporting ruby files with custom matchers and macros, etc, | ||
# in spec/support/ and its subdirectories. | ||
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| load f} | ||
config.include RedisHelper, redis: true | ||
config.include JsonSpec::Helpers | ||
config.include LoginMacros, type: :controller | ||
config.include MailerMacros | ||
config.include ConfigurationMacros | ||
|
||
Sugar.redis = Redis.connect(RedisHelper::CONFIG) | ||
config.before(:each) { reset_email } | ||
|
||
RSpec.configure do |config| | ||
config.include RedisHelper, redis: true | ||
config.include JsonSpec::Helpers | ||
config.include LoginMacros, type: :controller | ||
config.include MailerMacros | ||
config.include ConfigurationMacros | ||
config.before(:each) { reset_email } | ||
|
||
# Clean the Redis database and reload the configuration | ||
config.around(:each, redis: true) do |example| | ||
with_clean_redis do | ||
Sugar.config.reset! | ||
example.run | ||
end | ||
# Clean the Redis database and reload the configuration | ||
config.around(:each, redis: true) do |example| | ||
with_clean_redis do | ||
Sugar.config.reset! | ||
example.run | ||
end | ||
end | ||
|
||
end |