Added api user feature spec

This commit is contained in:
Priit Tark 2015-04-16 16:41:21 +03:00
parent 8d4124585c
commit 752e39e4a9
5 changed files with 44 additions and 4 deletions

View file

@ -0,0 +1,42 @@
require 'rails_helper'
feature 'Api users', type: :feature do
background { create_settings }
before :all do
@user = Fabricate(:admin_user, username: 'user1', identity_code: '37810013087')
@api_user = Fabricate(:api_user)
end
context 'as unknown user' do
it 'should redirect to login path' do
visit admin_api_users_url
current_path.should == '/admin/login'
end
it 'should redirect to login path' do
visit admin_api_user_url(@api_user)
current_path.should == '/admin/login'
end
end
context 'as logged in user' do
it 'should show index of contacts' do
sign_in @user
visit admin_api_users_url
current_path.should == '/admin/api_users'
page.should have_content('API users')
end
it 'should show api user' do
sign_in @user
visit admin_api_user_url(@api_user)
current_path.should == "/admin/api_users/#{@api_user.id}"
end
end
end