Sha256: f1f0d78906f07e00ce15d1cbf89f13981b574a254a8541a3d04ffc31f4e60eda

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

require 'rails'
require 'rails/all'
require 'active_support/core_ext'

require 'pry-rails'

# Initialize our test app

class TestApp < Rails::Application
  config.active_support.deprecation = :log
  config.eager_load = false

  config.secret_token = 'a' * 100

  config.root = File.expand_path('../..', __FILE__)
end

TestApp.initialize!

# Create in-memory database

ActiveRecord::Migration.verbose = false

ActiveRecord::Schema.define do
  create_table :pokemons do |t|
    t.string :name
    t.binary :caught
    t.string :species
    t.string :abilities
  end

  create_table :hackers do |t|
    t.integer :social_ability
  end

  create_table :beers do |t|
    t.string :name
    t.string :type
    t.integer :rating
    t.integer :ibu
    t.integer :abv
  end
end

# Define models

class Beer < ActiveRecord::Base
  belongs_to :hacker
end

class Hacker < ActiveRecord::Base
  has_many :pokemons
  has_many :beers
end

class Pokemon < ActiveRecord::Base
  belongs_to :hacker
  has_many :beers, :through => :hacker
end

begin
  require 'mongoid'

  class Artist
    include Mongoid::Document

    field :name, :type => String
    embeds_one :beer
    embeds_many :instruments
  end

  class Instrument
    include Mongoid::Document

    field :name, :type => String
    embedded_in :artist
  end
rescue LoadError # Mongoid doesn't support Rails 3.0 or 4.0 or Ruby 1.8
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pry-rails-0.3.2 spec/config/environment.rb
pry-rails-0.3.1 spec/config/environment.rb
pry-rails-0.3.0 spec/config/environment.rb