Sha256: cd40185919068fcf00d736cceeda8127d33e3987d4a9abd77f90ff8c17907e2f

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

Stored size: 828 Bytes

Contents

require 'spec_helper'

class ValidationsTestAccount < ActiveRecord::Base
  set_table_name("accounts")
  attr_accessible :name
  bento(:validations)
end

describe Bento::Models::Modules::Validations do
  subject { ValidationsTestAccount.new }
  it { should be_invalid_without(:name) }
  it { should_not have_user_accessors }
  it { should_not respond_to(:users) }
  it { should_not respond_to(:trial_days_remaining) }
  it { should_not respond_to(:build_user) }

  it "validates pressence of name" do
    account2 = ValidationsTestAccount.create(:name => "")
    account2.should have(1).error_on(:name)
  end

  it "validates uniquness of name" do
    account1 = ValidationsTestAccount.create!(:name => "Elabs")
    account2 = ValidationsTestAccount.create(:name => "Elabs")
    account2.should have(1).error_on(:name)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bento-0.0.3 spec/bento/models/modules/validations_spec.rb
bento-0.0.2 spec/bento/models/modules/validations_spec.rb