2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
RSpec.describe 'Dashboard Group' do
|
2017-08-17 22:00:37 +05:30
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(create(:user))
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
it 'defaults sort dropdown to last created' do
|
2017-08-17 22:00:37 +05:30
|
|
|
visit dashboard_groups_path
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
expect(page).to have_button('Last created')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates new group', :js do
|
|
|
|
visit dashboard_groups_path
|
2018-12-05 23:21:45 +05:30
|
|
|
find('.btn-success').click
|
2017-08-17 22:00:37 +05:30
|
|
|
new_path = 'Samurai'
|
|
|
|
new_description = 'Tokugawa Shogunate'
|
|
|
|
|
|
|
|
fill_in 'group_path', with: new_path
|
|
|
|
fill_in 'group_description', with: new_description
|
|
|
|
click_button 'Create group'
|
|
|
|
|
|
|
|
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)
|
|
|
|
end
|
|
|
|
end
|