Sha256: e78a41332a8836054f0ba74bc9483f1484ceecddd0cf9e4c79d740324702f3e3

Contents?: true

Size: 685 Bytes

Versions: 28

Compression:

Stored size: 685 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

28 entries across 28 versions & 1 rubygems

Version Path
acfs-0.42.0 spec/acfs/model/initialization_spec.rb
acfs-0.41.1 spec/acfs/model/initialization_spec.rb
acfs-0.41.1.beta1 spec/acfs/model/initialization_spec.rb
acfs-0.41.0 spec/acfs/model/initialization_spec.rb
acfs-0.40.1.rc1 spec/acfs/model/initialization_spec.rb
acfs-0.40.0 spec/acfs/model/initialization_spec.rb
acfs-0.39.1 spec/acfs/model/initialization_spec.rb
acfs-0.39.0 spec/acfs/model/initialization_spec.rb
acfs-0.38.0 spec/acfs/model/initialization_spec.rb
acfs-0.37.0.1.b295 spec/acfs/model/initialization_spec.rb
acfs-0.37.0 spec/acfs/model/initialization_spec.rb
acfs-0.36.0.1.b293 spec/acfs/model/initialization_spec.rb
acfs-0.36.0 spec/acfs/model/initialization_spec.rb
acfs-0.35.0.1.b291 spec/acfs/model/initialization_spec.rb
acfs-0.35.0 spec/acfs/model/initialization_spec.rb
acfs-0.34.1.1.b289 spec/acfs/model/initialization_spec.rb
acfs-0.34.1 spec/acfs/model/initialization_spec.rb
acfs-0.34.0.1.b288 spec/acfs/model/initialization_spec.rb
acfs-0.34.0.1.b287 spec/acfs/model/initialization_spec.rb
acfs-0.34.0.1.b286 spec/acfs/model/initialization_spec.rb