Skip to content

Commit

Permalink
add spec for family
Browse files Browse the repository at this point in the history
  • Loading branch information
one-m1nd committed Mar 4, 2024
1 parent 451f757 commit 9c3719e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions spec/models/family_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
RSpec.describe Family, type: :model do
describe '#trefle_data' do
before(:each) do
stub_request(:get, "https://trefle.io/api/v1/families/familyone")
.to_return(status: 404, body: '{}', headers: { 'Content-Type' => 'application/json' })
end

subject { Family.first.trefle_data }

it do
expect(subject).to be_instance_of(Hash)
expect(
a_request(:get, "https://trefle.io/api/v1/families/familyone")
).to have_been_made
end
end

describe '#genera' do
subject { Family.first.genera }

it do
expect(subject).to all(be_instance_of(Genus))
end
end

describe '#plants' do
subject { Family.first.plants }

it do
expect(subject).to all(be_instance_of(Plant))
end
end
end

0 comments on commit 9c3719e

Please sign in to comment.