Sha256: ed4cc2f8407af43a1a474dd94e0366e723b8c33b856eeac0e9a339ac9e84edb5

Contents?: true

Size: 660 Bytes

Versions: 2

Compression:

Stored size: 660 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Doodad, type: :model do
  describe 'Mixin functioning' do
    it { should have_many(:works_cited_citations) }
  end
  describe 'WorksCited Methods' do
    describe '#works_cited_citations_attributes=' do
      let!(:doodad) { FactoryBot.create(:doodad) }
      it 'saves the citations' do
        expect do
          citation_attributes = FactoryBot.build(:works_cited_citation).attributes
          doodad.works_cited_citations_attributes = { "0" => citation_attributes }
          doodad.save
        end.to change { doodad.works_cited_citations.count }.by(1)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
works_cited-0.1.16 spec/models/doodad_spec.rb
works_cited-0.1.15 spec/models/doodad_spec.rb