Sha256: 80d79b95346020540964189610e9eb939f658a45a11a6ee7b36c3369ac024ba9

Contents?: true

Size: 1.86 KB

Versions: 73

Compression:

Stored size: 1.86 KB

Contents

require 'spec_helper'

describe CommentsController do
  include SocialStream::TestHelpers::Controllers

  render_views

  describe "authorizing" do
    before do
      @user = Factory(:user)
      sign_in @user
    end

    describe "comment from user" do
      before do
        activity = Factory(:self_activity, :author => @user.actor)

        model_attributes[:author_id] = @user.actor_id
        model_attributes[:owner_id]  = @user.actor_id
        model_attributes[:user_author_id] = @user.actor_id
        model_attributes[:_activity_parent_id] = activity.id
      end

      it_should_behave_like "Allow Creating"

      it "should create with js" do
        count = model_count
        post :create, attributes.merge(:format => :js)

        resource = assigns(model_sym)

        model_count.should eq(count + 1)
        resource.should be_valid
        response.should be_success
      end
    end

    describe "comment to friend" do
      before do
        f = Factory(:friend, :contact => Factory(:contact, :receiver => @user.actor)).sender
        activity = Factory(:self_activity, :author => f)

        model_attributes[:author_id] = @user.actor_id
        model_attributes[:owner_id]  = f.id
        model_attributes[:user_author_id] = @user.actor_id
        model_attributes[:_activity_parent_id] = activity.id
      end

      it_should_behave_like "Allow Creating"
    end

    describe "post to acquaintance" do
      before do
        a = Factory(:acquaintance, :contact => Factory(:contact, :receiver => @user.actor)).sender
        activity = Factory(:self_activity, :author => a)

        model_attributes[:author_id] = @user.actor_id
        model_attributes[:owner_id]  = a.id
        model_attributes[:user_author_id] = @user.actor_id
        model_attributes[:_activity_parent_id] = activity.id
      end

      it_should_behave_like "Deny Creating"
    end
  end
end

Version data entries

73 entries across 73 versions & 2 rubygems

Version Path
social_stream-2.2.2 base/spec/controllers/comments_controller_spec.rb
social_stream-base-2.2.2 spec/controllers/comments_controller_spec.rb
social_stream-2.2.1 base/spec/controllers/comments_controller_spec.rb
social_stream-base-2.2.1 spec/controllers/comments_controller_spec.rb
social_stream-2.2.0 base/spec/controllers/comments_controller_spec.rb
social_stream-base-2.2.0 spec/controllers/comments_controller_spec.rb
social_stream-2.1.1 base/spec/controllers/comments_controller_spec.rb
social_stream-1.1.12 base/spec/controllers/comments_controller_spec.rb
social_stream-base-1.1.11 spec/controllers/comments_controller_spec.rb
social_stream-2.1.0 base/spec/controllers/comments_controller_spec.rb
social_stream-base-2.1.0 spec/controllers/comments_controller_spec.rb
social_stream-2.0.4 base/spec/controllers/comments_controller_spec.rb
social_stream-base-2.0.4 spec/controllers/comments_controller_spec.rb
social_stream-2.0.3 base/spec/controllers/comments_controller_spec.rb
social_stream-base-2.0.3 spec/controllers/comments_controller_spec.rb
social_stream-1.1.11 base/spec/controllers/comments_controller_spec.rb
social_stream-base-1.1.10 spec/controllers/comments_controller_spec.rb
social_stream-1.1.10 base/spec/controllers/comments_controller_spec.rb
social_stream-base-1.1.9 spec/controllers/comments_controller_spec.rb
social_stream-1.1.9 base/spec/controllers/comments_controller_spec.rb