Sha256: d861a4fc657301a19f66086976a32a871bec5899d9b55d29726e33ba78ad3909

Contents?: true

Size: 931 Bytes

Versions: 1

Compression:

Stored size: 931 Bytes

Contents

require 'test_helper'

describe "Buttafly::targetable" do 

  [DummyChild, DummyParent, DummyGrandparent].each do |targetable_model|

    subject { targetable_model }

    it "must return true for #{targetable_model}" do 
      subject.targetable.must_equal true
    end

    it "must have one :mapping" do 
      must_have_one(:mapping)
    end
  end

  # [:dummy_child, e:dummy_parent, :dummy_grandparent].each do |factory|
  [:dummy_child].each do |factory|

    let(:record) { create(factory) }
    
    it "#targetable_attrs" do 
      record.targetable_attrs.must_include "name"
      record.targetable_attrs.wont_include "dummy_tribe_id"
    end

    it "#self.targetable_attrs" do 
      record.class.targetable_attrs.must_include "name"
      record.class.targetable_attrs.wont_include "dummy_tribe_id"
    end

    it "#self.parent_models" do 
      record.class.parent_models.must_include :dummy_parent
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
buttafly-0.0.1 test/concerns/targetable_test.rb