Sha256: e4fedf090dd80fb642324e9b504da3b770131a8452a94c8d515c2b0081825366

Contents?: true

Size: 702 Bytes

Versions: 2

Compression:

Stored size: 702 Bytes

Contents

require 'spec_helper'

describe ActiveNull do
  describe '.null' do
    specify { expect(Post.null).to be_instance_of(NullPost) }
  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.3 spec/active_null_spec.rb
active_null-0.0.2 spec/active_null_spec.rb