2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-29 03:56:52 -04:00
|
|
|
require 'spec_helper'
|
2017-04-27 09:13:54 -04:00
|
|
|
|
2020-06-16 14:09:01 -04:00
|
|
|
RSpec.describe 'Cohorts page' do
|
2017-04-27 09:13:54 -04:00
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(create(:admin))
|
2020-08-27 02:10:37 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'with usage ping enabled' do
|
|
|
|
it 'shows users count per month' do
|
|
|
|
stub_application_setting(usage_ping_enabled: true)
|
|
|
|
|
|
|
|
create_list(:user, 2)
|
|
|
|
|
|
|
|
visit admin_cohorts_path
|
2018-09-08 03:23:01 -04:00
|
|
|
|
2020-08-27 02:10:37 -04:00
|
|
|
expect(page).to have_content("#{Time.now.strftime('%b %Y')} 3 0")
|
|
|
|
end
|
2017-04-27 09:13:54 -04:00
|
|
|
end
|
|
|
|
|
2020-08-27 02:10:37 -04:00
|
|
|
context 'with usage ping disabled' do
|
|
|
|
it 'shows empty state', :js do
|
|
|
|
stub_application_setting(usage_ping_enabled: false)
|
2017-04-27 09:13:54 -04:00
|
|
|
|
2020-08-27 02:10:37 -04:00
|
|
|
visit admin_cohorts_path
|
2017-04-27 09:13:54 -04:00
|
|
|
|
2020-08-27 02:10:37 -04:00
|
|
|
expect(page).to have_selector(".js-empty-state")
|
|
|
|
end
|
2017-04-27 09:13:54 -04:00
|
|
|
end
|
|
|
|
end
|