Commit b36028dc574a808898fe7a070cb321fc9d30a610
1 parent
3db01eea
Exists in
staging
and in
4 other branches
should have article parent in step creatino
Showing
2 changed files
with
16 additions
and
0 deletions
Show diff stats
plugins/community_track/test/functional/community_track_plugin_cms_controller_test.rb
| ... | ... | @@ -6,6 +6,9 @@ class CmsController; def rescue_action(e) raise e end; end |
| 6 | 6 | class CmsControllerTest < ActionController::TestCase |
| 7 | 7 | |
| 8 | 8 | def setup |
| 9 | + @environment = Environment.default | |
| 10 | + @environment.enabled_plugins = ['CommunityTrackPlugin'] | |
| 11 | + @environment.save! | |
| 9 | 12 | @profile = fast_create(Community) |
| 10 | 13 | @track = create_track('track', @profile) |
| 11 | 14 | @step = CommunityTrackPlugin::Step.create!(:name => 'step1', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => Date.today, :start_date => Date.today) |
| ... | ... | @@ -39,4 +42,15 @@ class CmsControllerTest < ActionController::TestCase |
| 39 | 42 | assert_equal 'changed', @step.name |
| 40 | 43 | end |
| 41 | 44 | |
| 45 | + should 'have parent_id present in form' do | |
| 46 | + get :new, :parent_id => @track.id, :profile => @profile.identifier, :type => CommunityTrackPlugin::Step | |
| 47 | + assert_tag :tag => 'input', :attributes => { :name => 'parent_id' } | |
| 48 | + end | |
| 49 | + | |
| 50 | + should 'be able to create an step with a parent' do | |
| 51 | + amount_of_steps = CommunityTrackPlugin::Step.count | |
| 52 | + post :new, :parent_id => @track.id, :profile => @profile.identifier, :type => CommunityTrackPlugin::Step, :article => {:name => 'some', :body => 'some'} | |
| 53 | + assert_equal amount_of_steps + 1, CommunityTrackPlugin::Step.count | |
| 54 | + end | |
| 55 | + | |
| 42 | 56 | end | ... | ... |
plugins/community_track/views/cms/community_track_plugin/_step.html.erb
| ... | ... | @@ -14,6 +14,8 @@ |
| 14 | 14 | |
| 15 | 15 | <%= labelled_form_field(_('Tool type'), select(:article, :tool_type, @article.enabled_tools.map {|t| [t.short_description, t.name]} )) %> |
| 16 | 16 | <%= hidden_field_tag('success_back_to', url_for(@article.parent.view_url)) %> |
| 17 | + <%= hidden_field_tag('parent_id', @article.parent_id) %> | |
| 18 | + | |
| 17 | 19 | </div> |
| 18 | 20 | |
| 19 | 21 | <%= labelled_form_field check_box(:article, :hidden) + _('Hidden Step'), '' %> | ... | ... |