Sha256: 097387c90ad8389ff9417870b1f1d76850fb8bf1bf77fcfc36d1522a90d95884

Contents?: true

Size: 1016 Bytes

Versions: 10

Compression:

Stored size: 1016 Bytes

Contents

# -*- encoding: utf-8 -*-
require 'spec_helper'

describe Role do
  #pending "add some examples to (or delete) #{__FILE__}"
  fixtures :roles

  it "should not be saved if name is blank" do
    role = Role.first
    role.name = ''
    lambda{role.save!}.should raise_error(ActiveRecord::RecordInvalid)
  end

  it "should not be saved if name is not unique" do
    role = Role.first
    lambda{Role.create!(name: role.name)}.should raise_error(ActiveRecord::RecordInvalid)
  end

  it "should respond to localized_name" do
    roles(:role_00001).localized_name.should eq 'Guest'
  end

  it "should respond to default_role" do
    Role.default_role.should eq roles(:role_00001)
  end
end

# == Schema Information
#
# Table name: roles
#
#  id           :integer          not null, primary key
#  name         :string           not null
#  display_name :string
#  note         :text
#  created_at   :datetime
#  updated_at   :datetime
#  score        :integer          default(0), not null
#  position     :integer
#

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
enju_seed-0.3.6 spec/models/role_spec.rb
enju_seed-0.3.5 spec/models/role_spec.rb
enju_seed-0.3.4 spec/models/role_spec.rb
enju_seed-0.3.3 spec/models/role_spec.rb
enju_seed-0.3.2 spec/models/role_spec.rb
enju_seed-0.3.1 spec/models/role_spec.rb
enju_seed-0.3.0 spec/models/role_spec.rb
enju_seed-0.3.0.rc.1 spec/models/role_spec.rb
enju_seed-0.3.0.beta.7 spec/models/role_spec.rb
enju_seed-0.3.0.beta.6 spec/models/role_spec.rb