mongoid-rspec 1.5.4 → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  mongoid-rspec
2
2
  =
3
3
 
4
+ [![Build Status](https://secure.travis-ci.org/evansagge/mongoid-rspec.png?branch=master)](https://travis-ci.org/evansagge/mongoid-rspec)
5
+
4
6
  http://rubygems.org/gems/mongoid-rspec
5
7
 
6
8
  RSpec matchers for Mongoid 3.x.
@@ -117,7 +119,6 @@ Others
117
119
  -
118
120
  describe User do
119
121
  it { should have_fields(:email, :login) }
120
- it { should have_field(:active).of_type(Boolean).with_default_value_of(false) }
121
122
  it { should have_field(:s).with_alias(:status) }
122
123
  it { should have_fields(:birthdate, :registered_at).of_type(DateTime) }
123
124
 
@@ -135,6 +136,13 @@ Others
135
136
  it { should be_stored_in :logs }
136
137
  end
137
138
 
139
+ describe Article do
140
+ it { should have_field(:published).of_type(Boolean).with_default_value_of(false) }
141
+ it { should have_field(:allow_comments).of_type(Boolean).with_default_value_of(true) }
142
+ it { should_not have_field(:allow_comments).of_type(Boolean).with_default_value_of(false) }
143
+ it { should_not have_field(:number_of_comments).of_type(Integer).with_default_value_of(1) }
144
+ end
145
+
138
146
  Use
139
147
  -
140
148
  add in Gemfile
@@ -30,10 +30,14 @@ module Mongoid
30
30
  error << " of type #{@klass.fields[attr].type}"
31
31
  end
32
32
 
33
- if !@default.nil? and !@klass.fields[attr].default_val.nil? and @klass.fields[attr].default_val != @default
34
- error << " with default value of #{@klass.fields[attr].default_val}"
33
+ if !@default.nil?
34
+ if @klass.fields[attr].default_val.nil?
35
+ error << " with default not set"
36
+ elsif @klass.fields[attr].default_val != @default
37
+ error << " with default value of #{@klass.fields[attr].default_val}"
38
+ end
35
39
  end
36
-
40
+
37
41
  if @field_alias and @klass.fields[attr].options[:as] != @field_alias
38
42
  error << " with alias #{@klass.fields[attr].options[:as]}"
39
43
  end
@@ -2,7 +2,7 @@ module Mongoid
2
2
  module Matchers
3
3
  class HaveIndexForMatcher # :nodoc:
4
4
  def initialize(index_fields)
5
- @index_fields = index_fields
5
+ @index_fields = index_fields.symbolize_keys!
6
6
  end
7
7
 
8
8
  def with_options(options = {})
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Rspec
3
- VERSION = "1.5.4"
3
+ VERSION = "1.5.5"
4
4
  end
5
5
  end
@@ -9,6 +9,7 @@ class Article
9
9
  field :content
10
10
  field :published, :type => Boolean, :default => false
11
11
  field :allow_comments, :type => Boolean, :default => true
12
+ field :number_of_comments, :type => Integer
12
13
 
13
14
  embeds_many :comments
14
15
  embeds_one :permalink
@@ -20,4 +21,5 @@ class Article
20
21
 
21
22
  index({ title: 1 }, { unique: true, background: true })
22
23
  index({ published: 1 })
23
- end
24
+ index({ 'permalink._id' => 1 })
25
+ end
@@ -12,6 +12,7 @@ describe "Document" do
12
12
  it { should have_field(:published).of_type(Boolean).with_default_value_of(false) }
13
13
  it { should have_field(:allow_comments).of_type(Boolean).with_default_value_of(true) }
14
14
  it { should_not have_field(:allow_comments).of_type(Boolean).with_default_value_of(false) }
15
+ it { should_not have_field(:number_of_comments).of_type(Integer).with_default_value_of(1) }
15
16
  it { should be_mongoid_document }
16
17
  it { should be_versioned_document }
17
18
  it { should be_timestamped_document }
@@ -4,6 +4,7 @@ describe "Indexes" do
4
4
  describe Article do
5
5
  it { should have_index_for(published: 1) }
6
6
  it { should have_index_for(title: 1).with_options(unique: true, background: true) }
7
+ it { should have_index_for('permalink._id' => 1) }
7
8
  end
8
9
 
9
10
  describe Profile do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-20 00:00:00.000000000 Z
12
+ date: 2012-11-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70302138817480 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70302138817480
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: mongoid
27
- requirement: &70302138816280 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 3.0.1
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70302138816280
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 3.0.1
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rspec
38
- requirement: &70302138813320 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,7 +53,12 @@ dependencies:
43
53
  version: '2.9'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70302138813320
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '2.9'
47
62
  description: RSpec matches for Mongoid models, including association and validation
48
63
  matchers
49
64
  email: evansagge@gmail.com
@@ -118,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
133
  version: '0'
119
134
  requirements: []
120
135
  rubyforge_project: mongoid-rspec
121
- rubygems_version: 1.8.10
136
+ rubygems_version: 1.8.24
122
137
  signing_key:
123
138
  specification_version: 3
124
139
  summary: RSpec matchers for Mongoid