fe 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +20 -0
  4. data/Rakefile +48 -0
  5. data/app/assets/images/fe/ajax-loader.gif +0 -0
  6. data/app/assets/images/fe/butgrad.png +0 -0
  7. data/app/assets/images/fe/icons/add.png +0 -0
  8. data/app/assets/images/fe/icons/application_form.png +0 -0
  9. data/app/assets/images/fe/icons/application_form_add.png +0 -0
  10. data/app/assets/images/fe/icons/arrow-move.png +0 -0
  11. data/app/assets/images/fe/icons/arrow_out.png +0 -0
  12. data/app/assets/images/fe/icons/asterisk_yellow.png +0 -0
  13. data/app/assets/images/fe/icons/book-open-list.png +0 -0
  14. data/app/assets/images/fe/icons/book_open.png +0 -0
  15. data/app/assets/images/fe/icons/briefcase.png +0 -0
  16. data/app/assets/images/fe/icons/calendar_view_day.png +0 -0
  17. data/app/assets/images/fe/icons/checkbox.png +0 -0
  18. data/app/assets/images/fe/icons/copy_paste.gif +0 -0
  19. data/app/assets/images/fe/icons/disk.png +0 -0
  20. data/app/assets/images/fe/icons/document--pencil.png +0 -0
  21. data/app/assets/images/fe/icons/document-copy.png +0 -0
  22. data/app/assets/images/fe/icons/map_magnify.png +0 -0
  23. data/app/assets/images/fe/icons/minus-button.png +0 -0
  24. data/app/assets/images/fe/icons/move.png +0 -0
  25. data/app/assets/images/fe/icons/page_error.png +0 -0
  26. data/app/assets/images/fe/icons/page_valid.png +0 -0
  27. data/app/assets/images/fe/icons/page_white.png +0 -0
  28. data/app/assets/images/fe/icons/page_white_add.png +0 -0
  29. data/app/assets/images/fe/icons/page_white_error.png +0 -0
  30. data/app/assets/images/fe/icons/paper-clip.png +0 -0
  31. data/app/assets/images/fe/icons/pencil-small.png +0 -0
  32. data/app/assets/images/fe/icons/pencil.png +0 -0
  33. data/app/assets/images/fe/icons/question-balloon.png +0 -0
  34. data/app/assets/images/fe/icons/radio.png +0 -0
  35. data/app/assets/images/fe/icons/star-small.png +0 -0
  36. data/app/assets/images/fe/icons/table.png +0 -0
  37. data/app/assets/images/fe/icons/text_align_left.png +0 -0
  38. data/app/assets/images/fe/icons/text_horizontalrule.png +0 -0
  39. data/app/assets/images/fe/icons/textfield.png +0 -0
  40. data/app/assets/images/fe/indent.png +0 -0
  41. data/app/assets/images/fe/overlay.png +0 -0
  42. data/app/assets/images/fe/selected_bg.jpg +0 -0
  43. data/app/assets/images/fe/status.gif +0 -0
  44. data/app/assets/images/fe/tooltip/black.png +0 -0
  45. data/app/assets/images/fe/tooltip/black_arrow.png +0 -0
  46. data/app/assets/images/fe/tooltip/black_arrow_big.png +0 -0
  47. data/app/assets/images/fe/tooltip/black_big.png +0 -0
  48. data/app/assets/images/fe/tooltip/white.png +0 -0
  49. data/app/assets/images/fe/tooltip/white_arrow.png +0 -0
  50. data/app/assets/images/fe/tooltip/white_arrow_big.png +0 -0
  51. data/app/assets/images/fe/tooltip/white_big.png +0 -0
  52. data/app/assets/images/fe/uploadify/cancel.png +0 -0
  53. data/app/assets/images/fe/uploadify/uploadify.swf +0 -0
  54. data/app/assets/javascripts/fe/admin.js +7 -0
  55. data/app/assets/javascripts/fe/jquery.metadata.js +122 -0
  56. data/app/assets/javascripts/fe/jquery.scrollTo-min.js +7 -0
  57. data/app/assets/javascripts/fe/jquery.uploadify.v2.1.0.js +258 -0
  58. data/app/assets/javascripts/fe/jquery.validate.pack.js +15 -0
  59. data/app/assets/javascripts/fe/qe.admin.js +115 -0
  60. data/app/assets/javascripts/fe/qe.common.js +57 -0
  61. data/app/assets/javascripts/fe/qe.public.js +331 -0
  62. data/app/assets/javascripts/fe/swfobject.js +4 -0
  63. data/app/assets/stylesheets/fe/qe.screen.css.scss.erb +552 -0
  64. data/app/assets/stylesheets/fe/reset.css +55 -0
  65. data/app/assets/stylesheets/fe/validation.css +91 -0
  66. data/app/controllers/fe/admin/elements_controller.rb +185 -0
  67. data/app/controllers/fe/admin/email_templates_controller.rb +61 -0
  68. data/app/controllers/fe/admin/question_pages_controller.rb +113 -0
  69. data/app/controllers/fe/admin/question_sheets_controller.rb +106 -0
  70. data/app/controllers/fe/answer_pages_controller.rb +3 -0
  71. data/app/controllers/fe/answer_sheets_controller.rb +3 -0
  72. data/app/controllers/fe/concerns/answer_pages_controller_concern.rb +80 -0
  73. data/app/controllers/fe/concerns/answer_sheets_controller_concern.rb +84 -0
  74. data/app/controllers/fe/reference_sheets_controller.rb +29 -0
  75. data/app/helpers/fe/answer_pages_helper.rb +19 -0
  76. data/app/helpers/fe/application_helper.rb +49 -0
  77. data/app/mailers/fe/notifier.rb +22 -0
  78. data/app/models/fe/answer.rb +13 -0
  79. data/app/models/fe/answer_pages_presenter.rb +13 -0
  80. data/app/models/fe/answer_sheet.rb +10 -0
  81. data/app/models/fe/answer_sheet_question_sheet.rb +7 -0
  82. data/app/models/fe/attachment_field.rb +7 -0
  83. data/app/models/fe/choice_field.rb +7 -0
  84. data/app/models/fe/concerns/answer_concern.rb +36 -0
  85. data/app/models/fe/concerns/answer_pages_presenter_concern.rb +99 -0
  86. data/app/models/fe/concerns/answer_sheet_concern.rb +61 -0
  87. data/app/models/fe/concerns/choice_field_concern.rb +131 -0
  88. data/app/models/fe/condition.rb +53 -0
  89. data/app/models/fe/date_field.rb +52 -0
  90. data/app/models/fe/element.rb +164 -0
  91. data/app/models/fe/email_template.rb +7 -0
  92. data/app/models/fe/option.rb +10 -0
  93. data/app/models/fe/option_group.rb +10 -0
  94. data/app/models/fe/page.rb +101 -0
  95. data/app/models/fe/page_element.rb +9 -0
  96. data/app/models/fe/page_link.rb +15 -0
  97. data/app/models/fe/paragraph.rb +10 -0
  98. data/app/models/fe/payment.rb +52 -0
  99. data/app/models/fe/payment_question.rb +22 -0
  100. data/app/models/fe/presenter.rb +23 -0
  101. data/app/models/fe/question.rb +256 -0
  102. data/app/models/fe/question_grid.rb +26 -0
  103. data/app/models/fe/question_grid_with_total.rb +11 -0
  104. data/app/models/fe/question_set.rb +82 -0
  105. data/app/models/fe/question_sheet.rb +73 -0
  106. data/app/models/fe/reference_question.rb +42 -0
  107. data/app/models/fe/reference_sheet.rb +149 -0
  108. data/app/models/fe/section.rb +12 -0
  109. data/app/models/fe/state_chooser.rb +10 -0
  110. data/app/models/fe/text_field.rb +29 -0
  111. data/app/views/fe/admin/elements/_errors.html.erb +1 -0
  112. data/app/views/fe/admin/elements/create.js.erb +11 -0
  113. data/app/views/fe/admin/elements/destroy.js.erb +4 -0
  114. data/app/views/fe/admin/elements/drop.js.erb +2 -0
  115. data/app/views/fe/admin/elements/duplicate.js.erb +2 -0
  116. data/app/views/fe/admin/elements/edit.js.erb +4 -0
  117. data/app/views/fe/admin/elements/error.js.erb +4 -0
  118. data/app/views/fe/admin/elements/new.js.erb +10 -0
  119. data/app/views/fe/admin/elements/reorder.js.erb +0 -0
  120. data/app/views/fe/admin/elements/update.js.erb +9 -0
  121. data/app/views/fe/admin/email_templates/_form.html.erb +8 -0
  122. data/app/views/fe/admin/email_templates/edit.html.erb +13 -0
  123. data/app/views/fe/admin/email_templates/index.html.erb +20 -0
  124. data/app/views/fe/admin/email_templates/new.html.erb +11 -0
  125. data/app/views/fe/admin/panels/_advanced_options.html.erb +16 -0
  126. data/app/views/fe/admin/panels/_common_fields.html.erb +24 -0
  127. data/app/views/fe/admin/panels/_condition.html.erb +6 -0
  128. data/app/views/fe/admin/panels/_insert.html.erb +39 -0
  129. data/app/views/fe/admin/panels/_nav_controls.html.erb +6 -0
  130. data/app/views/fe/admin/panels/_page.html.erb +3 -0
  131. data/app/views/fe/admin/panels/_pages_list.html.erb +16 -0
  132. data/app/views/fe/admin/panels/_prop_attachment_field.html.erb +2 -0
  133. data/app/views/fe/admin/panels/_prop_choice_field.html.erb +46 -0
  134. data/app/views/fe/admin/panels/_prop_date_field.html.erb +7 -0
  135. data/app/views/fe/admin/panels/_prop_element.html.erb +30 -0
  136. data/app/views/fe/admin/panels/_prop_page.html.erb +21 -0
  137. data/app/views/fe/admin/panels/_prop_paragraph.html.erb +32 -0
  138. data/app/views/fe/admin/panels/_prop_question_grid.html.erb +23 -0
  139. data/app/views/fe/admin/panels/_prop_question_grid_with_total.html.erb +14 -0
  140. data/app/views/fe/admin/panels/_prop_reference_question.html.erb +12 -0
  141. data/app/views/fe/admin/panels/_prop_section.html.erb +2 -0
  142. data/app/views/fe/admin/panels/_prop_sheet.html.erb +17 -0
  143. data/app/views/fe/admin/panels/_prop_text_field.html.erb +20 -0
  144. data/app/views/fe/admin/question_pages/_element.html.erb +18 -0
  145. data/app/views/fe/admin/question_pages/_element_show.html.erb +10 -0
  146. data/app/views/fe/admin/question_pages/_errors.html.erb +1 -0
  147. data/app/views/fe/admin/question_pages/_question_page.html.erb +13 -0
  148. data/app/views/fe/admin/question_pages/create.js.erb +11 -0
  149. data/app/views/fe/admin/question_pages/destroy.js.erb +5 -0
  150. data/app/views/fe/admin/question_pages/edit.js.erb +3 -0
  151. data/app/views/fe/admin/question_pages/error.js.erb +4 -0
  152. data/app/views/fe/admin/question_pages/show.js.erb +8 -0
  153. data/app/views/fe/admin/question_pages/show_panel.js.erb +3 -0
  154. data/app/views/fe/admin/question_pages/update.js.erb +2 -0
  155. data/app/views/fe/admin/question_sheets/_errors.html.erb +1 -0
  156. data/app/views/fe/admin/question_sheets/edit.js.erb +3 -0
  157. data/app/views/fe/admin/question_sheets/error.js.erb +5 -0
  158. data/app/views/fe/admin/question_sheets/index.html.erb +41 -0
  159. data/app/views/fe/admin/question_sheets/new.html.erb +15 -0
  160. data/app/views/fe/admin/question_sheets/show.html.erb +27 -0
  161. data/app/views/fe/admin/question_sheets/update.js.erb +2 -0
  162. data/app/views/fe/answer_pages/_answer_page.html.erb +56 -0
  163. data/app/views/fe/answer_pages/_element.html.erb +9 -0
  164. data/app/views/fe/answer_pages/update.js.erb +5 -0
  165. data/app/views/fe/answer_sheets/_answer_sheet.html.erb +24 -0
  166. data/app/views/fe/answer_sheets/_element.html.erb +54 -0
  167. data/app/views/fe/answer_sheets/_incomplete.html.erb +10 -0
  168. data/app/views/fe/answer_sheets/_page_link.html.erb +7 -0
  169. data/app/views/fe/answer_sheets/_pages_list.html.erb +11 -0
  170. data/app/views/fe/answer_sheets/_title.html.erb +1 -0
  171. data/app/views/fe/answer_sheets/edit.html.erb +60 -0
  172. data/app/views/fe/answer_sheets/incomplete.js.erb +5 -0
  173. data/app/views/fe/answer_sheets/index.html.erb +18 -0
  174. data/app/views/fe/answer_sheets/send_reference_invite.js.erb +8 -0
  175. data/app/views/fe/answer_sheets/show.html.erb +13 -0
  176. data/app/views/fe/help/builder.html +33 -0
  177. data/app/views/fe/help/question_grid.html +18 -0
  178. data/app/views/fe/questions/_acceptance.html.erb +13 -0
  179. data/app/views/fe/questions/_attachment_field.html.erb +42 -0
  180. data/app/views/fe/questions/_checkbox_field.html.erb +49 -0
  181. data/app/views/fe/questions/_country.html.erb +7 -0
  182. data/app/views/fe/questions/_date_field.html.erb +7 -0
  183. data/app/views/fe/questions/_date_field_mmyy.html.erb +9 -0
  184. data/app/views/fe/questions/_drop_down_field.html.erb +7 -0
  185. data/app/views/fe/questions/_paragraph.html.erb +1 -0
  186. data/app/views/fe/questions/_question_grid.html.erb +65 -0
  187. data/app/views/fe/questions/_question_grid_with_total.html.erb +57 -0
  188. data/app/views/fe/questions/_questions.html.erb +9 -0
  189. data/app/views/fe/questions/_radio_button_field.html.erb +41 -0
  190. data/app/views/fe/questions/_rating.html.erb +25 -0
  191. data/app/views/fe/questions/_reference_discipler.html.erb +1 -0
  192. data/app/views/fe/questions/_reference_friend.html.erb +1 -0
  193. data/app/views/fe/questions/_reference_parent.html.erb +1 -0
  194. data/app/views/fe/questions/_reference_peer.html.erb +1 -0
  195. data/app/views/fe/questions/_reference_question.html.erb +38 -0
  196. data/app/views/fe/questions/_reference_roommate.html.erb +1 -0
  197. data/app/views/fe/questions/_reference_spiritual.html.erb +1 -0
  198. data/app/views/fe/questions/_reference_staff.html.erb +1 -0
  199. data/app/views/fe/questions/_section.html.erb +1 -0
  200. data/app/views/fe/questions/_state_chooser.html.erb +7 -0
  201. data/app/views/fe/questions/_text_area_field.html.erb +6 -0
  202. data/app/views/fe/questions/_text_field.html.erb +8 -0
  203. data/app/views/fe/questions/_yes_no.html.erb +17 -0
  204. data/app/views/fe/questions/_yes_no_field.erb +17 -0
  205. data/app/views/fe/reference_sheets/not_found.html.erb +5 -0
  206. data/app/views/layouts/fe/application.html.erb +31 -0
  207. data/app/views/layouts/fe/qe.admin.html.erb +30 -0
  208. data/config/routes.rb +49 -0
  209. data/db/migrate/20131003041856_core.rb +91 -0
  210. data/db/migrate/20131003044250_create_reference_sheets.rb +23 -0
  211. data/db/migrate/20131003044436_add_element_and_answer_fields.rb +10 -0
  212. data/db/migrate/20131003044518_create_email_templates.rb +17 -0
  213. data/db/migrate/20131003044621_add_max_lengths.rb +8 -0
  214. data/db/migrate/20131003044714_create_join_table.rb +11 -0
  215. data/db/migrate/20131016162128_remove_question_id_from_element.rb +9 -0
  216. data/lib/fe.rb +22 -0
  217. data/lib/fe/engine.rb +19 -0
  218. data/lib/fe/version.rb +3 -0
  219. data/lib/generators/fe/install_generator.rb +132 -0
  220. data/lib/tasks/qe_tasks.rake +4 -0
  221. data/spec/controllers/fe/admin/elements_controller_spec.rb +4 -0
  222. data/spec/controllers/fe/admin/email_templates_controller_spec.rb +4 -0
  223. data/spec/controllers/fe/admin/question_pages_controller_spec.rb +4 -0
  224. data/spec/controllers/fe/admin/question_sheets_controller_spec.rb +4 -0
  225. data/spec/controllers/fe/answer_pages_controller_spec.rb +4 -0
  226. data/spec/controllers/fe/answer_sheets_controller_spec.rb +4 -0
  227. data/spec/controllers/fe/reference_sheets_controller_spec.rb +4 -0
  228. data/spec/factories/answer_sheets.rb +5 -0
  229. data/spec/factories/answers.rb +4 -0
  230. data/spec/factories/paragraphs.rb +4 -0
  231. data/spec/factories/question_sheet.rb +5 -0
  232. data/spec/factories/reference_questions.rb +4 -0
  233. data/spec/models/fe/answer_sheet_question_sheet_spec.rb +6 -0
  234. data/spec/models/fe/answer_sheet_spec.rb +8 -0
  235. data/spec/models/fe/answer_spec.rb +13 -0
  236. data/spec/models/fe/attachment_field_spec.rb +4 -0
  237. data/spec/models/fe/choice_field_spec.rb +5 -0
  238. data/spec/models/fe/condition_spec.rb +8 -0
  239. data/spec/models/fe/date_field_spec.rb +49 -0
  240. data/spec/models/fe/element_spec.rb +12 -0
  241. data/spec/models/fe/email_template_spec.rb +5 -0
  242. data/spec/models/fe/option_group_spec.rb +4 -0
  243. data/spec/models/fe/option_spec.rb +4 -0
  244. data/spec/models/fe/page_element_spec.rb +6 -0
  245. data/spec/models/fe/page_link_spec.rb +4 -0
  246. data/spec/models/fe/page_spec.rb +14 -0
  247. data/spec/models/fe/paragraph_spec.rb +17 -0
  248. data/spec/models/fe/question_grid_spec.rb +4 -0
  249. data/spec/models/fe/question_grid_with_total_spec.rb +4 -0
  250. data/spec/models/fe/question_set_spec.rb +4 -0
  251. data/spec/models/fe/question_sheet_spec.rb +8 -0
  252. data/spec/models/fe/question_spec.rb +20 -0
  253. data/spec/models/fe/reference_question_spec.rb +17 -0
  254. data/spec/models/fe/reference_sheet_spec.rb +11 -0
  255. data/spec/models/fe/section_spec.rb +4 -0
  256. data/spec/models/fe/state_chooser_spec.rb +4 -0
  257. data/spec/models/fe/text_field_spec.rb +17 -0
  258. data/spec/spec_helper.rb +66 -0
  259. data/spec/support/database.txt +28 -0
  260. metadata +508 -0
@@ -0,0 +1,19 @@
1
+ module Fe
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Fe
4
+
5
+ config.to_prepare do
6
+ Dir.glob(File.join(File.dirname(__FILE__), "..", "..", "app", "**", "*_concern.rb")).each do |c|
7
+ require_dependency(c)
8
+ end
9
+ end
10
+
11
+ config.generators do |g|
12
+ g.test_framework :rspec, :fixture => false
13
+ g.fixture_replacement :factory_girl, :dir => 'spec/factories'
14
+ g.assets false
15
+ g.helper false
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module Fe
2
+ VERSION = "0.0.3"
3
+ end
@@ -0,0 +1,132 @@
1
+ module Fe
2
+ class InstallGenerator < Rails::Generators::Base
3
+
4
+ class_option :migrate, :type => :boolean, :default => true, :banner => 'Run Form migrations'
5
+ class_option :lib_name, :type => :string, :default => 'fe'
6
+ class_option :quite, :type => :boolean, :default => false
7
+
8
+ # def self.source_paths
9
+ # paths << File.expand_path('../templates', "../../#{__FILE__}")
10
+ # paths << File.expand_path('../templates', "../#{__FILE__}")
11
+ # paths << File.expand_path('../templates', __FILE__)
12
+ # paths.flatten
13
+ # end
14
+
15
+ def prepare_options
16
+ @run_migrations = options[:migrate]
17
+ @lib_name = options[:lib_name]
18
+ end
19
+
20
+ # def config_questionnaire_yml
21
+ # end
22
+
23
+ # def additional_tweaks
24
+ # end
25
+
26
+ def install_migrations
27
+ say_status :copying, "migrations"
28
+ silence_stream(STDOUT) do
29
+ silence_warnings { rake 'fe_engine:install:migrations' }
30
+ end
31
+ end
32
+
33
+ def create_database
34
+ say_status :creating, "database"
35
+ silence_stream(STDOUT) do
36
+ silence_stream(STDERR) do
37
+ silence_warnings { rake 'db:create' }
38
+ end
39
+ end
40
+ end
41
+
42
+ def run_migrations
43
+ if @run_migrations
44
+ say_status :running, "migrations"
45
+ quietly { rake 'db:migrate' }
46
+ else
47
+ say_status :skipping, "migrations (don't forget to run rake db:migrate)"
48
+ end
49
+ end
50
+
51
+ def notify_about_routes
52
+ insert_into_file File.join('config', 'routes.rb'),
53
+ :after => "pplication.routes.draw do\n" do
54
+ %Q{
55
+ # == Questionnaire
56
+ # This line mounts QuestionnaireEngine's routes at the root of your application.
57
+ # This means, any requests to URLs such as http://localhost:3000/admin/forms,
58
+ # will go to Fe::Admin::FormsController.
59
+ #
60
+ # If you would like to change where this engine is mounted, simply change the
61
+ # `:at` option to something different.
62
+
63
+ mount Fe::Engine, :at => '/'
64
+ \n
65
+ } end
66
+ unless options[:quiet]
67
+ puts "*" * 75
68
+ puts "We added the following line to your application's config/routes.rb file:"
69
+ puts " "
70
+ puts " mount Fe::Engine, :at => '/'"
71
+ puts " "
72
+ end
73
+ end
74
+
75
+ def noify_about_javascripts
76
+ insert_into_file File.join('app', 'assets', 'javascripts', 'application.js'),
77
+ :before => "//= require_tree ." do
78
+ %Q{//= require fe/application \n}
79
+ end
80
+ unless options[:quiet]
81
+ puts "*" * 75
82
+ puts "Added this to app's application.js file,"
83
+ puts " "
84
+ puts " //= require fe/application"
85
+ puts " "
86
+ end
87
+ end
88
+
89
+ def notify_about_stylesheets
90
+ insert_into_file File.join('app', 'assets', 'stylesheets', 'application.css'),
91
+ :before => "*= require_tree ." do
92
+ %Q{*= require fe/application \n }
93
+ end
94
+ unless options[:quiet]
95
+ puts "*" * 75
96
+ puts "Added this to app's stylesheets file,"
97
+ puts " "
98
+ puts " *= require fe/application"
99
+ puts " "
100
+ end
101
+ end
102
+
103
+ def notify_about_stylesheets
104
+ insert_into_file File.join('app', 'assets', 'stylesheets', 'application.css'),
105
+ :before => "*= require_tree ." do
106
+ %Q{*= require fe/application \n }
107
+ end
108
+ unless options[:quiet]
109
+ puts "*" * 75
110
+ puts "Added this to app's stylesheets file,"
111
+ puts " "
112
+ puts " *= require fe/application"
113
+ puts " "
114
+ end
115
+ end
116
+
117
+ # TODO figure out image refernces
118
+ # def notify_about_images
119
+ # insert_into_file File.join('app', 'assets', 'images', 'application.css')
120
+ # end
121
+
122
+ def complete
123
+ unless options[:quiet]
124
+ puts "*" * 75
125
+ puts " "
126
+ puts ">> Fe successfully installed. You're all ready to go!"
127
+ puts ">> Enjoy!"
128
+ end
129
+ end
130
+
131
+ end
132
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :fe do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::Admin::ElementsController do
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::Admin::EmailTemplatesController do
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::Admin::QuestionPagesController do
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::Admin::QuestionSheetsController do
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::AnswerPagesController do
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::AnswerSheetsController do
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::ReferenceSheetsController do
4
+ end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :answer_sheet, class: Fe::AnswerSheet do
3
+ created_at Time.now
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ FactoryGirl.define do
2
+ factory :answer, class: Fe::Answer do
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ FactoryGirl.define do
2
+ factory :paragraph, class: Fe::Paragraph do
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :question_sheet, class: Fe::QuestionSheet do
3
+ sequence(:label) { |n| "Question Sheet #{n}"}
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ FactoryGirl.define do
2
+ factory :reference_question, class: Fe::ReferenceQuestion do
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::AnswerSheetQuestionSheet do
4
+ it { should belong_to :answer_sheet }
5
+ it { should belong_to :question_sheet }
6
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::AnswerSheet do
4
+ it { should have_many :answer_sheet_question_sheets }
5
+ it { should have_many :question_sheets }
6
+ it { should have_many :answers }
7
+ it { should have_many :reference_sheets }
8
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::Answer do
4
+ it { should belong_to :answer_sheet }
5
+ it { should belong_to :question }
6
+ it { should ensure_length_of :short_value }
7
+
8
+ it '#to_s' do
9
+ answer = Fe::Answer.new
10
+ answer.value = "abc"
11
+ answer.to_s.should == "abc"
12
+ end
13
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::AttachmentField do
4
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::ChoiceField do
4
+ it { should have_many :elements }
5
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::Condition do
4
+ it { should belong_to :question_sheet }
5
+ it { should belong_to :trigger }
6
+ it { should validate_presence_of :expression }
7
+ it { should ensure_length_of :expression }
8
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::DateField do
4
+ describe '#ptemplate' do
5
+ it 'mmyy style' do
6
+ date_field = Fe::DateField.new
7
+ date_field.style = "mmyy"
8
+ date_field.ptemplate.should == "date_field_mmyy"
9
+ end
10
+
11
+ it 'default' do
12
+ date_field = Fe::DateField.new
13
+ date_field.ptemplate.should == "date_field"
14
+ end
15
+ end
16
+
17
+ describe '#validation_class' do
18
+ it 'mmyy style' do
19
+ date_field = Fe::DateField.new
20
+ date_field.style = "mmyy"
21
+ date_field.validation_class.should == "validate-selection "
22
+ end
23
+
24
+ it 'default' do
25
+ date_field = Fe::DateField.new
26
+ date_field.validation_class.should == "validate-date "
27
+ end
28
+ end
29
+
30
+ describe '#response' do
31
+ let(:answer_sheet) { create(:answer_sheet) }
32
+ let(:date_field) { Fe::DateField.create }
33
+
34
+ it 'converts db string format to Time' do
35
+ answer = create(:answer, answer_sheet: answer_sheet, question: date_field, value: Time.zone.now)
36
+ date_field.response(answer_sheet).should == Time.parse(answer.reload.value)
37
+ end
38
+
39
+ it 'converts US date format format to Time' do
40
+ create(:answer, answer_sheet: answer_sheet, question: date_field, value: '1/12/2013')
41
+ date_field.response(answer_sheet).should == Time.parse('2013-01-12')
42
+ end
43
+
44
+ it 'returns empty string if an invalid date is passed in' do
45
+ create(:answer, answer_sheet: answer_sheet, question: date_field, value: '13/12/2013')
46
+ date_field.response(answer_sheet).should == ''
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::Element do
4
+ it { should belong_to :question_grid }
5
+ it { should belong_to :choice_field }
6
+ it { should have_many :page_elements }
7
+ it { should have_many :pages }
8
+ it { should validate_presence_of :kind }
9
+ # it { should validate_presence_of :style } # this isn't working
10
+ it { should ensure_length_of :kind }
11
+ it { should ensure_length_of :style }
12
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::EmailTemplate do
4
+ it { should validate_presence_of :name }
5
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::OptionGroup do
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::Option do
4
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::PageElement do
4
+ it { should belong_to :page }
5
+ it { should belong_to :element }
6
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::PageLink do
4
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::Page do
4
+ it { should belong_to :question_sheet }
5
+ it { should have_many :page_elements }
6
+ it { should have_many :elements }
7
+ it { should have_many :questions }
8
+ it { should have_many :question_grids }
9
+ it { should have_many :question_grid_with_totals }
10
+ # it { should validate_presence_of :label } # this isn't working
11
+ # it { should validate_presence_of :number } # this isn't working
12
+ it { should ensure_length_of :label }
13
+ it { should validate_numericality_of :number }
14
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::Paragraph do
4
+ describe '#validate_presence_of :content on update' do
5
+ it 'successfully saves with content' do
6
+ paragraph = build(:paragraph)
7
+ paragraph.content = "abc"
8
+ paragraph.save.should be_true
9
+ end
10
+
11
+ it 'saves with default content' do
12
+ paragraph = build(:paragraph)
13
+ paragraph.save.should be_true
14
+ paragraph.content.should == "Lorem ipsum..."
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::QuestionGrid do
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::QuestionGridWithTotal do
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::QuestionSet do
4
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fe::QuestionSheet do
4
+ it { should have_many :pages }
5
+ it { should have_many :answer_sheets }
6
+ it { should validate_presence_of :label }
7
+ it { should validate_uniqueness_of :label }
8
+ end