Sha256: f69b344966fda96d77d3c216e79616b9e596a37f5d677acdb3d4721cb64c7c68
Contents?: true
Size: 1.02 KB
Versions: 62
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true ::RSpec.describe ::EacRubyUtils::Immutable do let(:stub_class) do the_described_class = described_class ::Class.new do include the_described_class immutable_accessor :array_attr, type: :array end end let(:initial_instance) { stub_class.new } it do expect(initial_instance.array_attrs).to eq([]) end context 'when array_attr pushs for' do let(:change1_instance) { initial_instance.array_attr('A') } it { expect(change1_instance).to be_a(initial_instance.class) } it { expect(change1_instance.object_id).not_to eq(initial_instance.object_id) } it { expect(change1_instance.array_attrs).to eq(%w[A]) } context 'when array_attrs sets for' do let(:change2_instance) { initial_instance.array_attrs(%w[B]) } it { expect(change2_instance).to be_a(initial_instance.class) } it { expect(change2_instance.object_id).not_to eq(change1_instance.object_id) } it { expect(change2_instance.array_attrs).to eq(%w[B]) } end end end
Version data entries
62 entries across 62 versions & 1 rubygems