Sha256: 5faaa3b24de412218f0642696d67c13bb132e254ba93476c9c9e4af9bc037726

Contents?: true

Size: 882 Bytes

Versions: 2

Compression:

Stored size: 882 Bytes

Contents

require 'spec_helper'

describe ActiveNull do
  it 'defines the null class' do
    expect(Object.const_defined? 'NullPost').to eq true
  end

  describe '.null' do
    specify { expect(Post.null).to be_instance_of(NullPost) }
    specify { expect(Test::TestModel.null).to be_instance_of(Test::NullTestModel) }
  end

  describe '.null_model' do
    specify { expect(Post.null.override).to eq 'I am an override.' }
  end

  describe 'a has many' do
    specify { expect(Post.null.comments).to eq [] }
    specify { expect(Post.null.comments).to be_instance_of(Comment::ActiveRecord_Relation) }
  end

  describe 'a belongs to' do
    specify { expect(Comment.null.post).to be_instance_of(NullPost) }
    specify { expect(Comment.new.post).to be_instance_of(NullPost) }
  end

  it 'supports draper' do
    expect(Post.null.decorate).to be_decorated_with(NullPostDecorator)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_null-0.0.5 spec/active_null_spec.rb
active_null-0.0.4 spec/active_null_spec.rb