haikuwebdev (owner)

Forks

Revisions

gist: 6215 Download_button fork
public
Public Clone URL: git://gist.github.com/6215.git
Embed All Files: show embed
Text #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 => 'abenter@caltech.edu', :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', :user => {:login => @editor.login, :password => @editor.password}
    # assert_redirected_to '/'
    assert_match /Invalid/, flash[:notice]
  end
end