mongoid-rspec 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,8 +24,8 @@ module Mongoid
24
24
  if @type and @klass.fields[attr].type != @type
25
25
  error << " of type #{@klass.fields[attr].type}"
26
26
  end
27
-
28
- if @default and @klass.fields[attr].default != @default
27
+
28
+ if !@default.nil? and !@klass.fields[attr].default.nil? and @klass.fields[attr].default != @default
29
29
  error << " with default value of #{@klass.fields[attr].default}"
30
30
  end
31
31
 
@@ -48,7 +48,7 @@ module Mongoid
48
48
  def description
49
49
  desc = "have #{@attributes.size > 1 ? 'fields' : 'field'} named #{@attributes.collect(&:inspect).to_sentence}"
50
50
  desc << " of type #{@type.inspect}" if @type
51
- desc << " with default value of #{@default.inspect}" if @default
51
+ desc << " with default value of #{@default.inspect}" if !@default.nil?
52
52
  desc
53
53
  end
54
54
  end
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Rspec
3
- VERSION = "1.4.3"
3
+ VERSION = "1.4.4"
4
4
  end
5
5
  end
@@ -7,8 +7,10 @@ class Article
7
7
  field :title
8
8
  field :content
9
9
  field :published, :type => Boolean, :default => false
10
+ field :allow_comments, :type => Boolean, :default => true
10
11
 
11
12
  embeds_many :comments
13
+ embeds_one :permalink
12
14
  referenced_in :author, :class_name => 'User', :inverse_of => :articles
13
15
 
14
16
  validates :title, :presence => true
@@ -25,6 +25,7 @@ describe "Associations" do
25
25
  it { should be_referenced_in(:author).of_type(User).as_inverse_of(:articles) }
26
26
  it { should belong_to(:author).of_type(User).as_inverse_of(:articles) }
27
27
  it { should embed_many(:comments) }
28
+ it { should embed_one(:permalink) }
28
29
  end
29
30
 
30
31
  describe Comment do
@@ -7,6 +7,8 @@ describe "Document" do
7
7
 
8
8
  describe Article do
9
9
  it { should have_field(:published).of_type(Boolean).with_default_value_of(false) }
10
+ it { should have_field(:allow_comments).of_type(Boolean).with_default_value_of(true) }
11
+ it { should_not have_field(:allow_comments).of_type(Boolean).with_default_value_of(false) }
10
12
  end
11
13
 
12
14
  describe Article do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mongoid-rspec
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.4.3
5
+ version: 1.4.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Evan Sagge