Sha256: db966b5a596aea4836f1a9f9bb2fc3340aca999595c948212aa8e8387ebd6303
Contents?: true
Size: 982 Bytes
Versions: 4
Compression:
Stored size: 982 Bytes
Contents
# Copyright (c) 2024 Jerome Arbez-Gindre # frozen_string_literal: true require('defmastership/matching_line') RSpec.describe(Defmastership::MatchingLine) do describe '.new' do subject(:matching_line) do described_class.new(:a_match, :a_line) end it { is_expected.not_to(be_nil) } it { is_expected.to(have_attributes(match: :a_match)) } it { is_expected.to(have_attributes(line: :a_line)) } end describe '#[]' do subject(:matching_line) do described_class.new(match, :a_line) end let(:match) { instance_double(Hash, 'match') } before do allow(match).to(receive(:[]).with(:whatever).and_return('Whatever')) allow(match).to(receive(:[]).with(:line).and_return(nil)) end it do matching_line[:whatever] expect(match).to(have_received(:[]).with(:whatever)) end it { expect(matching_line[:whatever]).to(eq('Whatever')) } it { expect(matching_line[:line]).to(eq(:a_line)) } end end
Version data entries
4 entries across 4 versions & 1 rubygems