Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

End compatibility with rspec 2.0 beta

  • Loading branch information...
commit 1456532408a37ff5020856eb3612864f1d47451f 1 parent 491a9c7
@shingara shingara authored nmerouze committed
Showing with 20 additions and 23 deletions.
  1. +2 −5 Rakefile
  2. +13 −13 spec/mongo_mapper_spec.rb
  3. +5 −5 spec/spec_helper.rb
View
7 Rakefile
@@ -1,6 +1,6 @@
require 'rubygems'
require 'rake'
-require 'spec/rake/spectask'
+require 'rspec/core/rake_task'
begin
require 'jeweler'
@@ -21,7 +21,4 @@ desc 'Default: run specs.'
task :default => :spec
desc 'Run all the specs for the machinist plugin.'
-Spec::Rake::SpecTask.new do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.rcov = false
-end
+RSpec::Core::RakeTask.new(:spec)
View
26 spec/mongo_mapper_spec.rb
@@ -1,11 +1,11 @@
-require File.dirname(__FILE__) + "/spec_helper"
+require "spec_helper"
require "machinist/mongo_mapper"
Spec::MongoMapper.configure!
class Address
include MongoMapper::EmbeddedDocument
-
+
key :street, String
key :zip, String
key :country, String
@@ -13,7 +13,7 @@ class Address
class Person
include MongoMapper::Document
-
+
key :name, String
key :password, String
key :admin, Boolean, :default => false
@@ -22,26 +22,26 @@ class Person
class Post
include MongoMapper::Document
-
+
key :title, String
key :body, String
key :published, Boolean, :default => true
-
+
many :comments
end
class Comment
include MongoMapper::Document
-
+
key :body, String
key :post_id, String
key :author_id, String
-
+
belongs_to :post
belongs_to :author, :class_name => "Person"
end
-describe Machinist, "MongoMapper::Document adapter" do
+describe Machinist, "MongoMapper::Document adapter" do
before(:each) do
Person.clear_blueprints!
@@ -61,13 +61,13 @@ class Comment
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
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
Post.blueprint { }
Post.blueprint(:dummy) do
@@ -85,13 +85,13 @@ class Comment
person = Person.plan
Person.count.should == person_count
end
-
+
it "should return a regular attribute in the hash" do
Post.blueprint { title "Test" }
post = Post.plan
post[:title].should == "Test"
end
-
+
it "should create an object through a belongs_to association, and return its id" do
Post.blueprint { }
Comment.blueprint { post }
@@ -102,7 +102,7 @@ class Comment
comment[:post_id].should_not be_nil
end
- context "attribute assignment" do
+ context "attribute assignment" do
it "should allow assigning a value to an attribute" do
Post.blueprint { title "1234" }
post = Post.make
View
10 spec/spec_helper.rb
@@ -8,24 +8,24 @@ module MongoMapper
def self.configure!
::MongoMapper.database = "machinist_mongomapper"
- Rspec.configure do |config|
+ ::Rspec.configure do |config|
config.before(:each) { Sham.reset }
config.after(:all) { ::MongoMapper.database.collections.each { |c| c.remove } }
end
end
end
-
+
module Mongoid
def self.configure!
::Mongoid.configure do |config|
config.master = Mongo::Connection.new.db("machinist_mongoid")
config.allow_dynamic_fields = true
end
-
- Rspec.configure do |config|
+
+ ::Rspec.configure do |config|
config.before(:each) { Sham.reset }
config.after(:all) { ::Mongoid.master.collections.each { |c| c.remove } }
end
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.