Sha256: 817ad3379ff425cb263e002a5c7e9b5b14bd5bb91f7d3005dab657c302649b69

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 Bytes

Contents

require 'spec_helper'

RSpec.describe 'Document' do
  describe User do
    it { is_expected.to have_fields(:email, :login) }
  end

  describe Article do
    klass_boolean = Mongoid::Compatibility::Version.mongoid4_or_newer? ? Mongoid::Boolean : Boolean
    it { is_expected.to have_field(:published).of_type(klass_boolean).with_default_value_of(false) }
    it { is_expected.to have_field(:allow_comments).of_type(klass_boolean).with_default_value_of(true) }
    it { is_expected.to belong_to(:author) }
    it { is_expected.to have_field(:title).localized }
    it { is_expected.not_to have_field(:allow_comments).of_type(klass_boolean).with_default_value_of(false) }
    it { is_expected.not_to have_field(:number_of_comments).of_type(Integer).with_default_value_of(1) }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongoid-rspec-4.1.0 spec/unit/document_spec.rb
mongoid-rspec-4.0.1 spec/unit/document_spec.rb
mongoid-rspec-4.0.0 spec/unit/document_spec.rb