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.11.0 spec/models/relation_spec.rb
social_stream-0.15.8 base/spec/models/relation_spec.rb
social_stream-base-0.10.11 spec/models/relation_spec.rb
social_stream-0.15.7 base/spec/models/relation_spec.rb
social_stream-base-0.10.10 spec/models/relation_spec.rb
social_stream-0.15.6 base/spec/models/relation_spec.rb
social_stream-base-0.10.9 spec/models/relation_spec.rb
social_stream-0.15.5 base/spec/models/relation_spec.rb
social_stream-base-0.10.8 spec/models/relation_spec.rb
social_stream-0.15.4 base/spec/models/relation_spec.rb
social_stream-base-0.10.7 spec/models/relation_spec.rb
social_stream-0.15.1 base/spec/models/relation_spec.rb
social_stream-0.15.0 base/spec/models/relation_spec.rb
social_stream-base-0.10.6 spec/models/relation_spec.rb
social_stream-0.14.1 base/spec/models/relation_spec.rb
social_stream-base-0.10.5 spec/models/relation_spec.rb
social_stream-0.14.0 base/spec/models/relation_spec.rb
social_stream-base-0.10.4 spec/models/relation_spec.rb
social_stream-0.13.3 base/spec/models/relation_spec.rb
social_stream-base-0.10.3 spec/models/relation_spec.rb