Sha256: 0f69e5e3d321ef65f465edcfcd9724ea13fdaba832a2553db5c8928820e6464e

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

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).display_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
#  display_name_translations :jsonb            not null
#

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
enju_seed-0.4.0.rc.1 spec/models/role_spec.rb
enju_seed-0.4.0.beta.3 spec/models/role_spec.rb
enju_seed-0.5.0.beta.1 spec/models/role_spec.rb
enju_seed-0.4.0.beta.2 spec/models/role_spec.rb