Sha256: 072270156afc274d47cf3ffecde5509fa938db7994c1ff5323e0726603542f37

Contents?: true

Size: 965 Bytes

Versions: 6

Compression:

Stored size: 965 Bytes

Contents

require 'test_helper'

class ZineTest < ActiveSupport::TestCase
  
  context "a zine" do
    
    setup do
      Tenant.set_current_tenant( tenants( :tenant_2 ).id )
      @zine = Zine.first
    end

# validate multi-tenanting structure
    should have_db_column(:tenant_id)
    should "match the current tenant" do
      assert_equal  @zine.tenant_id, Thread.current[:tenant_id]
    end

# validate the model
    should have_many( :posts )
    should belong_to( :team )
    should have_many( :members ).through( :posts )
    
# validate the particular associations in the model
    should 'find members through posts' do
      assert_equal 2, zines( :zine_2_b ).members.count
    end  #should do

    should 'find posts' do
      assert_equal 3, zines( :zine_2_a ).posts.count
    end  #should do

    should 'match a zine with tenant' do
      assert_equal  2,zines( :zine_2_a ).tenant_id
    end  # should do
  


  end   # context zine
  
end # class ZineTest 

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
milia-1.2.1 test/test/models/zine_test.rb
milia-1.2.0 test/test/models/zine_test.rb
milia-1.1.1 test/test/models/zine_test.rb
milia-1.0.1 test/test/models/zine_test.rb
milia-1.1.0 test/test/models/zine_test.rb
milia-1.0.0 test/test/models/zine_test.rb