Skip to content
Extraits de code Groupes Projets
Valider adf85e1e rédigé par Maxwell Salzberg's avatar Maxwell Salzberg
Parcourir les fichiers

adding a bit to tubbo's spork branch

parent 98b41d8f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -3,3 +3,4 @@ ...@@ -3,3 +3,4 @@
--color --color
--tag ~performance --tag ~performance
--order random --order random
--drb
\ No newline at end of file
...@@ -149,6 +149,11 @@ group :test do ...@@ -149,6 +149,11 @@ group :test do
gem 'webmock', :require => false gem 'webmock', :require => false
gem 'sqlite3' gem 'sqlite3'
gem 'mock_redis' gem 'mock_redis'
gem 'spork', '~> 1.0rc'
gem 'guard-rspec'
gem 'guard-spork'
gem 'guard-cucumber'
end end
group :development do group :development do
......
...@@ -193,6 +193,17 @@ GEM ...@@ -193,6 +193,17 @@ GEM
gem_plugin (0.2.3) gem_plugin (0.2.3)
gherkin (2.9.3) gherkin (2.9.3)
json (>= 1.4.6) json (>= 1.4.6)
guard (1.0.1)
ffi (>= 0.5.0)
thor (~> 0.14.6)
guard-cucumber (0.7.5)
cucumber (>= 0.10)
guard (>= 0.8.3)
guard-rspec (0.7.0)
guard (>= 0.10.0)
guard-spork (0.5.2)
guard (>= 0.10.0)
spork (>= 0.8.4)
haml (3.1.4) haml (3.1.4)
handlebars_assets (0.4.1) handlebars_assets (0.4.1)
execjs (>= 1.2.9) execjs (>= 1.2.9)
...@@ -405,6 +416,7 @@ GEM ...@@ -405,6 +416,7 @@ GEM
rack (~> 1.3, >= 1.3.6) rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2) rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3) tilt (~> 1.3, >= 1.3.3)
spork (1.0.0rc2)
sprockets (2.0.3) sprockets (2.0.3)
hike (~> 1.2) hike (~> 1.2)
rack (~> 1.0) rack (~> 1.0)
...@@ -485,6 +497,9 @@ DEPENDENCIES ...@@ -485,6 +497,9 @@ DEPENDENCIES
foreigner (~> 1.1.0) foreigner (~> 1.1.0)
foreman (= 0.34.1) foreman (= 0.34.1)
fuubar (= 0.0.6) fuubar (= 0.0.6)
guard-cucumber
guard-rspec
guard-spork
haml haml
handlebars_assets handlebars_assets
heroku heroku
...@@ -538,6 +553,7 @@ DEPENDENCIES ...@@ -538,6 +553,7 @@ DEPENDENCIES
sass-rails (= 3.1.4) sass-rails (= 3.1.4)
selenium-webdriver (~> 2.16.0) selenium-webdriver (~> 2.16.0)
settingslogic! settingslogic!
spork (~> 1.0rc)
sqlite3 sqlite3
thin (~> 1.3.1) thin (~> 1.3.1)
timecop timecop
......
...@@ -18,3 +18,21 @@ guard 'rspec', :version => 2, :all_on_start => false do ...@@ -18,3 +18,21 @@ guard 'rspec', :version => 2, :all_on_start => false do
# 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 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' do
watch(%r{^features/.+\.feature$})
watch(%r{^features/support/.+$}) { 'features' }
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
end
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. require 'rubygems'
# It is recommended to regenerate this file in the future when you upgrade to a require 'spork'
# newer version of cucumber-rails. Consider adding your own code to a new file #uncomment the following line to use spork with the debugger
# instead of editing this one. Cucumber will automatically load all features/**/*.rb #require 'spork/ext/ruby-debug'
# files.
Spork.prefork do
ENV["RAILS_ENV"] ||= "test" ENV["RAILS_ENV"] ||= "test"
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
require 'cucumber/api_steps' require 'cucumber/api_steps'
# 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
# order to ease the transition to Capybara we set the default here. If you'd # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
# prefer to use XPath just remove this line and adjust any selectors in your # order to ease the transition to Capybara we set the default here. If you'd
# steps to use the XPath syntax. # prefer to use XPath just remove this line and adjust any selectors in your
Capybara.default_selector = :css # steps to use the XPath syntax.
Capybara.default_selector = :css
# We have a ridiculously high wait time to account for build machines of various beefiness.
# Capybara.default_wait_time = 30 # We have a ridiculously high wait time to account for build machines of various beefiness.
# Capybara.default_wait_time = 30
# While there are a lot of failures, wait less, avoiding travis timeout
Capybara.default_wait_time = 3 # While there are a lot of failures, wait less, avoiding travis timeout
Capybara.default_wait_time = 3
# 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 # If you set this to false, any error raised from within your app will bubble
# on the way. You can make Rails rescue errors and render error pages on a # up to your step definition and out to cucumber unless you catch it somewhere
# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag. # 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.
# 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 # If you set this to true, Rails will rescue all errors and render error
# default production environment. It's not recommended to do this for all # pages, more or less in the same way your application would behave in the
# of your scenarios, as this makes it hard to discover errors in your application. # default production environment. It's not recommended to do this for all
ActionController::Base.allow_rescue = false # of your scenarios, as this makes it hard to discover errors in your application.
ActionController::Base.allow_rescue = false
require 'database_cleaner'
require 'database_cleaner/cucumber' require 'database_cleaner'
DatabaseCleaner.strategy = :truncation require 'database_cleaner/cucumber'
DatabaseCleaner.orm = "active_record" DatabaseCleaner.strategy = :truncation
Cucumber::Rails::World.use_transactional_fixtures = false DatabaseCleaner.orm = "active_record"
Cucumber::Rails::World.use_transactional_fixtures = false
require File.join(File.dirname(__FILE__), "database_cleaner_patches")
require File.join(File.dirname(__FILE__), "integration_sessions_controller") require File.join(File.dirname(__FILE__), "database_cleaner_patches")
require File.join(File.dirname(__FILE__), "poor_mans_webmock") require File.join(File.dirname(__FILE__), "integration_sessions_controller")
require File.join(File.dirname(__FILE__), "poor_mans_webmock")
require File.join(File.dirname(__FILE__), "..", "..", "spec", "helper_methods")
require File.join(File.dirname(__FILE__), "..", "..", "spec", "support","user_methods") require File.join(File.dirname(__FILE__), "..", "..", "spec", "helper_methods")
include HelperMethods require File.join(File.dirname(__FILE__), "..", "..", "spec", "support","user_methods")
include HelperMethods
require 'webmock/cucumber'
WebMock.disable_net_connect!(:allow_localhost => true) require 'webmock/cucumber'
WebMock.disable_net_connect!(:allow_localhost => true)
Before do
@no_follow_diaspora_hq_setting = AppConfig[:no_follow_diasporahq] silence_warnings do
AppConfig[:no_follow_diasporahq] = true SERVICES['facebook'] = {'app_id' => :fake, 'app_secret' => 'sdoigjosdfijg'}
DatabaseCleaner.clean AppConfig[:configured_services] << 'facebook'
Devise.mailer.deliveries = []
end
After do
AppConfig[:no_follow_diasporahq] = @no_follow_diaspora_hq_setting
if Capybara.current_session.driver.respond_to?(:browser)
Capybara.reset_sessions!
# Capybara.current_session.driver.browser.manage.delete_all_cookies
end end
end
silence_warnings do require File.join(File.dirname(__FILE__), "..", "..", "spec", "support", "fake_resque")
SERVICES['facebook'] = {'app_id' => :fake, 'app_secret' => 'sdoigjosdfijg'}
AppConfig[:configured_services] << 'facebook'
end
require File.join(File.dirname(__FILE__), "..", "..", "spec", "support", "fake_resque") require File.join(File.dirname(__FILE__), 'run_resque_in_process')
require File.join(File.dirname(__FILE__), 'run_resque_in_process') end
Spork.each_run do
Before do
@no_follow_diaspora_hq_setting = AppConfig[:no_follow_diasporahq]
AppConfig[:no_follow_diasporahq] = true
DatabaseCleaner.clean
Devise.mailer.deliveries = []
end
Before('@localserver') do After do
TestServerFixture.start_if_needed AppConfig[:no_follow_diasporahq] = @no_follow_diaspora_hq_setting
CapybaraSettings.instance.save if Capybara.current_session.driver.respond_to?(:browser)
Capybara.current_driver = :selenium Capybara.reset_sessions!
Capybara.run_server = false # Capybara.current_session.driver.browser.manage.delete_all_cookies
end end
end
After('@localserver') do Before('@localserver') do
CapybaraSettings.instance.restore TestServerFixture.start_if_needed
end CapybaraSettings.instance.save
Capybara.current_driver = :selenium
Capybara.run_server = false
end
After('@localserver') do
CapybaraSettings.instance.restore
end
end
\ No newline at end of file
...@@ -2,89 +2,102 @@ ...@@ -2,89 +2,102 @@
# 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.
ENV["RAILS_ENV"] ||= 'test' require 'rubygems'
require File.join(File.dirname(__FILE__), '..', 'config', 'environment') unless defined?(Rails) require 'spork'
require 'helper_methods' #uncomment the following line to use spork with the debugger
require 'spec-doc' #require 'spork/ext/ruby-debug'
require 'rspec/rails'
require 'webmock/rspec' Spork.prefork do
require 'factory_girl' # 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
include HelperMethods # need to restart spork for it take effect.
# Force fixture rebuild ENV["RAILS_ENV"] ||= 'test'
FileUtils.rm_f(File.join(Rails.root, 'tmp', 'fixture_builder.yml')) require File.join(File.dirname(__FILE__), '..', 'config', 'environment') unless defined?(Rails)
require 'helper_methods'
# Requires supporting files with custom matchers and macros, etc, require 'spec-doc'
# in ./support/ and its subdirectories. require 'rspec/rails'
fixture_builder_file = "#{File.dirname(__FILE__)}/support/fixture_builder.rb" require 'webmock/rspec'
support_files = Dir["#{File.dirname(__FILE__)}/support/**/*.rb"] - [fixture_builder_file] require 'factory_girl'
support_files.each {|f| require f }
require fixture_builder_file include HelperMethods
RSpec.configure do |config| Dir["#{File.dirname(__FILE__)}/shared_behaviors/**/*.rb"].each do |f|
config.include Devise::TestHelpers, :type => :controller require f
config.mock_with :rspec
config.use_transactional_fixtures = true
config.before(:each) do
I18n.locale = :en
stub_request(:post, "https://pubsubhubbub.appspot.com/")
disable_typhoeus
$process_queue = false
Postzord::Dispatcher::Public.any_instance.stub(:deliver_to_remote)
Postzord::Dispatcher::Private.any_instance.stub(:deliver_to_remote)
end end
config.before(:each, :type => :controller) do ProcessedImage.enable_processing = false
self.class.render_views UnprocessedImage.enable_processing = false
end
config.after(:all) do def set_up_friends
`rm -rf #{Rails.root}/tmp/uploads/*` [local_luke, local_leia, remote_raphael]
end end
end
Dir["#{File.dirname(__FILE__)}/shared_behaviors/**/*.rb"].each do |f|
require f
end
ProcessedImage.enable_processing = false def alice
UnprocessedImage.enable_processing = false @alice ||= User.where(:username => 'alice').first
end
AppConfig.load!
AppConfig.setup!
def set_up_friends def bob
[local_luke, local_leia, remote_raphael] @bob ||= User.where(:username => 'bob').first
end end
def alice def eve
@alice ||= User.where(:username => 'alice').first @eve ||= User.where(:username => 'eve').first
end end
def bob def local_luke
@bob ||= User.where(:username => 'bob').first @local_luke ||= User.where(:username => 'luke').first
end end
def eve def local_leia
@eve ||= User.where(:username => 'eve').first @local_leia ||= User.where(:username => 'leia').first
end end
def local_luke def remote_raphael
@local_luke ||= User.where(:username => 'luke').first @remote_raphael ||= Person.where(:diaspora_handle => 'raphael@remote.net').first
end end
def local_leia def photo_fixture_name
@local_leia ||= User.where(:username => 'leia').first @photo_fixture_name = File.join(File.dirname(__FILE__), 'fixtures', 'button.png')
end end
def remote_raphael # Force fixture rebuild
@remote_raphael ||= Person.where(:diaspora_handle => 'raphael@remote.net').first FileUtils.rm_f(File.join(Rails.root, '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.use_transactional_fixtures = true
config.before(:each) do
I18n.locale = :en
stub_request(:post, "https://pubsubhubbub.appspot.com/")
disable_typhoeus
$process_queue = false
Postzord::Dispatcher::Public.any_instance.stub(:deliver_to_remote)
Postzord::Dispatcher::Private.any_instance.stub(:deliver_to_remote)
end
config.before(:each, :type => :controller) do
self.class.render_views
end
config.after(:all) do
`rm -rf #{Rails.root}/tmp/uploads/*`
end
end
end end
def photo_fixture_name Spork.each_run do
@photo_fixture_name = File.join(File.dirname(__FILE__), 'fixtures', 'button.png') # This code will be run each time you run your specs.
AppConfig.load!
AppConfig.setup!
end end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter