Sha256: e670d560efa78c309d4c537b9b7a737b1144466b53ed3f70a8df941231be9ff7

Contents?: true

Size: 721 Bytes

Versions: 6

Compression:

Stored size: 721 Bytes

Contents

require "spec_helper"

RSpec.describe Approval::RequestForm::Create 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) { build :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) { build_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/create_spec.rb
approval-0.3.1 spec/models/request_form/create_spec.rb
approval-0.3.0 spec/models/request_form/create_spec.rb
approval-0.2.3 spec/models/request_form/create_spec.rb
approval-0.2.2 spec/models/request_form/create_spec.rb
approval-0.2.0 spec/models/request_form/create_spec.rb