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.13.2 base/spec/models/relation_spec.rb
social_stream-base-0.10.2 spec/models/relation_spec.rb
social_stream-0.13.1 base/spec/models/relation_spec.rb
social_stream-base-0.10.1 spec/models/relation_spec.rb
social_stream-0.13.0 base/spec/models/relation_spec.rb
social_stream-base-0.10.0 spec/models/relation_spec.rb
social_stream-0.12.14 base/spec/models/relation_spec.rb
social_stream-base-0.9.36 spec/models/relation_spec.rb
social_stream-0.12.13 base/spec/models/relation_spec.rb
social_stream-base-0.9.35 spec/models/relation_spec.rb
social_stream-0.12.12 base/spec/models/relation_spec.rb
social_stream-base-0.9.34 spec/models/relation_spec.rb
social_stream-0.12.11 base/spec/models/relation_spec.rb
social_stream-base-0.9.33 spec/models/relation_spec.rb
social_stream-0.12.10 base/spec/models/relation_spec.rb
social_stream-base-0.9.32 spec/models/relation_spec.rb
social_stream-0.12.9 base/spec/models/relation_spec.rb
social_stream-base-0.9.31 spec/models/relation_spec.rb
social_stream-0.12.8 base/spec/models/relation_spec.rb
social_stream-base-0.9.30 spec/models/relation_spec.rb