diff options
Diffstat (limited to 'spec/features/admin/admin_cohorts_spec.rb')
-rw-r--r-- | spec/features/admin/admin_cohorts_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/features/admin/admin_cohorts_spec.rb b/spec/features/admin/admin_cohorts_spec.rb new file mode 100644 index 00000000000..f91446ed222 --- /dev/null +++ b/spec/features/admin/admin_cohorts_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Cohorts page' do + before do + sign_in(create(:admin)) + 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 + + expect(page).to have_content("#{Time.now.strftime('%b %Y')} 3 0") + end + end + + context 'with usage ping disabled' do + it 'shows empty state', :js do + stub_application_setting(usage_ping_enabled: false) + + visit admin_cohorts_path + + expect(page).to have_selector(".js-empty-state") + end + end +end |