Commit 9eeb492c3fc64d0858a935c135bc134bf65f7e49

Authored by AntonioTerceiro
1 parent 6d89dd7e

ActionItem21: writing integration test



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1005 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 1 changed file with 20 additions and 2 deletions   Show diff stats
test/integration/manage_documents_test.rb
... ... @@ -5,8 +5,26 @@ class ManageDocumentsTest < ActionController::IntegrationTest
5 5 all_fixtures
6 6  
7 7 def test_creation_of_a_new_article
8   - # FIXME
9   - fail 'need to be rewritten'
  8 + create_user('myuser')
  9 +
  10 + login('myuser', 'myuser')
  11 +
  12 + assert_tag :tag => 'a', :attributes => { :href => '/myprofile/myuser' }
  13 + get '/myprofile/myuser'
  14 +
  15 + assert_tag :tag => 'a', :attributes => { :href => '/myprofile/myuser/cms' }
  16 + get '/myprofile/myuser/cms/new'
  17 +
  18 + assert_tag :tag => 'form', :attributes => { :action => '/myprofile/myuser/cms/new', :method => /post/i }
  19 +
  20 + assert_difference Article, :count do
  21 + post '/myprofile/myuser/cms/new', :article => { :name => 'my article', :body => 'this is the body of ther article'}
  22 + end
  23 +
  24 + assert_response :redirect
  25 + follow_redirect!
  26 + a = Article.find_by_path('my-article')
  27 + assert_equal "/myprofile/myuser/cms/view/#{a.id}", path
10 28 end
11 29  
12 30 def test_update_of_an_existing_article
... ...