Sha256: 0b15479ae7703b67bfb972d7e3c2dc4b8ddc10d96affad0c18d55ade47a8b413

Contents?: true

Size: 686 Bytes

Versions: 66

Compression:

Stored size: 686 Bytes

Contents

require 'spec_helper'

describe 'Acfs::Model::Initialization' do
  let(:model) do
    Class.new.tap do |c|
      c.class_eval do
        include Acfs::Model
        attr_accessor :name, :age
        private :age=
      end
    end
  end

  describe '#initialize' do
    it 'should allow to set attributes with initializer' do
      m = model.new(name: "John")
      expect(m.name).to be == "John"
    end

    it 'should raise error when attributes with private setters are given' do
      expect { model.new(age: 25) }.to raise_error(NoMethodError)
    end
  end

  describe '#persisted?' do
    it 'should be false' do
      expect(model.new.persisted?).to be_false
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
acfs-0.25.0.1.b227 spec/acfs/model/initialization_spec.rb
acfs-0.25.0.1.b226 spec/acfs/model/initialization_spec.rb
acfs-0.25.0.1.b225 spec/acfs/model/initialization_spec.rb
acfs-0.25.0.1.b223 spec/acfs/model/initialization_spec.rb
acfs-0.25.0.1.b221 spec/acfs/model/initialization_spec.rb
acfs-0.25.0.1.b217 spec/acfs/model/initialization_spec.rb
acfs-0.25.0 spec/acfs/model/initialization_spec.rb
acfs-0.24.0.1.b216 spec/acfs/model/initialization_spec.rb
acfs-0.24.0.1.b214 spec/acfs/model/initialization_spec.rb
acfs-0.24.0.1.b212 spec/acfs/model/initialization_spec.rb
acfs-0.24.0.b210 spec/acfs/model/initialization_spec.rb
acfs-0.24.0 spec/acfs/model/initialization_spec.rb
acfs-0.23.2.b209 spec/acfs/model/initialization_spec.rb
acfs-0.23.2.b208 spec/acfs/model/initialization_spec.rb
acfs-0.23.2.b206 spec/acfs/model/initialization_spec.rb
acfs-0.23.2.b205 spec/acfs/model/initialization_spec.rb
acfs-0.23.2.b204 spec/acfs/model/initialization_spec.rb
acfs-0.23.2.b203 spec/acfs/model/initialization_spec.rb
acfs-0.23.2.b200 spec/acfs/model/initialization_spec.rb
acfs-0.23.2.b199 spec/acfs/model/initialization_spec.rb