Sha256: 708cfdfc0ba6a42ff571bcbe94255b1bd3ebfd5bb603007d07cdf30d3511db52

Contents?: true

Size: 1.38 KB

Versions: 15

Compression:

Stored size: 1.38 KB

Contents

ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rails'
require 'capybara/rspec'
require 'factory_girl_rails'
require 'database_cleaner'
require 'pry-rails'

Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

ActiveRecord::Migration.maintain_test_schema!

RSpec.configure do |config|
  config.use_transactional_fixtures = false
  config.before(:each) do
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.clean_with(:truncation)
  end
  config.infer_base_class_for_anonymous_controllers = false
  config.order = "random"
  config.include Capybara::DSL
  config.include FactoryGirl::Syntax::Methods
  config.include Rails.application.routes.url_helpers
end

def people_displayed(page)
  page.first("table.outer-list").first("tbody.items").all(:xpath, "tr[not(@id='pagination-row')]").count
end

def set_rails_datetime(time, id_prefix)
  select time.year, from: "#{id_prefix}_1i"
  select time.strftime("%B"), from: "#{id_prefix}_2i"
  begin
    select time.day, from: "#{id_prefix}_3i" #This could raise ambiguous match error
  rescue
    puts "set_rails_datetime() rescued an error. Day was #{time.day} not selected."
  end
  #pad with zeros to disambiguate
  select(('%02i' % time.hour), from: "#{id_prefix}_4i")
  select(('%02i' % time.min), from: "#{id_prefix}_5i")
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
controller_scaffolding-1.4.4 test/dummy/spec/spec_helper.rb
controller_scaffolding-1.4.3 test/dummy/spec/spec_helper.rb
controller_scaffolding-1.4.2 test/dummy/spec/spec_helper.rb
controller_scaffolding-1.4.1 test/dummy/spec/spec_helper.rb
controller_scaffolding-1.4.0 test/dummy/spec/spec_helper.rb
controller_scaffolding-1.3.0 test/dummy/spec/spec_helper.rb
controller_scaffolding-1.2.0 test/dummy/spec/spec_helper.rb
controller_scaffolding-1.1.1 test/dummy/spec/spec_helper.rb
controller_scaffolding-1.1.0 test/dummy/spec/spec_helper.rb
controller_scaffolding-1.0.4 test/dummy/spec/spec_helper.rb
controller_scaffolding-1.0.3 test/dummy/spec/spec_helper.rb
controller_scaffolding-1.0.2 test/dummy/spec/spec_helper.rb
controller_scaffolding-1.0.1 test/dummy/spec/spec_helper.rb
controller_scaffolding-1.0.0 test/dummy/spec/spec_helper.rb
controller_scaffolding-0.1.5 test/dummy/spec/spec_helper.rb