Sha256: 81b96c35a2531d255c081a6bde385ff29297178d6d99f8098aa81232a996d24a

Contents?: true

Size: 803 Bytes

Versions: 1

Compression:

Stored size: 803 Bytes

Contents

require 'spec_helper'

describe Models::Groups::Group do
  it { should validate_presence_of(:application_id) }
  it { should validate_presence_of(:created_by) }
  it { should validate_presence_of(:name) }

  it { should ensure_length_of(:name).is_at_most(256) }
  it { should ensure_length_of(:description).is_at_most(1024) }

  it { should have_many(:memberships) }
  it { should have_many(:invitations) }

  context "when creating" do
    context "a valid group" do
      before do
        @group = create(:group, account_id: 999)
      end

      it "should create a default member" do
        @group.memberships.count.should == 1
        @group.memberships.first.user_id.should == @group.created_by
        @group.memberships.first.account_id.should == @group.account_id
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restpack_group_service-0.0.8 spec/models/group_spec.rb