Sha256: 5b3067c9ee8b362ff5a60df341aaeb532ee1c7c85ff3a527c79b13e97d83717c

Contents?: true

Size: 447 Bytes

Versions: 2

Compression:

Stored size: 447 Bytes

Contents

require 'spec_helper'

describe ObjectAttorney::Base do

  context "Initializing an attorney with an object" do
    before do
      @user = User.new

      @user_validator = Class.new(ObjectAttorney::Base) do
        validates_presence_of :first_name
      end

      @user_validator.new(@user).valid?
    end

    it "should validate the object" do
      expect(@user.errors.messages).to eq({ first_name: ["can't be blank"] })
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
object_attorney-3.0.2 spec/object_attorney/base_spec.rb
object_attorney-3.0.0 spec/object_attorney/base_spec.rb