Commit 9c61af94905734baaee41bc7d497391eb0aa8bec

Authored by Antonio Terceiro
2 parents 906f3005 89d144e1

Merge branch 'custom-forms-tests' into 'master'

Fixing custom_forms broken tests

Now the tests for custom_form plugin pass on noosfero using rails3.

See merge request !370
plugins/custom_forms/test/functional/custom_forms_plugin_myprofile_controller_test.rb
... ... @@ -226,7 +226,7 @@ class CustomFormsPluginMyprofileControllerTest < ActionController::TestCase
226 226 end
227 227  
228 228 should 'list pending submissions for a form' do
229   - person = fast_create(Person)
  229 + person = create_user('john').person
230 230 form = CustomFormsPlugin::Form.create!(:profile => profile, :name => 'Free Software', :for_admission => true)
231 231 task = CustomFormsPlugin::AdmissionSurvey.create!(:form_id => form.id, :target => person, :requestor => profile)
232 232  
... ...
plugins/custom_forms/test/unit/custom_forms_plugin/admission_survey_test.rb
... ... @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../../../test/test_helper'
3 3 class CustomFormsPlugin::AdmissionSurveyTest < ActiveSupport::TestCase
4 4 should 'add member to community on perform' do
5 5 profile = fast_create(Community)
6   - person = fast_create(Person)
  6 + person = create_user('john').person
7 7 form = CustomFormsPlugin::Form.create!(:name => 'Simple Form', :profile => profile)
8 8 task = CustomFormsPlugin::AdmissionSurvey.create!(:form_id => form.id, :target => person, :requestor => profile)
9 9  
... ...
plugins/custom_forms/test/unit/custom_forms_plugin/form_test.rb
... ... @@ -244,7 +244,7 @@ class CustomFormsPlugin::FormTest &lt; ActiveSupport::TestCase
244 244  
245 245 should 'cancel survey tasks after removing a form' do
246 246 profile = fast_create(Profile)
247   - person = fast_create(Person)
  247 + person = create_user('john').person
248 248  
249 249 form1 = CustomFormsPlugin::Form.create!(:name => 'Free Software', :profile => profile)
250 250 form2 = CustomFormsPlugin::Form.create!(:name => 'Operation System', :profile => profile)
... ...
plugins/custom_forms/test/unit/custom_forms_plugin/membership_survey_test.rb
... ... @@ -13,7 +13,7 @@ class CustomFormsPlugin::MembershipSurveyTest &lt; ActiveSupport::TestCase
13 13  
14 14 should 'create submission with answers on perform' do
15 15 profile = fast_create(Profile)
16   - person = fast_create(Person)
  16 + person = create_user('john').person
17 17 form = CustomFormsPlugin::Form.create!(:name => 'Simple Form', :profile => profile)
18 18 field = CustomFormsPlugin::Field.create!(:name => 'Name', :form => form)
19 19 task = CustomFormsPlugin::MembershipSurvey.create!(:form_id => form.id, :submission => {field.id.to_s => 'Jack'}, :target => person, :requestor => profile)
... ... @@ -31,7 +31,7 @@ class CustomFormsPlugin::MembershipSurveyTest &lt; ActiveSupport::TestCase
31 31  
32 32 should 'have a scope that retrieves all tasks requested by profile' do
33 33 profile = fast_create(Profile)
34   - person = fast_create(Person)
  34 + person = create_user('john').person
35 35 form = CustomFormsPlugin::Form.create!(:name => 'Simple Form', :profile => profile)
36 36 task1 = CustomFormsPlugin::MembershipSurvey.create!(:form_id => form.id, :target => person, :requestor => profile)
37 37 task2 = CustomFormsPlugin::MembershipSurvey.create!(:form_id => form.id, :target => person, :requestor => fast_create(Profile))
... ...
plugins/custom_forms/test/unit/ext/role_assingment_test.rb
... ... @@ -5,7 +5,7 @@ class RoleAssignmentsTest &lt; ActiveSupport::TestCase
5 5 environment = Environment.default
6 6 environment.enable_plugin(CustomFormsPlugin)
7 7 organization = fast_create(Organization)
8   - person = fast_create(Person)
  8 + person = create_user('john').person
9 9 f1 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 1', :on_membership => true)
10 10 f2 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 2', :on_membership => true)
11 11 f3 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 3', :on_membership => false)
... ... @@ -19,7 +19,7 @@ class RoleAssignmentsTest &lt; ActiveSupport::TestCase
19 19 environment = Environment.default
20 20 environment.enable_plugin(CustomFormsPlugin)
21 21 organization = fast_create(Organization)
22   - person = fast_create(Person)
  22 + person = create_user('john').person
23 23 form = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form', :on_membership => true, :access => 'associated')
24 24  
25 25 assert_difference 'CustomFormsPlugin::MembershipSurvey.count', 1 do
... ... @@ -31,7 +31,7 @@ class RoleAssignmentsTest &lt; ActiveSupport::TestCase
31 31 environment = Environment.default
32 32 environment.enable_plugin(CustomFormsPlugin)
33 33 organization = fast_create(Organization)
34   - person = fast_create(Person)
  34 + person = create_user('john').person
35 35 form1 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 1', :on_membership => true)
36 36 organization.add_member(person)
37 37  
... ... @@ -59,7 +59,7 @@ class RoleAssignmentsTest &lt; ActiveSupport::TestCase
59 59 environment = Environment.default
60 60 environment.enable_plugin(CustomFormsPlugin)
61 61 organization = fast_create(Organization)
62   - person = fast_create(Person)
  62 + person = create_user('john').person
63 63 f1 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 1', :for_admission => true)
64 64 f2 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 2', :for_admission => true)
65 65 f3 = CustomFormsPlugin::Form.create!(:profile => organization, :name => 'Form 3', :for_admission => false)
... ...