Sha256: 5f4adabf1357cc975a8a7594d77433ee99397a198c81ee24cf9fad1890ddabbc

Contents?: true

Size: 971 Bytes

Versions: 3

Compression:

Stored size: 971 Bytes

Contents

require 'spec_helper'

describe "Simple Item1 rings" do

	class Item1 < ActiveRecord::Base
		include Concentric::Model

		ring 3, :write => [:name,:address]
		ring 3, :read => [:name,:address,:member_code]
	end


  it "can specify ring fields" do
	  Item1.rings_fields.should == [
		  nil, 
		  nil, 
		  nil, 
		  {:write=>[:address, :name], :read=>[:address, :member_code, :name]}
	  ]
	  Item1.rings_abilities.should == []
  end
end

describe "Item2 rings with abilities" do

	class Item2 < ActiveRecord::Base
		include Concentric::Model

		ring 2, [:write,:delete]
		ring 3, :write => [:name,:address]
		ring 3, :read => [:name,:address,:member_code]
		ring 4, :read
	end


  it "can specify ring fields" do
	  Item2.rings_fields.should == [
		  nil, 
		  nil, 
		  nil, 
		  {:write=>[:address, :name], :read=>[:address, :member_code, :name]}
	  ]
	  Item2.rings_abilities.should == [
		  nil,
	    nil,
	    [:delete,:write],
	    nil,
	    [:read]
	  ]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kojac-0.13.0 spec/model_ring_spec.rb
kojac-0.12.0 spec/model_ring_spec.rb
kojac-0.11.0 spec/model_ring_spec.rb