Sha256: b96482ab9b7f97bcb1a7437da26914d421c3775e86a3aa9de7012666c6cb1313

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Page do
  dataset :groups
  dataset :pages
  
  before do
    @site = Page.current_site = sites(:test) if defined? Site
  end
  
  describe "with groups" do
    before do
      @page = pages(:parent)
    end
    it "should have some groups" do
      @page.groups.any?.should be_true
      @page.groups.size.should == 1
    end

    it "should be visible to group members" do
      @page.visible_to?(readers(:normal)).should be_true
    end

    it "should not be visible to non-members" do
      @page.visible_to?(readers(:ungrouped)).should be_false
    end
  end

  describe "with inherited groups" do
    before do
      @page = pages(:child)
    end
    
    it "should be visible to group members" do
      @page.visible_to?(readers(:normal)).should be_true
    end

    it "should not be visible to non-members" do
      @page.visible_to?(readers(:ungrouped)).should be_false
    end
  end

  describe "without groups" do
    before do
      @page = pages(:home)
    end
    it "should be visible to everyone" do
      @page.visible_to?(readers(:ungrouped)).should be_true
    end
    
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
radiant-reader_group-extension-1.2.2 spec/models/page_spec.rb
radiant-reader_group-extension-1.2.1 spec/models/page_spec.rb
radiant-reader_group-extension-1.2.0 spec/models/page_spec.rb
radiant-reader_group-extension-1.1.2 spec/models/page_spec.rb
radiant-reader_group-extension-1.1.1 spec/models/page_spec.rb
radiant-reader_group-extension-1.1.0 spec/models/page_spec.rb
radiant-reader_group-extension-1.0.1 spec/models/page_spec.rb
radiant-reader_group-extension-1.0.0 spec/models/page_spec.rb
radiant-reader_group-extension-0.9.0 spec/models/page_spec.rb