Sha256: f1b95d8739881c9f4a52a46a32da984b655a5c20ce19f7d0d11ce3c5f8c5068e

Contents?: true

Size: 1017 Bytes

Versions: 8

Compression:

Stored size: 1017 Bytes

Contents

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

describe PermissionsController do
  include SocialStream::TestHelpers::Controllers

  render_views

  describe "when authenticated" do
    before do
      @user = Factory(:user)

      sign_in @user
    end

    context "with an existing relation" do
      before do
        @sphere = Factory(:sphere, :actor_id => @user.actor_id)
        @relation = Factory(:relation_custom, :sphere_id => @sphere.id)
      end

      it "should render index" do
        get :index, :relation_id => @relation.id, :format => "js"

        response.should be_success
      end
    end

    context "a external relation" do
      before do
        @relation = Factory(:relation_custom)
      end

      it "should not render index" do
        begin
          get :index, :relation_id => @relation.id, :format => "js"

          assert false
        rescue CanCan::AccessDenied
          assigns(:permissions).should be_nil
        end
      end
    end
  end
end


Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
social_stream-base-0.6.3 spec/controllers/permissions_controller_spec.rb
social_stream-base-0.6.2 spec/controllers/permissions_controller_spec.rb
social_stream-base-0.6.1 spec/controllers/permissions_controller_spec.rb
social_stream-base-0.6.0 spec/controllers/permissions_controller_spec.rb
social_stream-base-0.5.2 spec/controllers/permissions_controller_spec.rb
social_stream-base-0.5.1 spec/controllers/permissions_controller_spec.rb
social_stream-base-0.5.0 spec/controllers/permissions_controller_spec.rb
social_stream-0.4.6 spec/controllers/permissions_controller_spec.rb