mongoid-rspec 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -3,8 +3,8 @@ source :gemcutter
3
3
 
4
4
  gem "rails", "3.0.0.beta3"
5
5
 
6
- gem "mongoid", "2.0.0.beta4"
7
- gem "bson_ext", "0.20.1"
6
+ gem "mongoid", ">= 2.0.0.beta4"
7
+ gem "bson_ext", ">= 0.20.1"
8
8
 
9
9
  gem 'redgreen'
10
10
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.4
1
+ 1.1.0
@@ -1,6 +1,14 @@
1
1
  module Mongoid
2
2
  module Matchers
3
3
  module Associations
4
+ HAS_MANY = defined?(Mongoid::Associations::HasManyRelated) ? Mongoid::Associations::HasManyRelated : Mongoid::Associations::ReferencesMany
5
+ HAS_ONE = defined?(Mongoid::Associations::HasOneRelated) ? Mongoid::Associations::HasOneRelated : Mongoid::Associations::ReferencesOne
6
+ BELONGS_TO = defined?(Mongoid::Associations::BelongsToRelated) ? Mongoid::Associations::BelongsToRelated : Mongoid::Associations::ReferencedIn
7
+ EMBEDS_MANY = Mongoid::Associations::EmbedsMany
8
+ EMBEDS_ONE = Mongoid::Associations::EmbedsOne
9
+ EMBEDDED_IN = Mongoid::Associations::EmbeddedIn
10
+
11
+
4
12
  class HaveAssociationMatcher
5
13
  def initialize(name, association_type)
6
14
  @association = {}
@@ -21,7 +29,7 @@ module Mongoid
21
29
  end
22
30
 
23
31
  def as_inverse_of(association_inverse_name)
24
- raise "#{@association[:type].inspect} does not respond to :inverse_of" unless [Mongoid::Associations::BelongsToRelated, Mongoid::Associations::EmbeddedIn].include?(@association[:type])
32
+ raise "#{@association[:type].inspect} does not respond to :inverse_of" unless [BELONGS_TO, EMBEDDED_IN].include?(@association[:type])
25
33
  @association[:inverse_of] = association_inverse_name.to_s
26
34
  @expectation_message << " which is an inverse of #{@association[:inverse_of].inspect}"
27
35
  self
@@ -99,27 +107,27 @@ module Mongoid
99
107
  end
100
108
 
101
109
  def embed_one(association_name)
102
- HaveAssociationMatcher.new(association_name, Mongoid::Associations::EmbedsOne)
110
+ HaveAssociationMatcher.new(association_name, EMBEDS_ONE)
103
111
  end
104
112
 
105
113
  def embed_many(association_name)
106
- HaveAssociationMatcher.new(association_name, Mongoid::Associations::EmbedsMany)
114
+ HaveAssociationMatcher.new(association_name, EMBEDS_MANY)
107
115
  end
108
116
 
109
117
  def be_embedded_in(association_name)
110
- HaveAssociationMatcher.new(association_name, Mongoid::Associations::EmbeddedIn)
118
+ HaveAssociationMatcher.new(association_name, EMBEDDED_IN)
111
119
  end
112
120
 
113
121
  def have_one_related(association_name)
114
- HaveAssociationMatcher.new(association_name, Mongoid::Associations::HasOneRelated)
122
+ HaveAssociationMatcher.new(association_name, HAS_ONE)
115
123
  end
116
124
 
117
125
  def have_many_related(association_name)
118
- HaveAssociationMatcher.new(association_name, Mongoid::Associations::HasManyRelated)
126
+ HaveAssociationMatcher.new(association_name, HAS_MANY)
119
127
  end
120
128
 
121
129
  def belong_to_related(association_name)
122
- HaveAssociationMatcher.new(association_name, Mongoid::Associations::BelongsToRelated)
130
+ HaveAssociationMatcher.new(association_name, BELONGS_TO)
123
131
  end
124
132
  end
125
133
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mongoid-rspec}
8
- s.version = "1.0.4"
8
+ s.version = "1.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Evan Sagge"]
12
- s.date = %q{2010-05-24}
12
+ s.date = %q{2010-06-02}
13
13
  s.description = %q{RSpec matches for Mongoid models, including association and validation matchers}
14
14
  s.email = %q{evansagge@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
+ - 1
7
8
  - 0
8
- - 4
9
- version: 1.0.4
9
+ version: 1.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Evan Sagge
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-24 00:00:00 +08:00
17
+ date: 2010-06-02 00:00:00 +08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency