Files
old-holivud2/spec/controllers/api/projects_controller_spec.rb

23 lines
702 B
Ruby
Raw Permalink Normal View History

2020-05-31 22:38:19 +02:00
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Api::ProjectsController, type: :controller do
let(:current_user) { create(:user, :admin) }
describe '#index' do
it 'returns a succesful response with and without updated_since param' do
create(:project, name: 'first', account_id: current_user.primary_account.id, updated_at: 10.days.ago)
create(:project, name: 'second', account_id: current_user.primary_account.id, updated_at: 10.days.ago)
sign_in_to_api(current_user)
get :index
expect(response).to be_successful
expect(response.body).to have_content('first')
expect(response.body).to have_content('second')
end
end
end