2018-01-26 21:49:20 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-02-02 21:51:03 +00:00
|
|
|
describe UserCalloutsController do
|
2018-01-26 21:49:20 +00:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
2018-02-02 21:23:26 +00:00
|
|
|
describe "POST #create" do
|
|
|
|
subject { post :create, feature_name: 'feature_name', format: :json }
|
2018-01-26 21:49:20 +00:00
|
|
|
|
|
|
|
context 'when callout entry does not exist' do
|
|
|
|
it 'should create a callout entry with dismissed state' do
|
2018-02-02 21:51:03 +00:00
|
|
|
expect { subject }.to change { UserCallout.count }.by(1)
|
2018-01-26 21:49:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should return success' do
|
|
|
|
subject
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when callout entry already exists' do
|
2018-02-02 21:51:03 +00:00
|
|
|
let!(:callout) { create(:user_callout, feature_name: 'feature_name', user: user) }
|
2018-01-26 21:49:20 +00:00
|
|
|
|
|
|
|
it 'should return success' do
|
|
|
|
subject
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|