Almost ready to merge

This commit is contained in:
Godwin
2015-08-18 22:18:29 -07:00
parent 9da5f6a223
commit c3aec0b71e
500 changed files with 38042 additions and 5761 deletions
+34 -48
View File
@@ -39,45 +39,30 @@ rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
add_translations = Array.new
#Carmen::World.instance.subregions.each { |country|
# add_translations << "world.#{country.code.downcase}.name"
# if country.subregions?
# country.subregions.each { |region| add_translations << "world.#{country.code.downcase}.#{region.code.downcase}.name" }
# end
#}
#I18n::Backend::BikeBike::init_tests!# add_translations
#at_exit do
# I18n::Backend::BikeBike::end_tests!
#end
#Before('@javascript') do
# ActiveRecord::Base.shared_connection = nil
# ActiveRecord::Base.descendants.each do |model|
# model.shared_connection = nil
# end
#end
Before do
#DatabaseCleaner.start
#Translation.connection.execute("INSERT INTO translations (locale, key, value) VALUES('en', 'time.formats.date', '%B %d, %Y');")
#Translation.connection.execute("INSERT INTO translations (locale, key, value, is_proc) VALUES('en', 'date.month_names', '[\"~\", \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]', TRUE);")
#ConferenceType.connection.execute("INSERT INTO conference_types (slug) VALUES ('bikebike'), ('regional'), ('bici-congreso')")
#WorkshopStream.connection.execute("INSERT INTO workshop_streams (slug) VALUES ('mechanics'), ('leisure'), ('interorganizational_relations'), ('ethics_public_relations'), ('organization_management')")
#WorkshopPresentationStyle.connection.execute("INSERT INTO workshop_presentation_styles (slug) VALUES ('discussion'), ('panel'), ('presentation'), ('hands-on'), ('other')")
#host! 'en.bikebike.org'
ApplicationController::set_host 'en.bikebike.org'
ApplicationController::set_location nil
Before('@javascript') do
ActiveRecord::Base.shared_connection = nil
ActiveRecord::Base.descendants.each do |model|
model.shared_connection = nil
end
end
#After do |scenario|
# save_and_open_page if scenario.failed?
#end
Before do
#ApplicationController::set_host 'en.bikebike.org'
#ApplicationController::set_location nil
end
#After do
# DatabaseCleaner.clean
After do |scenario|
#save_and_open_page if scenario.failed?
puts " = PAGE START = \n#{page.html}\n = PAGE END = " if scenario.failed?
#puts page.find('#main')['innerHTML'] if scenario.failed?
end
After do
DatabaseCleaner.clean
end
#After('suite') do
# puts " ============ #{After all} ============ "
#end
# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
@@ -98,21 +83,22 @@ end
# Possible values are :truncation and :transaction
# The :transaction strategy is faster, but might give you threading problems.
# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
#Cucumber::Rails::Database.javascript_strategy = :transaction
#Capybara.register_driver :poltergeist_debug do |app|
# Capybara::Poltergeist::Driver.new(app, :timeout => 120, inspector: true)
#end
#Capybara.javascript_driver = :lingua_franca_poltergeist
#Geocoder.configure(:timeout => 60)
Capybara.configure do |c|
c.run_server = true
c.javascript_driver = :lingua_franca_poltergeist
c.default_driver = :lingua_franca_poltergeist
Capybara.register_driver :bb_poltergeist do |app|
Capybara::LinguaFrancaPoltergeist::Driver.new(app, :inspector => true, :timeout => 120)
end
Cucumber::Rails::Database.javascript_strategy = :transaction
Capybara.default_driver = :bb_poltergeist
Capybara.javascript_driver = :bb_poltergeist
Geocoder.configure(:timeout => 60)
def locate(id)
page.find('[id$="' + id.gsub(/\s+/, '_') + '"]')[:id]
id = id.gsub(/\s+/, '_')
e = page.all("[name=\"#{id}\"], [id=\"#{id}\"]")
if e.length
return e.first[:id]
end
page.all("[name$=\"#{id}\"], [id$=\"#{id}\"]").first[:id]
end
def create_org(name = nil, location = nil)
+1
View File
@@ -9,6 +9,7 @@ FactoryGirl.define do
start_date Date.today - 30.days
end_date Date.today - 26.days
conference_type_id (ConferenceType.find_by(:slug => 'bikebike') || ConferenceType.create(:slug => 'bikebike')).id
paypal_username 'joe'
end
factory :org, :class => 'Organization' do
+15 -23
View File
@@ -1,37 +1,29 @@
module NavigationHelpers
def path_to(page_name)
append_root = false
case page_name
def path_to(path)
path = path.to_sym
case path
when /^landing$/i
path = :home
when /^confirmation$/i
path = "/conferences/bikebike/#{@last_conference.slug}/register/confirm/#{@last_registration.confirmation_token}"
when /^registration$/i
path = "/conferences/bikebike/#{@last_conference.slug}/register/"
when /^pay registration$/i
path = "/conferences/bikebike/#{@last_conference.slug}/register/pay-registration/#{@last_registration.confirmation_token}"
when /^confirm paypal$/i
path = "/conferences/bikebike/#{@last_conference.slug}/register/paypal-confirm/#{@last_registration.payment_confirmation_token}"
when /^cancel paypal$/i
path = "/conferences/bikebike/#{@last_conference.slug}/register/paypal-cancel/#{@last_registration.confirmation_token}"
when /^translation list$/i
path = '/translations/'
when /^(.+) translations?$/i
path = '/translations/' + get_language_code(Regexp.last_match(1))
when /^organization list$/i
path = '/organizations/'
path = "/conferences/#{@last_conference.slug}/register/"
when /^(workshops|stats|broadcast)$/i
path = "/conferences/#{@last_conference.slug}/#{path}/"
end
if path.is_a?(Symbol)
begin
path = self.send((path.to_s + '_url').to_sym).gsub(/^http:\/\/.+?(\/.*)$/, '\1')
path = Rails.application.routes.url_helpers.send("#{path}_path".to_sym)
rescue Object => e
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
"#{path}_url\n" +
"Now, go and add a mapping in #{__FILE__}"
raise "Can't find mapping from \"#{path}\" to a path."
end
end
path
if path.blank?
raise "Can't find mapping from \"#{page_name}\" to a path."
end
return path
end
end