Sha256: 7692292b01b8ddcfc2b1fb02d2285067e027271f86dfc2e1ca735293beaf59ce

Contents?: true

Size: 1.7 KB

Versions: 35

Compression:

Stored size: 1.7 KB

Contents

require File.join(File.dirname(__FILE__), '/../../test_helper')

class Cms::GroupsControllerTest < ActionController::TestCase
  include Cms::ControllerTestHelper

  def setup
    @edit_content = Permission.find_by_name("edit_content")
    @publish_content = Permission.find_by_name("publish_content")
    @random = Factory(:permission, :name => "shouldnt-be-included")
    @group_type = Factory(:group_type, :cms_access => true)
    @public_group_type = Factory(:group_type, :cms_access => false)
    login_as_cms_admin
  end

  def test_create_cms_group
    post :create, :group => Factory.attributes_for(:group, :group_type_id => @group_type.id)
    
    assert_redirected_to :action => "index"    
    
    group = Group.last
    assert_equal 0, group.permissions.count
    assert group.permission_ids.include?(@edit_content.id)
    assert group.permission_ids.include?(@publish_content.id)
  end

  def test_create_cms_group
    post :create, :group => Factory.attributes_for(:group, 
      :group_type_id => @group_type.id,
      :permission_ids => [@edit_content.id.to_s, @publish_content.id.to_s])
    
    assert_redirected_to :action => "index"
    
    group = Group.last
    assert_equal 2, group.permissions.count
    assert group.permission_ids.include?(@edit_content.id)
    assert group.permission_ids.include?(@publish_content.id)
  end

  def test_create_public_group    
    post :create, :group => Factory.attributes_for(:group, :group_type_id => @public_group_type.id)
    
    assert_redirected_to :action => "index"
    
    group = Group.last
    assert_equal 0, group.permissions.count
    assert !group.permission_ids.include?(@edit_content.id)
    assert !group.permission_ids.include?(@publish_content.id)
  end

end

Version data entries

35 entries across 35 versions & 11 rubygems

Version Path
SFEley-browsercms-3.0.2 test/functional/cms/groups_controller_test.rb
buzzware-browsercms-3.0.2 test/functional/cms/groups_controller_test.rb
coredumplings-browsercms-3.0.0 test/functional/cms/groups_controller_test.rb
nate-browsercms-3.0.210 test/functional/cms/groups_controller_test.rb
nate-browsercms-3.0.211 test/functional/cms/groups_controller_test.rb
we5-browsercms-3.0.1.1 test/functional/cms/groups_controller_test.rb
webficient-browsercms-3.0.1 test/functional/cms/groups_controller_test.rb
webficient-browsercms-3.0.2 test/functional/cms/groups_controller_test.rb
webficient-browsercms-3.0.3 test/functional/cms/groups_controller_test.rb
webficient-browsercms-3.0.4 test/functional/cms/groups_controller_test.rb
browsercms-3.1.5 test/functional/cms/groups_controller_test.rb
browsercms-3.1.4 test/functional/cms/groups_controller_test.rb
browsercms-3.1.3 test/functional/cms/groups_controller_test.rb
bf4-browsercms-3.1.0 test/functional/cms/groups_controller_test.rb
drujensen-browsercms-3.2.0 test/functional/cms/groups_controller_test.rb
browsercmsi-3.1.2 test/functional/cms/groups_controller_test.rb
browsercms-3.1.2 test/functional/cms/groups_controller_test.rb
browsercms-3.1.1 test/functional/cms/groups_controller_test.rb
browsercmsi-3.1.1 test/functional/cms/groups_controller_test.rb
browsercmsi-3.1.0 test/functional/cms/groups_controller_test.rb