Skip to content
This repository has been archived by the owner on Nov 6, 2021. It is now read-only.

Commit

Permalink
Add spec to family_request.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
EmersonAraki committed Sep 13, 2019
1 parent 83fec1c commit 82aee83
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/models/family_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,32 @@
require "rails_helper"

RSpec.describe FamilyRequest, type: :model do
let(:partner) { create(:partner) }
let(:family_request) { create(:family_request, partner: partner) }

it { should belong_to(:partner) }

it { should have_many(:family_request_children) }

it { should have_many(:children) }

describe "a valid FamilyRequest" do
it "requires a Family" do
expect(build_stubbed(:family_request, partner: partner)).to be_valid
expect(build_stubbed(:family_request, partner: nil)).not_to be_valid
end
end

describe "#export_json" do
it "should return a JSON format" do
request = family_request

expect(request.export_json).to eql
{
organization_id: partner.id,
partner_id: partner.id,
requested_items: []
}.to_json
end
end
end

0 comments on commit 82aee83

Please sign in to comment.