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.12.2 spec/models/permission_spec.rb
saucy-0.12.1 spec/models/permission_spec.rb
saucy-0.12.0 spec/models/permission_spec.rb
saucy-0.11.5 spec/models/permission_spec.rb
saucy-0.11.3 spec/models/permission_spec.rb
saucy-0.11.2 spec/models/permission_spec.rb
saucy-0.10.7 spec/models/permission_spec.rb
saucy-0.10.6 spec/models/permission_spec.rb
saasy-0.0.2.alpha3 spec/models/permission_spec.rb
saasy-0.0.2.alpha2 spec/models/permission_spec.rb
saasy-0.0.2.alpha1 spec/models/permission_spec.rb
saucy-0.10.5 spec/models/permission_spec.rb
saucy-0.10.4 spec/models/permission_spec.rb
saucy-0.10.3 spec/models/permission_spec.rb
saucy-0.10.2 spec/models/permission_spec.rb
saucy-0.10.1 spec/models/permission_spec.rb
saucy-0.10.0 spec/models/permission_spec.rb
saucy-0.9.1 spec/models/permission_spec.rb
saucy-0.9.0 spec/models/permission_spec.rb
saucy-0.8.5 spec/models/permission_spec.rb