Sha256: 877e84e391a16fd209e5d16d9d7b956bfe86ce220879d30907b3a649cc6a7f06

Contents?: true

Size: 969 Bytes

Versions: 2

Compression:

Stored size: 969 Bytes

Contents

require 'spec_helper'

describe ProjectMembership do
  it { should allow_mass_assignment_of(:user_id) }
  it { should allow_mass_assignment_of(:user) }
  it { should_not allow_mass_assignment_of(:updated_at) }
  it { should_not allow_mass_assignment_of(:created_at) }
  it { should belong_to(:project) }
  it { should belong_to(:user) }
end

describe ProjectMembership, "for a user that isn't an account member" do
  let!(:account)       { Factory(:account) }
  let!(:other_account) { Factory(:account) }
  let!(:project)       { Factory(:project, :account => account) }
  let!(:user)          { Factory(:user) }
  subject              { Factory.build(:project_membership, :project => project,
                                                            :user    => user) }

  before { Factory(:account_membership, :user => user, :account => other_account) }

  it "isn't valid" do
    should_not be_valid
    subject.errors[:base].first.should =~ /account/i
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
saucy-0.1.2 spec/models/project_membership_spec.rb
saucy-0.1.1 spec/models/project_membership_spec.rb