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
|
2017-05-08 16:08:39 -04:00
|
|
|
find('.btn-new').trigger('click')
|
2017-03-12 11:22:00 -04:00
|
|
|
new_path = 'Samurai'
|
|
|
|
new_description = 'Tokugawa Shogunate'
|
2017-01-04 05:27:29 -05:00
|
|
|
|
2017-03-12 11:22:00 -04:00
|
|
|
fill_in 'group_path', with: new_path
|
|
|
|
fill_in 'group_description', with: new_description
|
2017-01-04 05:27:29 -05:00
|
|
|
click_button 'Create group'
|
|
|
|
|
2017-03-12 11:22:00 -04:00
|
|
|
expect(current_path).to eq group_path(Group.find_by(name: new_path))
|
|
|
|
expect(page).to have_content(new_path)
|
|
|
|
expect(page).to have_content(new_description)
|
2017-01-04 05:27:29 -05:00
|
|
|
end
|
|
|
|
end
|