Sha256: c960e16024226a8e2e4b84e99ff498d270e68e336069a174e8755669cb77fe98

Contents?: true

Size: 892 Bytes

Versions: 8

Compression:

Stored size: 892 Bytes

Contents

# you can delete this file if you don't use Rails Test Fixtures

fixtures_dir = command_options.try(:[], 'fixtures_dir')
fixture_files = command_options.try(:[], 'fixtures')

if defined?(ActiveRecord)
  require "active_record/fixtures"

  fixtures_dir ||= ActiveRecord::Tasks::DatabaseTasks.fixtures_path
  fixture_files ||= Dir["#{fixtures_dir}/**/*.yml"].map { |f| f[(fixtures_dir.size + 1)..-5] }

  logger.debug "loading fixtures: { dir: #{fixtures_dir}, files: #{fixture_files} }"
  ActiveRecord::FixtureSet.reset_cache
  ActiveRecord::FixtureSet.create_fixtures(fixtures_dir, fixture_files)
else # this else part can be removed
  logger.error "Looks like activerecord_fixtures has to be modified to suite your need"
  Post.create(title: 'MyCypressFixtures')
  Post.create(title: 'MyCypressFixtures2')
  Post.create(title: 'MyRailsFixtures')
  Post.create(title: 'MyRailsFixtures2')
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cypress-on-rails-1.4.2 lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/activerecord_fixtures.rb
cypress-on-rails-1.4.1 lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/activerecord_fixtures.rb
cypress-on-rails-1.4.0 lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/activerecord_fixtures.rb
cypress-on-rails-1.3.0 lib/generators/cypress_dev/templates/spec/cypress/app_commands/activerecord_fixtures.rb
cypress-on-rails-1.2.1 lib/generators/cypress_dev/templates/spec/cypress/app_commands/activerecord_fixtures.rb
cypress-on-rails-1.2.0 lib/generators/cypress_dev/templates/spec/cypress/app_commands/activerecord_fixtures.rb
cypress-on-rails-1.1.1 lib/generators/cypress_dev/templates/spec/cypress/app_commands/activerecord_fixtures.rb
cypress-on-rails-1.1.0 lib/generators/cypress_dev/templates/spec/cypress/app_commands/activerecord_fixtures.rb