You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
570 B
28 lines
570 B
require 'spec_helper'
|
|
|
|
describe BikesController do
|
|
|
|
let(:user){FactoryGirl.create(:user)}
|
|
let(:bike){FactoryGirl.create(:bike)}
|
|
|
|
before :each do
|
|
sign_in user
|
|
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
|
|
end
|
|
|
|
describe "GET #new" do
|
|
it "assigns a log number" do
|
|
FactoryGirl.create(:bike, log_number: 3)
|
|
get :new
|
|
expect(assigns(:log_number)).to eq(4)
|
|
end
|
|
end
|
|
|
|
end
|
|
|