Sha256: 83e42f675656a68f2dab4e24579aa403f3c8dbf3d3521ce6cab6db2690f62b0f

Contents?: true

Size: 1 KB

Versions: 12

Compression:

Stored size: 1 KB

Contents

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

# -*- 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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
enju_leaf-1.1.0.rc10 spec/models/role_spec.rb
enju_leaf-1.1.0.rc9 spec/models/role_spec.rb
enju_leaf-1.1.0.rc8 spec/models/role_spec.rb
enju_leaf-1.1.0.rc7 spec/models/role_spec.rb
enju_leaf-1.1.0.rc6 spec/models/role_spec.rb
enju_leaf-1.1.0.rc5 spec/models/role_spec.rb
enju_leaf-1.1.0.rc4 spec/models/role_spec.rb
enju_leaf-1.1.0.rc3 spec/models/role_spec.rb
enju_leaf-1.1.0.rc2 spec/models/role_spec.rb
enju_leaf-1.1.0.rc1 spec/models/role_spec.rb
enju_leaf-1.1.0.beta3 spec/models/role_spec.rb
enju_leaf-1.1.0.pre3 spec/models/role_spec.rb