spec/integration/projects_spec.rb in patch_ruby-1.13.0 vs spec/integration/projects_spec.rb in patch_ruby-1.14.0
- old
+ new
@@ -40,11 +40,28 @@
describe 'returned fields' do
it 'returns the expected fields' do
project = Patch::Project.retrieve_projects(page: 1).data.first
+ keys = attributes_for(:project).keys
+ expect(project.to_hash.keys).to include(*keys)
+
expect(project.photos).to be_an_instance_of(Array)
- expect(project.average_price_per_tonne_cents_usd).to be_an_instance_of(Integer)
+ expect(project.average_price_per_tonne_cents_usd)
+ .to be_an_instance_of(Integer)
expect(project.remaining_mass_g).to be_an_instance_of(Integer)
+ expect(project.state).to be_an_instance_of(String)
+ expect(project.longitude).to be_an_instance_of(Float)
+ expect(project.latitude).to be_an_instance_of(Float)
+
+ expect(project.technology_type)
+ .to be_an_instance_of(Patch::TechnologyType)
+ expect(project.technology_type.name).to be_an_instance_of(String)
+ expect(project.technology_type.slug).to be_an_instance_of(String)
+
+ parent_type = project.technology_type.parent_technology_type
+ expect(parent_type).to be_an_instance_of(Patch::ParentTechnologyType)
+ expect(parent_type.name).to be_an_instance_of(String)
+ expect(parent_type.slug).to be_an_instance_of(String)
end
end
end