Sha256: 6b6ad3c6becc3ecfd05d08e1e2b294acd29dc59ce8509f340677a2f5c04c8035

Contents?: true

Size: 1.81 KB

Versions: 171

Compression:

Stored size: 1.81 KB

Contents

require 'spec_helper'

describe Relation do
  context "authorization" do
    before(:all) do
      @tie = Factory(:friend)
      @relation = @tie.relation
    end

    describe ", receiver" do
      before do
        @s = @tie.receiver
      end

      it "creates activity" do
        Relation.allow(@s, 'create', 'activity').should include(@relation)
      end

      it "reads activity" do
        Relation.allow(@s, 'read', 'activity').should include(@relation)
      end
    end

    describe ", acquaintance" do
      before do
        @s = Factory(:acquaintance, :contact => Factory(:contact, :sender => @tie.sender)).receiver
      end

      it "creates activity" do
        Relation.allow(@s, 'create', 'activity').should_not include(@relation)
      end

      it "reads activity" do
        Relation.allow(@s, 'read', 'activity').should_not include(@relation)
      end
    end

    describe ", alien" do
      before do
        @s = Factory(:user)
      end

      it "creates activity" do
        Relation.allow(@s, 'create', 'activity').should_not include(@relation)
      end
      
      it "reads activity" do
        Relation.allow(@s, 'read', 'activity').should_not include(@relation)
      end
    end
  end

  describe "member" do
    before do
      @tie = Factory(:member)
      @relation = @tie.relation
    end

    describe ", member" do
      before do
        @s = Factory(:member, :contact => Factory(:contact, :sender => @tie.sender)).receiver
      end

      it "creates activity" do
        Relation.allow(@s, 'create', 'activity').should include(@relation)
      end

       it "reads activity" do
        Relation.allow(@s, 'read', 'activity').should include(@relation)
      end

      it "updates activity" do
        Relation.allow(@s, 'update', 'activity').should_not include(@relation)
      end
    end
  end
end

Version data entries

171 entries across 171 versions & 4 rubygems

Version Path
social_stream-0.28.4 base/spec/models/relation_spec.rb
social_stream-base-0.22.4 spec/models/relation_spec.rb
social_stream-0.28.1 base/spec/models/relation_spec.rb
social_stream-base-0.22.1 spec/models/relation_spec.rb
social_stream-0.28.0 base/spec/models/relation_spec.rb
social_stream-base-0.22.0 spec/models/relation_spec.rb
social_stream-0.27.3 base/spec/models/relation_spec.rb
social_stream-0.27.2 base/spec/models/relation_spec.rb
social_stream-base-0.21.2 spec/models/relation_spec.rb
social_stream-0.27.1 base/spec/models/relation_spec.rb
social_stream-base-0.21.1 spec/models/relation_spec.rb
social_stream-0.27.0 base/spec/models/relation_spec.rb
social_stream-base-0.21.0 spec/models/relation_spec.rb
social_stream-0.26.2 base/spec/models/relation_spec.rb
social_stream-base-0.20.2 spec/models/relation_spec.rb
social_stream-0.26.1 base/spec/models/relation_spec.rb
social_stream-base-0.20.1 spec/models/relation_spec.rb
social_stream-0.26.0 base/spec/models/relation_spec.rb
social_stream-base-0.20.0 spec/models/relation_spec.rb
social_stream-0.25.2 base/spec/models/relation_spec.rb