osem-fcy/spec/features/user_spec.rb

25 lines
623 B
Ruby
Raw Normal View History

2014-05-15 17:28:08 +05:30
require 'spec_helper'
2014-08-12 11:51:59 +03:00
2014-05-15 17:28:08 +05:30
feature User do
2014-07-21 14:37:26 +02:00
shared_examples 'admin ability' do
2014-05-15 17:28:08 +05:30
scenario 'deletes a user', feature: true, js: true do
2014-08-12 11:51:59 +03:00
sign_in(create(:admin))
2014-05-15 17:28:08 +05:30
visit admin_users_path
expected_count = User.count - 1
page.all('btn btn-primary btn-danger') do
click_link 'Delete'
page.evaluate_script('window.confirm = function() { return true; }')
page.click('OK')
expect(flash).to eq('User got deleted')
expect(User.count).to eq(expected_count)
end
sign_out
end
end
2014-07-21 14:37:26 +02:00
2014-05-15 17:28:08 +05:30
describe 'admin' do
it_behaves_like 'admin ability', :admin
end
end