Merge pull request #5443 from jhass/spring

Replace spork with spring, update & use binstubs
This commit is contained in:
Dennis Schubert 2014-12-04 00:38:30 +01:00
commit 339111867e
23 changed files with 205 additions and 366 deletions

1
.rspec
View file

@ -3,4 +3,3 @@
--color --color
--tag ~performance --tag ~performance
--order random --order random
--drb

View file

@ -202,14 +202,15 @@ group :development do
# Automatic test runs # Automatic test runs
gem 'guard-cucumber', '1.5.1' gem 'guard-cucumber', '1.5.1'
gem 'guard-rspec', '4.3.1' gem 'guard-rspec', '4.3.1'
gem 'guard', '2.8.2', :require => false gem 'guard', '2.10.0', :require => false
gem 'rb-fsevent', '0.9.4', :require => false gem 'rb-fsevent', '0.9.4', :require => false
gem 'rb-inotify', '0.9.5', :require => false gem 'rb-inotify', '0.9.5', :require => false
# Preloading environment # Preloading environment
gem 'guard-spork', '2.0.1' gem 'spring', '1.2.0'
gem 'spork', '1.0.0rc4' gem 'spring-commands-rspec', '1.0.2'
gem 'spring-commands-cucumber', '1.0.1'
# Debugging # Debugging
gem 'pry' gem 'pry'

View file

@ -245,7 +245,7 @@ GEM
json json
multi_json multi_json
request_store (>= 1.0.5) request_store (>= 1.0.5)
guard (2.8.2) guard (2.10.0)
formatador (>= 0.2.4) formatador (>= 0.2.4)
listen (~> 2.7) listen (~> 2.7)
lumberjack (~> 1.0) lumberjack (~> 1.0)
@ -257,10 +257,6 @@ GEM
guard-rspec (4.3.1) guard-rspec (4.3.1)
guard (~> 2.1) guard (~> 2.1)
rspec (>= 2.14, < 4.0) rspec (>= 2.14, < 4.0)
guard-spork (2.0.1)
childprocess (>= 0.2.3)
guard (~> 2.8.2)
spork (>= 0.8.4)
haml (4.0.5) haml (4.0.5)
tilt tilt
handlebars_assets (0.18) handlebars_assets (0.18)
@ -307,7 +303,7 @@ GEM
actionpack (>= 3.0.0) actionpack (>= 3.0.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
kgio (2.9.2) kgio (2.9.2)
listen (2.8.1) listen (2.8.3)
celluloid (>= 0.15.2) celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3) rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9) rb-inotify (>= 0.9)
@ -538,7 +534,11 @@ GEM
sinon-rails (1.10.3) sinon-rails (1.10.3)
railties (>= 3.1) railties (>= 3.1)
slop (3.6.0) slop (3.6.0)
spork (1.0.0rc4) spring (1.2.0)
spring-commands-cucumber (1.0.1)
spring (>= 0.9.1)
spring-commands-rspec (1.0.2)
spring (>= 0.9.1)
sprockets (2.11.3) sprockets (2.11.3)
hike (~> 1.2) hike (~> 1.2)
multi_json (~> 1.0) multi_json (~> 1.0)
@ -625,10 +625,9 @@ DEPENDENCIES
foreman (= 0.62) foreman (= 0.62)
fuubar (= 2.0.0) fuubar (= 2.0.0)
gon (= 5.2.3) gon (= 5.2.3)
guard (= 2.8.2) guard (= 2.10.0)
guard-cucumber (= 1.5.1) guard-cucumber (= 1.5.1)
guard-rspec (= 4.3.1) guard-rspec (= 4.3.1)
guard-spork (= 2.0.1)
haml (= 4.0.5) haml (= 4.0.5)
handlebars_assets (= 0.18.0) handlebars_assets (= 0.18.0)
http_accept_language (= 2.0.2) http_accept_language (= 2.0.2)
@ -688,7 +687,9 @@ DEPENDENCIES
simple_captcha2 (= 0.3.2) simple_captcha2 (= 0.3.2)
sinatra (= 1.4.5) sinatra (= 1.4.5)
sinon-rails (= 1.10.3) sinon-rails (= 1.10.3)
spork (= 1.0.0rc4) spring (= 1.2.0)
spring-commands-cucumber (= 1.0.1)
spring-commands-rspec (= 1.0.2)
test_after_commit (= 0.4.0) test_after_commit (= 0.4.0)
timecop (= 0.7.1) timecop (= 0.7.1)
twitter (= 4.8.1) twitter (= 4.8.1)

View file

@ -1,7 +1,4 @@
# A sample Guardfile guard :rspec, cmd: 'bin/spring rspec', all_on_start: false, all_after_pass: false do
# More info at https://github.com/guard/guard#readme
# also, http://asciicasts.com/episodes/264-guard
guard 'rspec', :all_on_start => false, :all_after_pass => false do
watch(%r{^spec/.+_spec\.rb$}) watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" } watch('spec/spec_helper.rb') { "spec" }
@ -15,23 +12,12 @@ guard 'rspec', :all_on_start => false, :all_after_pass => false do
watch('spec/spec_helper.rb') { "spec" } watch('spec/spec_helper.rb') { "spec" }
watch('config/routes.rb') { "spec/routing" } watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" } watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara request specs # Capybara request specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" } watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
end end
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' }, :all_on_start => false, :all_after_pass => false, :wait => 70 do guard :cucumber, command_prefix: 'bin/spring', bundler: false, all_on_start: false, all_after_pass: false do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile')
watch('Gemfile.lock')
watch('spec/spec_helper.rb') { :rspec }
watch('test/test_helper.rb') { :test_unit }
watch(%r{features/support/}) { :cucumber }
end
guard 'cucumber', :all_on_start => false, :all_after_pass => false do
watch(%r{^features/.+\.feature$}) watch(%r{^features/.+\.feature$})
watch(%r{^features/support/.+$}) { 'features' } watch(%r{^features/support/.+$}) { 'features' }
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' } watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }

View file

@ -1,3 +1,3 @@
web: bundle exec unicorn_rails -c config/unicorn.rb -p $PORT web: bin/bundle exec unicorn_rails -c config/unicorn.rb -p $PORT
sidekiq: bundle exec sidekiq sidekiq: bin/bundle exec sidekiq
xmpp: bundle exec vines start xmpp: bin/bundle exec vines start

View file

@ -1,16 +0,0 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'autospec' 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('rspec-core', 'autospec')

View file

@ -1,16 +0,0 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'compass' 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('compass', 'compass')

View file

@ -1,16 +1,7 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# begin
# This file was generated by Bundler. load File.expand_path("../spring", __FILE__)
# rescue LoadError
# The application 'cucumber' is installed as part of a gem, and end
# 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' require 'bundler/setup'
load Gem.bin_path('cucumber', 'cucumber') load Gem.bin_path('cucumber', 'cucumber')

View file

@ -1,16 +0,0 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'foreman' 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('foreman', 'foreman')

View file

@ -1,4 +1,8 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
APP_PATH = File.expand_path('../../config/application', __FILE__) APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot' require_relative '../config/boot'
require 'rails/commands' require 'rails/commands'

View file

@ -1,4 +1,8 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
require_relative '../config/boot' require_relative '../config/boot'
require 'rake' require 'rake'
Rake.application.run Rake.application.run

View file

@ -1,16 +1,7 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# begin
# This file was generated by Bundler. load File.expand_path("../spring", __FILE__)
# rescue LoadError
# The application 'rspec' is installed as part of a gem, and end
# 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' require 'bundler/setup'
load Gem.bin_path('rspec-core', 'rspec') load Gem.bin_path('rspec-core', 'rspec')

View file

@ -1,16 +0,0 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'sass' 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('sass', 'sass')

View file

@ -1,16 +0,0 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'sass-convert' 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('sass', 'sass-convert')

View file

@ -1,16 +0,0 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'scss' 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('sass', 'scss')

View file

@ -1,16 +0,0 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'spork' 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('spork', 'spork')

18
bin/spring Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env ruby
# This file loads spring without using Bundler, in order to be fast
# It gets overwritten when you run the `spring binstub` command
unless defined?(Spring)
require "rubygems"
require "bundler"
if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
ENV["GEM_HOME"] = ""
Gem.paths = ENV
gem "spring", match[1]
require "spring/binstub"
end
end

View file

@ -29,9 +29,9 @@ before_fork do |server, worker|
unless AppConfig.single_process_mode? unless AppConfig.single_process_mode?
Sidekiq.redis {|redis| redis.client.disconnect } Sidekiq.redis {|redis| redis.client.disconnect }
end end
if AppConfig.server.embed_sidekiq_worker? if AppConfig.server.embed_sidekiq_worker?
@sidekiq_pid ||= spawn('bundle exec sidekiq') @sidekiq_pid ||= spawn('bin/bundle exec sidekiq')
end end
old_pid = '/var/run/diaspora/diaspora.pid.oldbin' old_pid = '/var/run/diaspora/diaspora.pid.oldbin'

View file

@ -1,109 +1,84 @@
require 'rubygems' require 'rubygems'
prefork = proc do ENV["RAILS_ENV"] ||= "test"
ENV["RAILS_ENV"] ||= "test"
# Have all rests run with english browser locale # Have all rests run with english browser locale
ENV['LANG'] = 'C' ENV['LANG'] = 'C'
require 'cucumber/rails' require 'cucumber/rails'
require 'capybara/rails' require 'capybara/rails'
require 'capybara/cucumber' require 'capybara/cucumber'
require 'capybara/session' require 'capybara/session'
#require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript #require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
# Ensure we know the appservers port # Ensure we know the appservers port
Capybara.server_port = 9887 Capybara.server_port = 9887
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
# order to ease the transition to Capybara we set the default here. If you'd # order to ease the transition to Capybara we set the default here. If you'd
# prefer to use XPath just remove this line and adjust any selectors in your # prefer to use XPath just remove this line and adjust any selectors in your
# steps to use the XPath syntax. # steps to use the XPath syntax.
Capybara.default_selector = :css Capybara.default_selector = :css
# We have a ridiculously high wait time to account for build machines of various beefiness. # We have a ridiculously high wait time to account for build machines of various beefiness.
# Capybara.default_wait_time = 30 # Capybara.default_wait_time = 30
# While there are a lot of failures, wait less, avoiding travis timeout # While there are a lot of failures, wait less, avoiding travis timeout
Capybara.default_wait_time = 15 Capybara.default_wait_time = 15
# If you set this to false, any error raised from within your app will bubble # If you set this to false, any error raised from within your app will bubble
# up to your step definition and out to cucumber unless you catch it somewhere # up to your step definition and out to cucumber unless you catch it somewhere
# on the way. You can make Rails rescue errors and render error pages on a # on the way. You can make Rails rescue errors and render error pages on a
# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag. # per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
# #
# If you set this to true, Rails will rescue all errors and render error # If you set this to true, Rails will rescue all errors and render error
# pages, more or less in the same way your application would behave in the # pages, more or less in the same way your application would behave in the
# default production environment. It's not recommended to do this for all # default production environment. It's not recommended to do this for all
# of your scenarios, as this makes it hard to discover errors in your application. # of your scenarios, as this makes it hard to discover errors in your application.
ActionController::Base.allow_rescue = false ActionController::Base.allow_rescue = false
require 'database_cleaner' require 'database_cleaner'
require 'database_cleaner/cucumber' require 'database_cleaner/cucumber'
DatabaseCleaner.strategy = :truncation DatabaseCleaner.strategy = :truncation
DatabaseCleaner.orm = "active_record" DatabaseCleaner.orm = "active_record"
Cucumber::Rails::World.use_transactional_fixtures = false Cucumber::Rails::World.use_transactional_fixtures = false
require File.join(File.dirname(__FILE__), "database_cleaner_patches") require File.join(File.dirname(__FILE__), "database_cleaner_patches")
require File.join(File.dirname(__FILE__), "integration_sessions_controller") require File.join(File.dirname(__FILE__), "integration_sessions_controller")
require File.join(File.dirname(__FILE__), "poor_mans_webmock") require File.join(File.dirname(__FILE__), "poor_mans_webmock")
require 'sidekiq/testing/inline' require 'sidekiq/testing/inline'
require Rails.root.join('spec', 'helper_methods') require Rails.root.join('spec', 'helper_methods')
require Rails.root.join('spec', 'support', 'inlined_jobs') require Rails.root.join('spec', 'support', 'inlined_jobs')
require Rails.root.join('spec', 'support', 'user_methods') require Rails.root.join('spec', 'support', 'user_methods')
include HelperMethods include HelperMethods
# require 'webmock/cucumber' # require 'webmock/cucumber'
# WebMock.disable_net_connect!(:allow_localhost => true) # WebMock.disable_net_connect!(:allow_localhost => true)
Before do
Devise.mailer.deliveries = []
end
#hax to get rubymine to run spork, set RUBYMINE_HOME in your .bash_profile After do
if ENV["RUBYMINE_HOME"] if Capybara.current_session.driver.respond_to?(:browser)
puts "Loading rubymine spork extensions" Capybara.reset_sessions!
$:.unshift(File.expand_path("rb/testing/patch/common", ENV["RUBYMINE_HOME"])) # Capybara.current_session.driver.browser.manage.delete_all_cookies
$:.unshift(File.expand_path("rb/testing/patch/bdd", ENV["RUBYMINE_HOME"]))
end end
end end
each_run = proc do Before('@localserver') do
Before do TestServerFixture.start_if_needed
DatabaseCleaner.clean CapybaraSettings.instance.save
Devise.mailer.deliveries = [] Capybara.current_driver = :selenium
end Capybara.run_server = false
After do
if Capybara.current_session.driver.respond_to?(:browser)
Capybara.reset_sessions!
# Capybara.current_session.driver.browser.manage.delete_all_cookies
end
end
Before('@localserver') do
TestServerFixture.start_if_needed
CapybaraSettings.instance.save
Capybara.current_driver = :selenium
Capybara.run_server = false
end
After('@localserver') do
CapybaraSettings.instance.restore
end
end end
begin After('@localserver') do
require 'spork' CapybaraSettings.instance.restore
#uncomment the following line to use spork with the debugger
#require 'spork/ext/ruby-debug'
Spork.prefork(&prefork)
Spork.each_run(&each_run)
rescue LoadError
prefork.call
each_run.call
end end
# give firefox more time to complete requests # give firefox more time to complete requests

View file

@ -46,7 +46,7 @@ module Configuration
File.dirname(__FILE__) File.dirname(__FILE__)
) )
unless File.exist? token_file unless File.exist? token_file
`bundle exec rake generate:secret_token` `bin/rake generate:secret_token`
end end
require token_file require token_file
Diaspora::Application.config.secret_key_base Diaspora::Application.config.secret_key_base

View file

@ -168,7 +168,7 @@ diaspora_setup() {
prepare_gem_bundle prepare_gem_bundle
log_inf "creating the default database specified in config/database.yml. please wait..." log_inf "creating the default database specified in config/database.yml. please wait..."
run_or_error "bundle exec rake db:schema:load_if_ruby --trace" run_or_error "bin/rake db:schema:load_if_ruby --trace"
printf "\n" printf "\n"
printf "$GOODBYE_MSG" printf "$GOODBYE_MSG"

View file

@ -64,14 +64,14 @@ fi
# Setup environment # Setup environment
if [ -z "$RAILS_ENV" ] if [ -z "$RAILS_ENV" ]
then then
RAILS_ENV=$(bundle exec ruby ./script/get_config.rb server.rails_environment) RAILS_ENV=$(bin/bundle exec ruby ./script/get_config.rb server.rails_environment)
on_failure "Couldn't parse config/diaspora.yml!" on_failure "Couldn't parse config/diaspora.yml!"
export RAILS_ENV export RAILS_ENV
fi fi
os=$(uname -s) os=$(uname -s)
vars=$(bundle exec ruby ./script/get_config.rb \ vars=$(bin/bundle exec ruby ./script/get_config.rb \
port=server.port \ port=server.port \
single_process_mode=environment.single_process_mode? \ single_process_mode=environment.single_process_mode? \
embed_sidekiq_worker=server.embed_sidekiq_worker \ embed_sidekiq_worker=server.embed_sidekiq_worker \
@ -125,7 +125,7 @@ then
fatal "You're running in production mode without having assets fatal "You're running in production mode without having assets
precompiled. Now and after each update before you restart the precompiled. Now and after each update before you restart the
application, run: application, run:
bundle exec rake assets:precompile" bin/rake assets:precompile"
fi fi
# Check for old curl versions (see https://github.com/diaspora/diaspora/issues/4202) # Check for old curl versions (see https://github.com/diaspora/diaspora/issues/4202)
@ -173,4 +173,4 @@ else
fi fi
echo "" echo ""
exec bundle exec foreman start -m "xmpp=$vines,web=1,sidekiq=$workers" -p $port exec bin/bundle exec foreman start -m "xmpp=$vines,web=1,sidekiq=$workers" -p $port

View file

@ -2,114 +2,95 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
prefork = proc do ENV["RAILS_ENV"] ||= 'test'
# Loading more in this block will cause your tests to run faster. However, require File.join(File.dirname(__FILE__), '..', 'config', 'environment')
# if you change any configuration or code from libraries loaded here, you'll require Rails.root.join('spec', 'helper_methods')
# need to restart spork for it take effect. require Rails.root.join('spec', 'spec-doc')
require 'rspec/rails'
require 'webmock/rspec'
require 'factory_girl'
require 'sidekiq/testing'
#require "rails/application" include HelperMethods
#Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
ENV["RAILS_ENV"] ||= 'test' Dir["#{File.dirname(__FILE__)}/shared_behaviors/**/*.rb"].each do |f|
require File.join(File.dirname(__FILE__), '..', 'config', 'environment') require f
require Rails.root.join('spec', 'helper_methods')
require Rails.root.join('spec', 'spec-doc')
require 'rspec/rails'
require 'webmock/rspec'
require 'factory_girl'
require 'sidekiq/testing'
include HelperMethods
Dir["#{File.dirname(__FILE__)}/shared_behaviors/**/*.rb"].each do |f|
require f
end
ProcessedImage.enable_processing = false
UnprocessedImage.enable_processing = false
def set_up_friends
[local_luke, local_leia, remote_raphael]
end
def alice
@alice ||= User.where(:username => 'alice').first
end
def bob
@bob ||= User.where(:username => 'bob').first
end
def eve
@eve ||= User.where(:username => 'eve').first
end
def local_luke
@local_luke ||= User.where(:username => 'luke').first
end
def local_leia
@local_leia ||= User.where(:username => 'leia').first
end
def remote_raphael
@remote_raphael ||= Person.where(:diaspora_handle => 'raphael@remote.net').first
end
def photo_fixture_name
@photo_fixture_name = File.join(File.dirname(__FILE__), 'fixtures', 'button.png')
end
# Force fixture rebuild
FileUtils.rm_f(Rails.root.join('tmp', 'fixture_builder.yml'))
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
fixture_builder_file = "#{File.dirname(__FILE__)}/support/fixture_builder.rb"
support_files = Dir["#{File.dirname(__FILE__)}/support/**/*.rb"] - [fixture_builder_file]
support_files.each {|f| require f }
require fixture_builder_file
RSpec.configure do |config|
config.include Devise::TestHelpers, :type => :controller
config.mock_with :rspec
config.render_views
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
config.before(:each) do
I18n.locale = :en
stub_request(:post, "https://pubsubhubbub.appspot.com/")
disable_typhoeus
$process_queue = false
allow_any_instance_of(Postzord::Dispatcher::Public).to receive(:deliver_to_remote)
allow_any_instance_of(Postzord::Dispatcher::Private).to receive(:deliver_to_remote)
end
config.expect_with :rspec do |expect_config|
expect_config.syntax = :expect
end
config.after(:all) do
`rm -rf #{Rails.root}/tmp/uploads/*`
end
# Reset overridden settings
config.after(:each) do
AppConfig.reset_dynamic!
end
end
end end
begin ProcessedImage.enable_processing = false
require 'spork' UnprocessedImage.enable_processing = false
#uncomment the following line to use spork with the debugger
#require 'spork/ext/ruby-debug'
Spork.prefork(&prefork) def set_up_friends
rescue LoadError [local_luke, local_leia, remote_raphael]
prefork.call end
def alice
@alice ||= User.where(:username => 'alice').first
end
def bob
@bob ||= User.where(:username => 'bob').first
end
def eve
@eve ||= User.where(:username => 'eve').first
end
def local_luke
@local_luke ||= User.where(:username => 'luke').first
end
def local_leia
@local_leia ||= User.where(:username => 'leia').first
end
def remote_raphael
@remote_raphael ||= Person.where(:diaspora_handle => 'raphael@remote.net').first
end
def photo_fixture_name
@photo_fixture_name = File.join(File.dirname(__FILE__), 'fixtures', 'button.png')
end
# Force fixture rebuild
FileUtils.rm_f(Rails.root.join('tmp', 'fixture_builder.yml'))
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
fixture_builder_file = "#{File.dirname(__FILE__)}/support/fixture_builder.rb"
support_files = Dir["#{File.dirname(__FILE__)}/support/**/*.rb"] - [fixture_builder_file]
support_files.each {|f| require f }
require fixture_builder_file
RSpec.configure do |config|
config.include Devise::TestHelpers, :type => :controller
config.mock_with :rspec
config.render_views
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
config.before(:each) do
I18n.locale = :en
stub_request(:post, "https://pubsubhubbub.appspot.com/")
disable_typhoeus
$process_queue = false
allow_any_instance_of(Postzord::Dispatcher::Public).to receive(:deliver_to_remote)
allow_any_instance_of(Postzord::Dispatcher::Private).to receive(:deliver_to_remote)
end
config.expect_with :rspec do |expect_config|
expect_config.syntax = :expect
end
config.after(:all) do
`rm -rf #{Rails.root}/tmp/uploads/*`
end
# Reset overridden settings
config.after(:each) do
AppConfig.reset_dynamic!
end
end end
# https://makandracards.com/makandra/950-speed-up-rspec-by-deferring-garbage-collection # https://makandracards.com/makandra/950-speed-up-rspec-by-deferring-garbage-collection