Sha256: 57828d0263ae1fa0acb4465cfc2ce8cadfb481d200a4a991607af0c0d074e312

Contents?: true

Size: 787 Bytes

Versions: 2

Compression:

Stored size: 787 Bytes

Contents

require 'spec_helper'

describe Role do
  it "should require a name" do
    expect(subject).not_to be_valid
    subject.name = 'foo'
    expect(subject).to be_valid
  end

  it "should not allow space in the name" do
    subject.name = 'foo bar'
    expect(subject).not_to be_valid
  end

  it "should not allow comma in the name" do
    subject.name = 'foo,bar'
    expect(subject).not_to be_valid
  end

  it "should not allow ampersand in the name" do
    subject.name = 'foo&bar'
    expect(subject).not_to be_valid
  end

  it "should not allow less-than in the name" do
    subject.name = 'foo<bar'
    expect(subject).not_to be_valid
  end

  it "should validate uniqueness" do
    subject.name ='foo'
    subject.save!
    expect(Role.new(name: 'foo')).not_to be_valid
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hydra-role-management-0.2.2 spec/models/role_spec.rb
hydra-role-management-0.2.1 spec/models/role_spec.rb