diff --git a/config/locale/app.pot b/config/locale/app.pot index c2486c7..5712f73 100644 --- a/config/locale/app.pot +++ b/config/locale/app.pot @@ -1555,3 +1555,5 @@ msgstr "can't be blank" msgid "activerecord.errors.models.user.attributes.current_password.invalid" msgstr "invalid email and/or password" +msgid "activerecord.errors.messages.record_invalid" +msgstr "unable to save your changes" diff --git a/config/locale/de/app.po b/config/locale/de/app.po index 7b814a0..ed43d9b 100644 --- a/config/locale/de/app.po +++ b/config/locale/de/app.po @@ -1607,3 +1607,5 @@ msgstr "" msgid "activerecord.errors.models.user.attributes.current_password.invalid" msgstr "" +msgid "activerecord.errors.messages.record_invalid" +msgstr "" diff --git a/config/locale/en_GB/app.po b/config/locale/en_GB/app.po index 36eb554..17b7bfa 100644 --- a/config/locale/en_GB/app.po +++ b/config/locale/en_GB/app.po @@ -1623,3 +1623,5 @@ msgstr "can't be blank" msgid "activerecord.errors.models.user.attributes.current_password.invalid" msgstr "invalid email and/or password" +msgid "activerecord.errors.messages.record_invalid" +msgstr "unable to save your changes" diff --git a/config/locale/en_US/app.po b/config/locale/en_US/app.po index 2eba8dd..50f9e3e 100644 --- a/config/locale/en_US/app.po +++ b/config/locale/en_US/app.po @@ -1622,3 +1622,5 @@ msgstr "can't be blank" msgid "activerecord.errors.models.user.attributes.current_password.invalid" msgstr "invalid email and/or password" +msgid "activerecord.errors.messages.record_invalid" +msgstr "unable to save your changes" diff --git a/config/locale/es/app.po b/config/locale/es/app.po index 949f351..ecd8fbf 100644 --- a/config/locale/es/app.po +++ b/config/locale/es/app.po @@ -1595,3 +1595,5 @@ msgstr "" msgid "activerecord.errors.models.user.attributes.current_password.invalid" msgstr "" +msgid "activerecord.errors.messages.record_invalid" +msgstr "" diff --git a/config/locale/fr/app.po b/config/locale/fr/app.po index a91cd0b..516ab44 100644 --- a/config/locale/fr/app.po +++ b/config/locale/fr/app.po @@ -1588,4 +1588,6 @@ msgid "activerecord.errors.models.user.attributes.password.blank" msgstr "" msgid "activerecord.errors.models.user.attributes.current_password.invalid" +msgstr "" +msgid "activerecord.errors.messages.record_invalid" msgstr "" \ No newline at end of file diff --git a/test/test_helper.rb b/test/test_helper.rb index 3eb728a..def6783 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -49,20 +49,17 @@ # each of the possible Question Formats. # ---------------------------------------------------------------------- def scaffold_template - template_family = loop do - random = rand 2147483647 - break random unless Template.exists?(dmptemplate_id: random) - end + template = Template.new(title: 'Test template', + description: 'My test template', + org: Org.first) - template = Template.new(title: 'Test template', description: 'My test template', - published: true, org: Org.first, locale: nil, is_default: false, - version: 0, visibility: 0, dmptemplate_id: template_family) + template.phases << Phase.new(title: 'Test phase', + description: 'My test phase', + number: 1) - template.phases << Phase.new(title: 'Test phase', description: 'My test phase', - number: 1, modifiable: false) - - section = Section.new(title: 'Test section', description: 'My test section', - number: 99, published: true, modifiable: false) + section = Section.new(title: 'Test section', + description: 'My test section', + number: 99, phase: template.phases.first) i = 1 # Add each type of Question to the new section @@ -81,9 +78,9 @@ end template.phases.first.sections << section - - assert template.valid?, "unable to create new Template: #{template.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}" + template.save! + assert template.valid?, "unable to create new Template: #{template.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}" @template = template.reload end