Skip to content

Commit

Permalink
Updated for rspec2 and mongoid beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Papipo authored and nmerouze committed Apr 29, 2010
1 parent 732b502 commit bb1e57b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions spec/mongoid_spec.rb
Expand Up @@ -9,7 +9,7 @@ class Address
field :street
field :zip
field :country
belongs_to :person, :inverse_of => :address
embedded_in :person, :inverse_of => :address
end

class Person
Expand All @@ -20,7 +20,7 @@ class Person
field :password
field :admin, :type => Boolean, :default => false

has_one :address
embeds_one :address
end

class Post
Expand Down Expand Up @@ -59,19 +59,19 @@ class Comment
person.should_not be_new_record
end

it "should create an object through belongs_to association" do
it "should create an object through embedded_in association" do
Post.blueprint { }
Comment.blueprint { post }
Comment.make.post.class.should == Post
end

it "should create an object through belongs_to association with a class_name attribute" do
it "should create an object through embedded_in association with a class_name attribute" do
Person.blueprint { }
Comment.blueprint { author }
Comment.make.author.class.should == Person
end

it "should create an object through belongs_to association using a named blueprint" do
it "should create an object through embedded_in association using a named blueprint" do
Post.blueprint { }
Post.blueprint(:dummy) do
title { 'Dummy Post' }
Expand All @@ -95,7 +95,7 @@ class Comment
post[:title].should == "Test"
end

it "should create an object through a belongs_to association, and return its id" do
it "should create an object through a embedded_in association, and return its id" do
Post.blueprint { }
Comment.blueprint { post }
post_count = Post.count
Expand Down
6 changes: 3 additions & 3 deletions spec/spec_helper.rb
@@ -1,14 +1,14 @@
$LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"
require "rubygems"
require "spec"
require "rspec"
require "sham"

module Spec
module MongoMapper
def self.configure!
::MongoMapper.database = "machinist_mongomapper"

Spec::Runner.configure do |config|
Rspec.configure do |config|
config.before(:each) { Sham.reset }
config.after(:all) { ::MongoMapper.database.collections.each { |c| c.remove } }
end
Expand All @@ -22,7 +22,7 @@ def self.configure!
config.allow_dynamic_fields = true
end

Spec::Runner.configure do |config|
Rspec.configure do |config|
config.before(:each) { Sham.reset }
config.after(:all) { ::Mongoid.master.collections.each { |c| c.remove } }
end
Expand Down

0 comments on commit bb1e57b

Please sign in to comment.