Skip to content

Instantly share code, notes, and snippets.

@bobbytables
Created December 11, 2012 04:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobbytables/4255977 to your computer and use it in GitHub Desktop.
Save bobbytables/4255977 to your computer and use it in GitHub Desktop.
gem "capybara", "~> 2.0.1"
gem "database_cleaner", "~> 0.9.1"

# We're using this version until it gets merged in to support Capybara v2
# https://github.com/jonleighton/poltergeist/pull/208
gem "poltergeist", git: "https://github.com/brutuscat/poltergeist.git"

Failure/Error: Then the relied on field is not displayed
     Capybara::ElementNotFound:
       Unable to find xpath "//input[@name='field_2']"
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'awesome_print'
require 'database_cleaner'

# WebKit Javascript for acceptance
require "turnip/capybara"
require "capybara/poltergeist"
Capybara.javascript_driver = :poltergeist

# Make everything go to STDOUT with this line
# Rails.config.logger = Logger.new(STDOUT)

# 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| require f}

# Turnip step definitions
Dir[Rails.root.join("spec/steps/**/*_steps.rb")].each {|f| load f, true }

RSpec.configure do |config|
  config.infer_base_class_for_anonymous_controllers = false
  config.use_transactional_fixtures = false
  # config.order = "random"

  config.include StepHelpers
  config.before(:suite) do
    DatabaseCleaner.strategy = :truncation
    DatabaseCleaner.clean_with :truncation
  end

  config.before(:each) do
    DatabaseCleaner.start
  end

  config.after(:each) do
    DatabaseCleaner.clean
  end
end
Connecting to database specified by database.yml
   (0.3ms)  ALTER TABLE "fields" DISABLE TRIGGER ALL;ALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "hits" DISABLE TRIGGER ALL
   (1.1ms)  select table_name from information_schema.views where table_schema = 'hitmen_test'
   (5.3ms)  TRUNCATE TABLE "fields", "hits" RESTART IDENTITY CASCADE;
   (0.2ms)  ALTER TABLE "fields" ENABLE TRIGGER ALL;ALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "hits" ENABLE TRIGGER ALL
   (0.1ms)  BEGIN
  SQL (5.6ms)  INSERT INTO "hits" ("assignments", "created_at", "description", "duration", "keywords", "mturk_id", "reward", "title", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id"  [["assignments", 3], ["created_at", Mon, 10 Dec 2012 21:02:59 PST -08:00], ["description", "MyText"], ["duration", 1], ["keywords", "MyText"], ["mturk_id", nil], ["reward", #<BigDecimal:7fe441c52ce0,'0.999E1',18(18)>], ["title", "MyString"], ["updated_at", Mon, 10 Dec 2012 21:02:59 PST -08:00]]
   (0.2ms)  COMMIT
   (0.1ms)  BEGIN
  SQL (0.9ms)  INSERT INTO "fields" ("created_at", "hit_id", "label", "name", "relies_on", "relies_on_value", "type_cd", "updated_at", "value") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id"  [["created_at", Mon, 10 Dec 2012 21:02:59 PST -08:00], ["hit_id", 1], ["label", "MyString"], ["name", "field_1"], ["relies_on", nil], ["relies_on_value", nil], ["type_cd", 2], ["updated_at", Mon, 10 Dec 2012 21:02:59 PST -08:00], ["value", "MyText"]]
   (0.3ms)  COMMIT
   (0.0ms)  BEGIN
  SQL (0.3ms)  INSERT INTO "fields" ("created_at", "hit_id", "label", "name", "relies_on", "relies_on_value", "type_cd", "updated_at", "value") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id"  [["created_at", Mon, 10 Dec 2012 21:02:59 PST -08:00], ["hit_id", 1], ["label", "MyString"], ["name", "field_2"], ["relies_on", 1], ["relies_on_value", "testing123"], ["type_cd", 2], ["updated_at", Mon, 10 Dec 2012 21:02:59 PST -08:00], ["value", "MyText"]]
   (0.3ms)  COMMIT


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment