mirror of
https://github.com/fspc/bike-database.git
synced 2026-09-16 08:31:39 -04:00
lk | user can log multiple bikes in a row
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user