Sha256: c51bdafeda4003c9aed6bb4260d850889715926676632a80bdb4d4cfbd1c706d

Contents?: true

Size: 1.56 KB

Versions: 3

Compression:

Stored size: 1.56 KB

Contents

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'dm-parse'

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

RSpec.configure do |config|
  
end

# To run the tests, setup a Parse environment in "parse_env.yml"
# under the same directory, which I don't provide.
env_file    = File.join(File.dirname(__FILE__), "parse_env.yml")
settings    = YAML::load(File.read env_file)
app_id      = settings["app_id"]
api_key     = settings["api_key"]
master_key  = settings["master_key"]

raise "You must setup a parse environment before testing" unless app_id && api_key && master_key

DataMapper.setup :default,  adapter: :parse, app_id: app_id, api_key: api_key
DataMapper.setup :master,   adapter: :parse, app_id: app_id, api_key: master_key, master: true

class User
  include DataMapper::Resource

  is :parse_user
  storage_names[:master] = "_User"
  property :location, ParseGeoPoint
end

class Article
  include DataMapper::Resource

  is :parse

  property :title,      String
  property :body,       Text
  property :rank,       Integer
  property :closed_at,  ParseDate
  property :attachment, ParseFile

  has n, :comments
end

class Comment
  include DataMapper::Resource

  is :parse

  property :body,       Text

  belongs_to :article
end

class Company
  include DataMapper::Resource

  is :parse

  property :location, ParseGeoPoint, required: true
end

DataMapper.finalize

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dm-parse-0.3.13 spec/spec_helper.rb
dm-parse-0.3.12 spec/spec_helper.rb
dm-parse-0.3.11 spec/spec_helper.rb