Velocipede's User, Sales, and Bike Inventory Web App
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.
 
 
 
 
 
 

29 lines
685 B

require 'spec_helper'
describe Api::V1::TimeEntriesController do
describe "#create" do
context "as a user" do
let!(:user){ FactoryGirl.create(:user) }
before(:each) do
sign_in user
end
context "with no time entry in json data" do
it "returns error status" do
post :create
json = JSON.parse(@response.body)
expect(@response.code.to_i).to eql 422
end
it "returns an error message" do
post :create
json = JSON.parse(@response.body)
expect(json["errors"].first).to eql Api::V1::TimeEntriesController::EXPECTED_TIME_ENTRY
end
end
end
end
end