2019-09-03 13:45:00 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-03 23:08:05 -04:00
|
|
|
RSpec.describe Dashboard::SnippetsController do
|
2020-07-10 14:09:45 -04:00
|
|
|
let_it_be(:user) { create(:user) }
|
2019-09-03 13:45:00 -04:00
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET #index' do
|
|
|
|
it_behaves_like 'paginated collection' do
|
|
|
|
let(:collection) { Snippet.all }
|
|
|
|
|
|
|
|
before do
|
|
|
|
create(:personal_snippet, :public, author: user)
|
|
|
|
end
|
|
|
|
end
|
2020-02-05 04:08:43 -05:00
|
|
|
|
|
|
|
it 'fetches snippet counts via the snippet count service' do
|
|
|
|
service = double(:count_service, execute: {})
|
|
|
|
expect(Snippets::CountService)
|
|
|
|
.to receive(:new).with(user, author: user)
|
|
|
|
.and_return(service)
|
|
|
|
|
|
|
|
get :index
|
|
|
|
end
|
2020-07-10 14:09:45 -04:00
|
|
|
|
|
|
|
it_behaves_like 'snippets sort order'
|
2021-01-12 13:11:03 -05:00
|
|
|
|
2021-04-12 11:09:30 -04:00
|
|
|
it_behaves_like 'snippets views'
|
2019-09-03 13:45:00 -04:00
|
|
|
end
|
|
|
|
end
|