2015-04-26 12:48:37 +05:30
|
|
|
class Spinach::Features::DashboardGroup < Spinach::FeatureSteps
|
2014-09-02 18:07:02 +05:30
|
|
|
include SharedAuthentication
|
|
|
|
include SharedGroup
|
|
|
|
include SharedPaths
|
|
|
|
include SharedUser
|
|
|
|
|
|
|
|
# Leave
|
|
|
|
|
|
|
|
step 'I click on the "Leave" button for group "Owned"' do
|
2015-04-26 12:48:37 +05:30
|
|
|
find(:css, 'li', text: "Owner").find(:css, 'i.fa.fa-sign-out').click
|
2014-09-02 18:07:02 +05:30
|
|
|
# poltergeist always confirms popups.
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click on the "Leave" button for group "Guest"' do
|
2015-04-26 12:48:37 +05:30
|
|
|
find(:css, 'li', text: "Guest").find(:css, 'i.fa.fa-sign-out').click
|
2014-09-02 18:07:02 +05:30
|
|
|
# poltergeist always confirms popups.
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see the "Leave" button for group "Owned"' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(find(:css, 'li', text: "Owner")).not_to have_selector(:css, 'i.fa.fa-sign-out')
|
2014-09-02 18:07:02 +05:30
|
|
|
# poltergeist always confirms popups.
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see the "Leave" button for groupr "Guest"' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(find(:css, 'li', text: "Guest")).not_to have_selector(:css, 'i.fa.fa-sign-out')
|
2014-09-02 18:07:02 +05:30
|
|
|
# poltergeist always confirms popups.
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see group "Owned" in group list' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content("Owned")
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see group "Owned" in group list' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).not_to have_content("Owned")
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see group "Guest" in group list' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content("Guest")
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see group "Guest" in group list' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).not_to have_content("Guest")
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
|
|
|
|
step 'I click new group link' do
|
|
|
|
click_link "New Group"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'submit form with new group "Samurai" info' do
|
|
|
|
fill_in 'group_path', with: 'Samurai'
|
|
|
|
fill_in 'group_description', with: 'Tokugawa Shogunate'
|
|
|
|
click_button "Create group"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should be redirected to group "Samurai" page' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(current_path).to eq group_path(Group.find_by(name: 'Samurai'))
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see newly created group "Samurai"' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content "Samurai"
|
|
|
|
expect(page).to have_content "Tokugawa Shogunate"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see the "Can not leave message"' do
|
2016-06-16 23:09:34 +05:30
|
|
|
expect(page).to have_content "You can not leave the \"Owned\" group."
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|