Commit 9e4f2aa418a4d76d210fa63e5d9481de6614ec31
1 parent
c2fa3cda
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
comment_paragraph: add functional tests
Showing
1 changed file
with
38 additions
and
0 deletions
Show diff stats
plugins/comment_paragraph/test/functional/comment_paragraph_plugin_test.rb
0 → 100644
... | ... | @@ -0,0 +1,38 @@ |
1 | +require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
2 | +require File.dirname(__FILE__) + '/../../controllers/comment_paragraph_plugin_admin_controller' | |
3 | + | |
4 | +# Re-raise errors caught by the controller. | |
5 | +class CommentParagraphPluginAdminController; def rescue_action(e) raise e end; end | |
6 | + | |
7 | +class CommentParagraphPluginAdminControllerTest < ActionController::TestCase | |
8 | + | |
9 | + def setup | |
10 | + @environment = Environment.default | |
11 | + user_login = create_admin_user(@environment) | |
12 | + login_as(user_login) | |
13 | + @environment.enabled_plugins = ['CommentParagraphPlugin'] | |
14 | + @environment.save! | |
15 | + @plugin_settings = Noosfero::Plugin::Settings.new(@environment, CommentParagraphPlugin) | |
16 | + end | |
17 | + | |
18 | + should 'access index action' do | |
19 | + get :index | |
20 | + assert_template 'index' | |
21 | + assert_response :success | |
22 | + end | |
23 | + | |
24 | + should 'update comment paragraph plugin settings' do | |
25 | + assert_nil @plugin_settings.get_setting(:auto_marking_article_types) | |
26 | + post :index, :settings => { :auto_marking_article_types => ['TinyMceArticle'] } | |
27 | + @environment.reload | |
28 | + assert_not_nil @plugin_settings.get_setting(:auto_marking_article_types) | |
29 | + end | |
30 | + | |
31 | + should 'get article types previously selected' do | |
32 | + post :index, :settings => { :auto_marking_article_types => ['TinyMceArticle', 'TextileArticle'] } | |
33 | + get :index | |
34 | + assert_tag :input, :attributes => { :value => 'TinyMceArticle' } | |
35 | + assert_tag :input, :attributes => { :value => 'TextileArticle' } | |
36 | + end | |
37 | + | |
38 | +end | ... | ... |