Sha256: 6f7ff4534d3c478747408e167b0f27647abbcdacdf8bde60c0494db65f65e41e

Contents?: true

Size: 686 Bytes

Versions: 32

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

32 entries across 32 versions & 1 rubygems

Version Path
acfs-0.32.1.1.b275 spec/acfs/model/initialization_spec.rb
acfs-0.32.1.1.b274 spec/acfs/model/initialization_spec.rb
acfs-0.32.1.1.b272 spec/acfs/model/initialization_spec.rb
acfs-0.32.1 spec/acfs/model/initialization_spec.rb
acfs-0.32.0.1.b270 spec/acfs/model/initialization_spec.rb
acfs-0.31.0.1.b269 spec/acfs/model/initialization_spec.rb
acfs-0.32.0 spec/acfs/model/initialization_spec.rb
acfs-0.31.0.1.b265 spec/acfs/model/initialization_spec.rb
acfs-0.31.0.1.b263 spec/acfs/model/initialization_spec.rb
acfs-0.31.0 spec/acfs/model/initialization_spec.rb
acfs-0.30.0.1.b262 spec/acfs/model/initialization_spec.rb
acfs-0.30.0.1.b261 spec/acfs/model/initialization_spec.rb
acfs-0.30.0.1.b260 spec/acfs/model/initialization_spec.rb
acfs-0.30.0 spec/acfs/model/initialization_spec.rb
acfs-0.29.1.1.b259 spec/acfs/model/initialization_spec.rb
acfs-0.29.1.1.b257 spec/acfs/model/initialization_spec.rb
acfs-0.29.1 spec/acfs/model/initialization_spec.rb
acfs-0.29.0.1.b256 spec/acfs/model/initialization_spec.rb
acfs-0.29.0.1.b254 spec/acfs/model/initialization_spec.rb
acfs-0.29.0 spec/acfs/model/initialization_spec.rb