Mercurial > hg > soundsoftware-site
comparison test/functional/.svn/text-base/messages_controller_test.rb.svn-base @ 37:94944d00e43c
* Update to SVN trunk rev 4411
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Fri, 19 Nov 2010 13:24:41 +0000 |
parents | 513646585e45 |
children | af80e5618e9b |
comparison
equal
deleted
inserted
replaced
22:40f7cfd4df19 | 37:94944d00e43c |
---|---|
85 post :new, :board_id => 1, | 85 post :new, :board_id => 1, |
86 :message => { :subject => 'Test created message', | 86 :message => { :subject => 'Test created message', |
87 :content => 'Message body'} | 87 :content => 'Message body'} |
88 message = Message.find_by_subject('Test created message') | 88 message = Message.find_by_subject('Test created message') |
89 assert_not_nil message | 89 assert_not_nil message |
90 assert_redirected_to "boards/1/topics/#{message.to_param}" | 90 assert_redirected_to "/boards/1/topics/#{message.to_param}" |
91 assert_equal 'Message body', message.content | 91 assert_equal 'Message body', message.content |
92 assert_equal 2, message.author_id | 92 assert_equal 2, message.author_id |
93 assert_equal 1, message.board_id | 93 assert_equal 1, message.board_id |
94 | 94 |
95 mail = ActionMailer::Base.deliveries.last | 95 mail = ActionMailer::Base.deliveries.last |
112 def test_post_edit | 112 def test_post_edit |
113 @request.session[:user_id] = 2 | 113 @request.session[:user_id] = 2 |
114 post :edit, :board_id => 1, :id => 1, | 114 post :edit, :board_id => 1, :id => 1, |
115 :message => { :subject => 'New subject', | 115 :message => { :subject => 'New subject', |
116 :content => 'New body'} | 116 :content => 'New body'} |
117 assert_redirected_to 'boards/1/topics/1' | 117 assert_redirected_to '/boards/1/topics/1' |
118 message = Message.find(1) | 118 message = Message.find(1) |
119 assert_equal 'New subject', message.subject | 119 assert_equal 'New subject', message.subject |
120 assert_equal 'New body', message.content | 120 assert_equal 'New body', message.content |
121 end | 121 end |
122 | 122 |
123 def test_reply | 123 def test_reply |
124 @request.session[:user_id] = 2 | 124 @request.session[:user_id] = 2 |
125 post :reply, :board_id => 1, :id => 1, :reply => { :content => 'This is a test reply', :subject => 'Test reply' } | 125 post :reply, :board_id => 1, :id => 1, :reply => { :content => 'This is a test reply', :subject => 'Test reply' } |
126 reply = Message.find(:first, :order => 'id DESC') | 126 reply = Message.find(:first, :order => 'id DESC') |
127 assert_redirected_to "boards/1/topics/1?r=#{reply.id}" | 127 assert_redirected_to "/boards/1/topics/1?r=#{reply.id}" |
128 assert Message.find_by_subject('Test reply') | 128 assert Message.find_by_subject('Test reply') |
129 end | 129 end |
130 | 130 |
131 def test_destroy_topic | 131 def test_destroy_topic |
132 @request.session[:user_id] = 2 | 132 @request.session[:user_id] = 2 |
133 post :destroy, :board_id => 1, :id => 1 | 133 post :destroy, :board_id => 1, :id => 1 |
134 assert_redirected_to 'projects/ecookbook/boards/1' | 134 assert_redirected_to '/projects/ecookbook/boards/1' |
135 assert_nil Message.find_by_id(1) | 135 assert_nil Message.find_by_id(1) |
136 end | 136 end |
137 | 137 |
138 def test_quote | 138 def test_quote |
139 @request.session[:user_id] = 2 | 139 @request.session[:user_id] = 2 |