Sha256: 8bdb9b550c2e7fe3bfd7f9dab3e0b524eda73a8b47b24e7563c23d54ac841e9b

Contents?: true

Size: 724 Bytes

Versions: 6

Compression:

Stored size: 724 Bytes

Contents

require "spec_helper"

RSpec.describe Approval::RequestForm::Destroy do
  describe "#save" do
    let(:user) { create :user }
    let(:reason) { "reason" }
    let(:form) { described_class.new(user: user, reason: reason, records: records) }

    subject { form.save }

    context "when records is single" do
      let(:records) { create :book }
      it { expect { subject }.not_to raise_error }
      it { expect { subject }.to change { Approval::Item.count }.from(0).to(1) }
    end

    context "when records is multiple" do
      let(:records) { create_list :book, 3 }
      it { expect { subject }.not_to raise_error }
      it { expect { subject }.to change { Approval::Item.count }.from(0).to(3) }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
approval-0.3.2 spec/models/request_form/destroy_spec.rb
approval-0.3.1 spec/models/request_form/destroy_spec.rb
approval-0.3.0 spec/models/request_form/destroy_spec.rb
approval-0.2.3 spec/models/request_form/destroy_spec.rb
approval-0.2.2 spec/models/request_form/destroy_spec.rb
approval-0.2.0 spec/models/request_form/destroy_spec.rb