lk | add some tests for bike#available_for_freecyclery

This commit is contained in:
Louis Knapp
2016-05-12 21:34:35 -05:00
parent 2e8edce6ef
commit 87577ab14e
6 changed files with 42 additions and 13 deletions
+18
View File
@@ -12,4 +12,22 @@ describe Bike do
expect(bike.post_to_bike_index).to be_truthy
end
end
describe "#available_for_freecyclery" do
it "does not return bikes that are assigned to clients" do
bike = create :bike, :freecyclery
create :client, bike_id: bike.id
expect(Bike.available_for_freecyclery).to be_empty
end
it "does not return sales bikes" do
bike = create :bike, :sale
create :client, bike_id: bike.id
expect(Bike.available_for_freecyclery).to be_empty
end
it "does return bikes without clients" do
bike = create :bike, :freecyclery
expect(Bike.available_for_freecyclery).to include(bike)
end
end
end