2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-01-04 05:27:29 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-29 00:13:10 -04:00
|
|
|
RSpec.describe 'Dashboard Group' do
|
2017-01-04 05:27:29 -05:00
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(create(:user))
|
2017-01-04 05:27:29 -05:00
|
|
|
end
|
|
|
|
|
2017-10-06 09:42:01 -04:00
|
|
|
it 'defaults sort dropdown to last created' do
|
|
|
|
visit dashboard_groups_path
|
|
|
|
|
|
|
|
expect(page).to have_button('Last created')
|
|
|
|
end
|
|
|
|
|
2017-10-03 04:35:01 -04:00
|
|
|
it 'creates new group', :js do
|
2017-01-04 05:27:29 -05:00
|
|
|
visit dashboard_groups_path
|
2018-09-18 05:58:22 -04:00
|
|
|
find('.btn-success').click
|
2018-10-30 12:23:47 -04:00
|
|
|
new_name = 'Samurai'
|
2017-03-12 11:22:00 -04:00
|
|
|
new_description = 'Tokugawa Shogunate'
|
2017-01-04 05:27:29 -05:00
|
|
|
|
2018-10-30 12:23:47 -04:00
|
|
|
fill_in 'group_name', with: new_name
|
2017-03-12 11:22:00 -04:00
|
|
|
fill_in 'group_description', with: new_description
|
2017-01-04 05:27:29 -05:00
|
|
|
click_button 'Create group'
|
|
|
|
|
2018-10-30 12:23:47 -04:00
|
|
|
expect(current_path).to eq group_path(Group.find_by(name: new_name))
|
|
|
|
expect(page).to have_content(new_name)
|
2017-03-12 11:22:00 -04:00
|
|
|
expect(page).to have_content(new_description)
|
2017-01-04 05:27:29 -05:00
|
|
|
end
|
|
|
|
end
|