Sha256: c3b7f14632b916df4afc83fc5cf9a4d68193074cbfa8839c776e7885d35ac090

Contents?: true

Size: 959 Bytes

Versions: 44

Compression:

Stored size: 959 Bytes

Contents

require 'spec_helper'

describe Permission do
  it { should belong_to(:project) }
  it { should belong_to(:membership) }
  it { should belong_to(:user) }

  it "doesn't allow the same member to be added to a project twice" do
    original = Factory(:permission)
    duplicate = Factory.build(:permission, :membership => original.membership, :project => original.project)
    duplicate.should_not be_valid
  end

  it "allows different members to be added to a project" do
    original = Factory(:permission)
    duplicate = Factory.build(:permission, :project => original.project)
    duplicate.should be_valid
  end

  it "caches the user from the account membership" do
    membership = Factory(:membership)
    permission = Factory(:permission, :membership => membership)
    permission.user_id.should == membership.user_id
  end

  it "doesn't allow the user to be assigned" do
    expect { subject.user = Factory.build(:user) }.to raise_error
  end
end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
saucy-0.16.1 spec/models/permission_spec.rb
saucy-0.16.0 spec/models/permission_spec.rb
saucy-0.15.2 spec/models/permission_spec.rb
saucy-0.15.1 spec/models/permission_spec.rb
saucy-0.15.0 spec/models/permission_spec.rb
saucy-0.14.5 spec/models/permission_spec.rb
saucy-0.14.3 spec/models/permission_spec.rb
saucy-0.10.10 spec/models/permission_spec.rb
saucy-0.14.2 spec/models/permission_spec.rb
saucy-0.14.1 spec/models/permission_spec.rb
saucy-0.14.0 spec/models/permission_spec.rb
saucy-0.13.3 spec/models/permission_spec.rb
saucy-0.13.2 spec/models/permission_spec.rb
saucy-0.10.9 spec/models/permission_spec.rb
saucy-0.10.8 spec/models/permission_spec.rb
saucy-0.13.1 spec/models/permission_spec.rb
saucy-0.13.0 spec/models/permission_spec.rb
saucy-0.12.5 spec/models/permission_spec.rb
saucy-0.12.4 spec/models/permission_spec.rb
saucy-0.12.3 spec/models/permission_spec.rb