lk | user can log multiple bikes in a row

This commit is contained in:
Louis Knapp
2015-09-19 17:47:45 -05:00
parent db0945ce81
commit f2badbd484
5 changed files with 26 additions and 21 deletions
+12
View File
@@ -9,12 +9,23 @@ describe BikesController do
sign_in user
end
describe "GET #index" do
it "assignes unsold bikes" do
bike = FactoryGirl.create(:bike, date_sold: nil, purpose: "Sale")
get :index
expect(assigns(:unsold_bikes)).to eq([bike])
end
end
describe "POST #create" do
it "creates a new bike with valid credentials" do
expect{
post :create, bike: FactoryGirl.attributes_for(:bike)
}.to change(Bike, :count).by(1)
end
it "redirects to new bike path" do
expect(post :create, bike: FactoryGirl.attributes_for(:bike)).to redirect_to(new_bike_path)
end
end
describe "GET #new" do
@@ -25,4 +36,5 @@ describe BikesController do
end
end
end