-
-
Save cnk/6216 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/../test_helper' | |
class EditorActionsTest < ActionController::IntegrationTest | |
# CNK not sure if we are going to use fixtures | |
# I would prefer to use factories but am having trouble with that | |
# fixtures :users, :roles, :roles_users, :pages | |
def setup | |
@home_page = Factory.create_home_page | |
@editor = Factory.create_user_with_role('editor', :login => 'abenter', :email => '[email protected]', :password => 'abenter', :password_confirmation => 'abenter') | |
end | |
def test_editor_editing_pages | |
# Before logging in, there shouldn't be any edit links | |
get '/' | |
assert_response :success | |
assert_no_tag "a[href=login]" | |
# now login, and we should have edit links | |
puts "login is #{@editor.login}" | |
puts "login is #{@editor.password}" | |
get '/login' | |
assert_template 'sessions/new' | |
assert_select "form" do | |
assert_select "input#password" | |
end | |
post '/session', :login => @editor.login, :password => @editor.password | |
assert_redirected_to '/' | |
assert_equal "Logged in successfully", flash[:notice] | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment