comment_paragraph_plugin_test.rb
1.39 KB
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
33
34
35
36
37
38
require File.dirname(__FILE__) + '/../../../../test/test_helper'
require File.dirname(__FILE__) + '/../../controllers/comment_paragraph_plugin_admin_controller'
# Re-raise errors caught by the controller.
class CommentParagraphPluginAdminController; def rescue_action(e) raise e end; end
class CommentParagraphPluginAdminControllerTest < ActionController::TestCase
def setup
@environment = Environment.default
user_login = create_admin_user(@environment)
login_as(user_login)
@environment.enabled_plugins = ['CommentParagraphPlugin']
@environment.save!
@plugin_settings = Noosfero::Plugin::Settings.new(@environment, CommentParagraphPlugin)
end
should 'access index action' do
get :index
assert_template 'index'
assert_response :success
end
should 'update comment paragraph plugin settings' do
assert_nil @plugin_settings.get_setting(:auto_marking_article_types)
post :index, :settings => { :auto_marking_article_types => ['TinyMceArticle'] }
@environment.reload
assert_not_nil @plugin_settings.get_setting(:auto_marking_article_types)
end
should 'get article types previously selected' do
post :index, :settings => { :auto_marking_article_types => ['TinyMceArticle', 'TextileArticle'] }
get :index
assert_tag :input, :attributes => { :value => 'TinyMceArticle' }
assert_tag :input, :attributes => { :value => 'TextileArticle' }
end
end