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_seed-0.2.3 spec/models/role_spec.rb
enju_seed-0.2.2 spec/models/role_spec.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_seed-0.2.1/spec/models/role_spec.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_seed-0.2.0/spec/models/role_spec.rb
enju_seed-0.2.1 spec/models/role_spec.rb
enju_seed-0.2.0 spec/models/role_spec.rb
enju_seed-0.2.0.beta.7 spec/models/role_spec.rb
enju_seed-0.2.0.beta.6 spec/models/role_spec.rb
enju_seed-0.2.0.beta.5 spec/models/role_spec.rb
enju_seed-0.2.0.beta.4 spec/models/role_spec.rb
enju_seed-0.2.0.beta.3 spec/models/role_spec.rb
enju_seed-0.2.0.beta.2 spec/models/role_spec.rb
enju_seed-0.2.0.beta.1 spec/models/role_spec.rb
enju_leaf-1.2.0.beta.1 spec/models/role_spec.rb
enju_leaf-1.1.4 spec/models/role_spec.rb
enju_leaf-1.1.3 spec/models/role_spec.rb
enju_leaf-1.1.2 spec/models/role_spec.rb
enju_leaf-1.1.1 spec/models/role_spec.rb
enju_leaf-1.1.0 spec/models/role_spec.rb
enju_leaf-1.1.0.rc22 spec/models/role_spec.rb