summaryrefslogtreecommitdiff
path: root/spec/features/dashboard/group_spec.rb
blob: 653a16bbbcca1f745fb6ac2f0572f843e6e0c05f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Dashboard Group' do
  before do
    sign_in(create(:user))
  end

  it 'defaults sort dropdown to last created' do
    visit dashboard_groups_path

    expect(page).to have_button('Last created')
  end

  it 'creates new group', :js do
    visit dashboard_groups_path
    find('.btn-success').click
    new_name = 'Samurai'
    new_description = 'Tokugawa Shogunate'

    fill_in 'group_name', with: new_name
    fill_in 'group_description', with: new_description
    click_button 'Create group'

    expect(current_path).to eq group_path(Group.find_by(name: new_name))
    expect(page).to have_content(new_name)
    expect(page).to have_content(new_description)
  end
end