Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Place mongoid test code within a require_mongoid block
  • Loading branch information
jwood committed Apr 23, 2012
1 parent ea82e11 commit 592db38
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
14 changes: 8 additions & 6 deletions test/fixtures/mongoid_campus_hub.rb
@@ -1,7 +1,9 @@
class MongoidCampusHub
include Mongoid::Document
include Mongoid::Timestamps
include Tenacity

t_belongs_to :active_record_organization
require_mongoid do
class MongoidCampusHub
include Mongoid::Document
include Mongoid::Timestamps
include Tenacity

t_belongs_to :active_record_organization
end
end
22 changes: 12 additions & 10 deletions test/orm_ext/activerecord_test.rb
Expand Up @@ -116,16 +116,18 @@ class ActiveRecordTest < Test::Unit::TestCase
class ActiveRecordObjectWithNoTable < ActiveRecord::Base; include Tenacity; end
assert_equal Integer, ActiveRecordObjectWithNoTable._t_id_type
end

should "successfully save if belongs_to another AR object which is assigned from a mongoid object" do
org = ActiveRecordOrganization.create
campus_hub = MongoidCampusHub.create
campus_hub.active_record_organization = org
campus_hub.save!
user = ActiveRecordUser.new
user.active_record_organization = campus_hub.active_record_organization
assert user.save
assert user.active_record_organization.save(:validate => false)

require_mongoid do
should "successfully save if belongs_to another AR object which is assigned from a mongoid object" do
org = ActiveRecordOrganization.create
campus_hub = MongoidCampusHub.create
campus_hub.active_record_organization = org
campus_hub.save!
user = ActiveRecordUser.new
user.active_record_organization = campus_hub.active_record_organization
assert user.save
assert user.active_record_organization.save(:validate => false)
end
end
end

Expand Down

0 comments on commit 592db38

Please sign in to comment.