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-base-0.14.1 spec/models/relation_spec.rb
vkhater-social_stream-0.16.3.3 base/spec/models/relation_spec.rb
vkhater-social_stream-base-0.11.2 spec/models/relation_spec.rb
social_stream-0.19.0 base/spec/models/relation_spec.rb
social_stream-base-0.14.0 spec/models/relation_spec.rb
social_stream-0.18.2 base/spec/models/relation_spec.rb
social_stream-base-0.13.2 spec/models/relation_spec.rb
social_stream-0.18.1 base/spec/models/relation_spec.rb
social_stream-base-0.13.1 spec/models/relation_spec.rb
social_stream-0.18.0 base/spec/models/relation_spec.rb
social_stream-base-0.13.0 spec/models/relation_spec.rb
social_stream-0.17.1 base/spec/models/relation_spec.rb
social_stream-base-0.12.1 spec/models/relation_spec.rb
social_stream-0.17.0 base/spec/models/relation_spec.rb
social_stream-base-0.12.0 spec/models/relation_spec.rb
social_stream-0.16.3 base/spec/models/relation_spec.rb
social_stream-base-0.11.2 spec/models/relation_spec.rb
social_stream-0.16.2 base/spec/models/relation_spec.rb
social_stream-base-0.11.1 spec/models/relation_spec.rb
social_stream-0.16.1 base/spec/models/relation_spec.rb