2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
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
|
2018-12-13 13:39:08 +05:30
|
|
|
new_name = 'Samurai'
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
fill_in 'group_name', with: new_name
|
2017-08-17 22:00:37 +05:30
|
|
|
click_button 'Create group'
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
expect(current_path).to eq group_path(Group.find_by(name: new_name))
|
|
|
|
expect(page).to have_content(new_name)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|