Sha256: 60c1f9d8b6456e828f123d30413512ba715df01f0face3d5d775fcb44735b061

Contents?: true

Size: 1019 Bytes

Versions: 24

Compression:

Stored size: 1019 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

24 entries across 23 versions & 2 rubygems

Version Path
enju_leaf-1.1.0.rc21 spec/models/role_spec.rb
enju_leaf-1.1.0.rc20 spec/models/role_spec.rb
enju_leaf-1.1.0.rc19 spec/models/role_spec.rb
enju_leaf-1.1.0.rc18 spec/models/role_spec.rb