Sha256: 859aa33e2f5f88f2a29f31434e7337f7e112c662af16042e229d47a6d824fd68

Contents?: true

Size: 750 Bytes

Versions: 3

Compression:

Stored size: 750 Bytes

Contents

require "spec_helper"

describe Detour::Group do
  it { should validate_presence_of   :name }
  it { should validate_presence_of   :flaggable_type }
  it { should validate_uniqueness_of(:name).scoped_to(:flaggable_type) }
  it { should ensure_inclusion_of(:flaggable_type).in_array(Detour.config.flaggable_types) }

  it { should accept_nested_attributes_for :memberships }

  it { should have_many(:memberships).dependent(:destroy) }
  it { should have_many(:database_group_flags).dependent(:destroy) }
  it { should allow_mass_assignment_of :name }
  it { should allow_mass_assignment_of :flaggable_type }

  describe "#to_s" do
    it "returns the group name" do
      group = create :group
      group.to_s.should eq group.name
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
detour-0.0.15 spec/models/detour/group_spec.rb
detour-0.0.14 spec/models/detour/group_spec.rb
detour-0.0.13 spec/models/detour/group_spec.rb