mega-safe-tool 0.0.1
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.
- checksums.yaml +7 -0
- data/formtastic-6.0.0/Appraisals +23 -0
- data/formtastic-6.0.0/CONTRIBUTING.md +27 -0
- data/formtastic-6.0.0/Gemfile +8 -0
- data/formtastic-6.0.0/MIT-LICENSE +20 -0
- data/formtastic-6.0.0/README.md +600 -0
- data/formtastic-6.0.0/RELEASE_PROCESS +7 -0
- data/formtastic-6.0.0/Rakefile +54 -0
- data/formtastic-6.0.0/bin/appraisal +8 -0
- data/formtastic-6.0.0/formtastic.gemspec +45 -0
- data/formtastic-6.0.0/gemfiles/rails_72.gemfile +9 -0
- data/formtastic-6.0.0/gemfiles/rails_80.gemfile +9 -0
- data/formtastic-6.0.0/gemfiles/rails_81.gemfile +9 -0
- data/formtastic-6.0.0/gemfiles/rails_edge.gemfile +9 -0
- data/formtastic-6.0.0/lib/formtastic/action_class_finder.rb +19 -0
- data/formtastic-6.0.0/lib/formtastic/actions/base.rb +157 -0
- data/formtastic-6.0.0/lib/formtastic/actions/button_action.rb +68 -0
- data/formtastic-6.0.0/lib/formtastic/actions/buttonish.rb +18 -0
- data/formtastic-6.0.0/lib/formtastic/actions/input_action.rb +71 -0
- data/formtastic-6.0.0/lib/formtastic/actions/link_action.rb +89 -0
- data/formtastic-6.0.0/lib/formtastic/actions.rb +15 -0
- data/formtastic-6.0.0/lib/formtastic/deprecation.rb +6 -0
- data/formtastic-6.0.0/lib/formtastic/form_builder.rb +109 -0
- data/formtastic-6.0.0/lib/formtastic/helpers/action_helper.rb +115 -0
- data/formtastic-6.0.0/lib/formtastic/helpers/actions_helper.rb +169 -0
- data/formtastic-6.0.0/lib/formtastic/helpers/enum.rb +14 -0
- data/formtastic-6.0.0/lib/formtastic/helpers/errors_helper.rb +139 -0
- data/formtastic-6.0.0/lib/formtastic/helpers/fieldset_wrapper.rb +85 -0
- data/formtastic-6.0.0/lib/formtastic/helpers/file_column_detection.rb +17 -0
- data/formtastic-6.0.0/lib/formtastic/helpers/form_helper.rb +204 -0
- data/formtastic-6.0.0/lib/formtastic/helpers/input_helper.rb +349 -0
- data/formtastic-6.0.0/lib/formtastic/helpers/inputs_helper.rb +421 -0
- data/formtastic-6.0.0/lib/formtastic/helpers/reflection.rb +38 -0
- data/formtastic-6.0.0/lib/formtastic/helpers.rb +16 -0
- data/formtastic-6.0.0/lib/formtastic/html_attributes.rb +33 -0
- data/formtastic-6.0.0/lib/formtastic/i18n.rb +33 -0
- data/formtastic-6.0.0/lib/formtastic/input_class_finder.rb +19 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/aria.rb +26 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/associations.rb +32 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/choices.rb +109 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/collections.rb +158 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/database.rb +20 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/datetime_pickerish.rb +86 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/errors.rb +59 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/fileish.rb +24 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/hints.rb +32 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/html.rb +54 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/labelling.rb +53 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/naming.rb +43 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/numeric.rb +51 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/options.rb +18 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/placeholder.rb +18 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/stringish.rb +39 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/timeish.rb +246 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/validations.rb +250 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base/wrapping.rb +51 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/base.rb +79 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/boolean_input.rb +119 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/check_boxes_input.rb +198 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/color_input.rb +42 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/country_input.rb +90 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/datalist_input.rb +42 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/date_picker_input.rb +94 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/date_select_input.rb +35 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/datetime_picker_input.rb +104 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/datetime_select_input.rb +13 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/email_input.rb +42 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/file_input.rb +43 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/hidden_input.rb +63 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/number_input.rb +89 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/password_input.rb +42 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/phone_input.rb +43 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/radio_input.rb +164 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/range_input.rb +96 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/search_input.rb +42 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/select_input.rb +236 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/string_input.rb +37 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/text_input.rb +49 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/time_picker_input.rb +100 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/time_select_input.rb +39 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/time_zone_input.rb +59 -0
- data/formtastic-6.0.0/lib/formtastic/inputs/url_input.rb +42 -0
- data/formtastic-6.0.0/lib/formtastic/inputs.rb +43 -0
- data/formtastic-6.0.0/lib/formtastic/localized_string.rb +18 -0
- data/formtastic-6.0.0/lib/formtastic/localizer.rb +151 -0
- data/formtastic-6.0.0/lib/formtastic/namespaced_class_finder.rb +98 -0
- data/formtastic-6.0.0/lib/formtastic/version.rb +4 -0
- data/formtastic-6.0.0/lib/formtastic.rb +48 -0
- data/formtastic-6.0.0/lib/generators/formtastic/form/form_generator.rb +111 -0
- data/formtastic-6.0.0/lib/generators/formtastic/input/input_generator.rb +47 -0
- data/formtastic-6.0.0/lib/generators/formtastic/install/install_generator.rb +23 -0
- data/formtastic-6.0.0/lib/generators/formtastic/stylesheets/stylesheets_generator.rb +15 -0
- data/formtastic-6.0.0/lib/generators/templates/_form.html.erb +11 -0
- data/formtastic-6.0.0/lib/generators/templates/_form.html.haml +8 -0
- data/formtastic-6.0.0/lib/generators/templates/_form.html.slim +8 -0
- data/formtastic-6.0.0/lib/generators/templates/formtastic.css +289 -0
- data/formtastic-6.0.0/lib/generators/templates/formtastic.rb +118 -0
- data/formtastic-6.0.0/lib/generators/templates/input.rb +19 -0
- data/formtastic-6.0.0/lib/locale/en.yml +10 -0
- data/formtastic-6.0.0/sample/basic_inputs.html +224 -0
- data/formtastic-6.0.0/sample/config.ru +69 -0
- data/formtastic-6.0.0/sample/index.html +14 -0
- data/formtastic-6.0.0/script/integration-template.rb +76 -0
- data/formtastic-6.0.0/script/integration.sh +32 -0
- data/formtastic-6.0.0/spec/action_class_finder_spec.rb +12 -0
- data/formtastic-6.0.0/spec/actions/button_action_spec.rb +63 -0
- data/formtastic-6.0.0/spec/actions/generic_action_spec.rb +521 -0
- data/formtastic-6.0.0/spec/actions/input_action_spec.rb +59 -0
- data/formtastic-6.0.0/spec/actions/link_action_spec.rb +92 -0
- data/formtastic-6.0.0/spec/builder/custom_builder_spec.rb +132 -0
- data/formtastic-6.0.0/spec/builder/error_proc_spec.rb +27 -0
- data/formtastic-6.0.0/spec/builder/semantic_fields_for_spec.rb +213 -0
- data/formtastic-6.0.0/spec/fast_spec_helper.rb +12 -0
- data/formtastic-6.0.0/spec/generators/formtastic/form/form_generator_spec.rb +132 -0
- data/formtastic-6.0.0/spec/generators/formtastic/input/input_generator_spec.rb +125 -0
- data/formtastic-6.0.0/spec/generators/formtastic/install/install_generator_spec.rb +48 -0
- data/formtastic-6.0.0/spec/generators/formtastic/stylesheets/stylesheets_generator_spec.rb +22 -0
- data/formtastic-6.0.0/spec/helpers/action_helper_spec.rb +338 -0
- data/formtastic-6.0.0/spec/helpers/actions_helper_spec.rb +143 -0
- data/formtastic-6.0.0/spec/helpers/form_helper_spec.rb +224 -0
- data/formtastic-6.0.0/spec/helpers/input_helper_spec.rb +991 -0
- data/formtastic-6.0.0/spec/helpers/inputs_helper_spec.rb +669 -0
- data/formtastic-6.0.0/spec/helpers/reflection_helper_spec.rb +32 -0
- data/formtastic-6.0.0/spec/helpers/semantic_errors_helper_spec.rb +220 -0
- data/formtastic-6.0.0/spec/i18n_spec.rb +210 -0
- data/formtastic-6.0.0/spec/input_class_finder_spec.rb +10 -0
- data/formtastic-6.0.0/spec/inputs/base/collections_spec.rb +119 -0
- data/formtastic-6.0.0/spec/inputs/base/validations_spec.rb +481 -0
- data/formtastic-6.0.0/spec/inputs/boolean_input_spec.rb +254 -0
- data/formtastic-6.0.0/spec/inputs/check_boxes_input_spec.rb +547 -0
- data/formtastic-6.0.0/spec/inputs/color_input_spec.rb +85 -0
- data/formtastic-6.0.0/spec/inputs/country_input_spec.rb +133 -0
- data/formtastic-6.0.0/spec/inputs/custom_input_spec.rb +51 -0
- data/formtastic-6.0.0/spec/inputs/datalist_input_spec.rb +61 -0
- data/formtastic-6.0.0/spec/inputs/date_picker_input_spec.rb +449 -0
- data/formtastic-6.0.0/spec/inputs/date_select_input_spec.rb +249 -0
- data/formtastic-6.0.0/spec/inputs/datetime_picker_input_spec.rb +490 -0
- data/formtastic-6.0.0/spec/inputs/datetime_select_input_spec.rb +209 -0
- data/formtastic-6.0.0/spec/inputs/email_input_spec.rb +85 -0
- data/formtastic-6.0.0/spec/inputs/file_input_spec.rb +89 -0
- data/formtastic-6.0.0/spec/inputs/hidden_input_spec.rb +135 -0
- data/formtastic-6.0.0/spec/inputs/include_blank_spec.rb +78 -0
- data/formtastic-6.0.0/spec/inputs/label_spec.rb +181 -0
- data/formtastic-6.0.0/spec/inputs/number_input_spec.rb +815 -0
- data/formtastic-6.0.0/spec/inputs/password_input_spec.rb +99 -0
- data/formtastic-6.0.0/spec/inputs/phone_input_spec.rb +85 -0
- data/formtastic-6.0.0/spec/inputs/placeholder_spec.rb +71 -0
- data/formtastic-6.0.0/spec/inputs/radio_input_spec.rb +326 -0
- data/formtastic-6.0.0/spec/inputs/range_input_spec.rb +505 -0
- data/formtastic-6.0.0/spec/inputs/readonly_spec.rb +50 -0
- data/formtastic-6.0.0/spec/inputs/search_input_spec.rb +84 -0
- data/formtastic-6.0.0/spec/inputs/select_input_spec.rb +661 -0
- data/formtastic-6.0.0/spec/inputs/string_input_spec.rb +326 -0
- data/formtastic-6.0.0/spec/inputs/text_input_spec.rb +187 -0
- data/formtastic-6.0.0/spec/inputs/time_picker_input_spec.rb +455 -0
- data/formtastic-6.0.0/spec/inputs/time_select_input_spec.rb +261 -0
- data/formtastic-6.0.0/spec/inputs/time_zone_input_spec.rb +143 -0
- data/formtastic-6.0.0/spec/inputs/url_input_spec.rb +85 -0
- data/formtastic-6.0.0/spec/inputs/with_options_spec.rb +43 -0
- data/formtastic-6.0.0/spec/localizer_spec.rb +130 -0
- data/formtastic-6.0.0/spec/namespaced_class_finder_spec.rb +90 -0
- data/formtastic-6.0.0/spec/schema.rb +22 -0
- data/formtastic-6.0.0/spec/spec.opts +2 -0
- data/formtastic-6.0.0/spec/spec_helper.rb +466 -0
- data/formtastic-6.0.0/spec/support/custom_macros.rb +570 -0
- data/formtastic-6.0.0/spec/support/deprecation.rb +7 -0
- data/formtastic-6.0.0/spec/support/shared_examples.rb +13 -0
- data/formtastic-6.0.0/spec/support/specialized_class_finder_shared_example.rb +27 -0
- data/formtastic-6.0.0/spec/support/test_environment.rb +46 -0
- data/mega-safe-tool.gemspec +11 -0
- metadata +209 -0
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CustomMacros
|
|
4
|
+
|
|
5
|
+
def self.included(base)
|
|
6
|
+
base.extend(ClassMethods)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
module ClassMethods
|
|
10
|
+
|
|
11
|
+
def it_should_have_input_wrapper_with_class(class_name)
|
|
12
|
+
it "should have input wrapper with class '#{class_name}'" do
|
|
13
|
+
expect(output_buffer.to_str).to have_tag("form li.#{class_name}")
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def it_should_have_input_wrapper_with_id(id_string)
|
|
18
|
+
it "should have input wrapper with id '#{id_string}'" do
|
|
19
|
+
expect(output_buffer.to_str).to have_tag("form li##{id_string}")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def it_should_not_have_a_label
|
|
24
|
+
it "should not have a label" do
|
|
25
|
+
expect(output_buffer.to_str).not_to have_tag("form li label")
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def it_should_have_a_nested_fieldset
|
|
30
|
+
it "should have a nested_fieldset" do
|
|
31
|
+
expect(output_buffer.to_str).to have_tag("form li fieldset")
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def it_should_have_a_nested_fieldset_with_class(klass)
|
|
36
|
+
it "should have a nested_fieldset with class #{klass}" do
|
|
37
|
+
expect(output_buffer.to_str).to have_tag("form li fieldset.#{klass}")
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def it_should_have_a_nested_ordered_list_with_class(klass)
|
|
42
|
+
it "should have a nested fieldset with class #{klass}" do
|
|
43
|
+
expect(output_buffer.to_str).to have_tag("form li ol.#{klass}")
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def it_should_have_label_with_text(string_or_regex)
|
|
48
|
+
it "should have a label with text '#{string_or_regex}'" do
|
|
49
|
+
expect(output_buffer.to_str).to have_tag("form li label", :text => string_or_regex)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def it_should_have_label_for(element_id)
|
|
54
|
+
it "should have a label for ##{element_id}" do
|
|
55
|
+
expect(output_buffer.to_str).to have_tag("form li label.label[@for='#{element_id}']")
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def it_should_have_an_inline_label_for(element_id)
|
|
60
|
+
it "should have a label for ##{element_id}" do
|
|
61
|
+
expect(output_buffer.to_str).to have_tag("form li label[@for='#{element_id}']")
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def it_should_have_input_with_id(element_id)
|
|
66
|
+
it "should have an input with id '#{element_id}'" do
|
|
67
|
+
expect(output_buffer.to_str).to have_tag("form li input##{element_id}")
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def it_should_have_select_with_id(element_id)
|
|
72
|
+
it "should have a select box with id '#{element_id}'" do
|
|
73
|
+
expect(output_buffer.to_str).to have_tag("form li select##{element_id}")
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# TODO use for many of the other macros
|
|
78
|
+
def it_should_have_tag_with(type, attribute_value_hash)
|
|
79
|
+
attribute_value_hash.each do |attribute, value|
|
|
80
|
+
it "should have a #{type} box with #{attribute} '#{value}'" do
|
|
81
|
+
expect(output_buffer.to_str).to have_tag("form li #{type}[@#{attribute}=\"#{value}\"]")
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
def it_should_have_input_with(attribute_value_hash)
|
|
86
|
+
it_should_have_tag_with(:input, attribute_value_hash)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def it_should_have_many_tags(type, count)
|
|
90
|
+
it "should have #{count} #{type} tags" do
|
|
91
|
+
expect(output_buffer.to_str).to have_tag("form li #{type}", count: count)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def it_should_have_input_with_type(input_type)
|
|
96
|
+
it "should have a #{input_type} input" do
|
|
97
|
+
expect(output_buffer.to_str).to have_tag("form li input[@type=\"#{input_type}\"]")
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def it_should_have_input_with_name(name)
|
|
102
|
+
it "should have an input named #{name}" do
|
|
103
|
+
expect(output_buffer.to_str).to have_tag("form li input[@name=\"#{name}\"]")
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def it_should_have_select_with_name(name)
|
|
108
|
+
it "should have an input named #{name}" do
|
|
109
|
+
expect(output_buffer.to_str).to have_tag("form li select[@name=\"#{name}\"]")
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def it_should_have_textarea_with_name(name)
|
|
114
|
+
it "should have an input named #{name}" do
|
|
115
|
+
expect(output_buffer.to_str).to have_tag("form li textarea[@name=\"#{name}\"]")
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def it_should_have_textarea_with_id(element_id)
|
|
120
|
+
it "should have an input with id '#{element_id}'" do
|
|
121
|
+
expect(output_buffer.to_str).to have_tag("form li textarea##{element_id}")
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def it_should_have_label_and_input_with_id(element_id)
|
|
126
|
+
it "should have an input with id '#{element_id}'" do
|
|
127
|
+
expect(output_buffer.to_str).to have_tag("form li input##{element_id}")
|
|
128
|
+
expect(output_buffer.to_str).to have_tag("form li label[@for='#{element_id}']")
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def it_should_use_default_text_field_size_when_not_nil(as)
|
|
133
|
+
it 'should use default_text_field_size when not nil' do
|
|
134
|
+
with_config :default_text_field_size, 30 do
|
|
135
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
136
|
+
concat(builder.input(:title, :as => as))
|
|
137
|
+
end)
|
|
138
|
+
expect(output_buffer.to_str).to have_tag("form li input[@size='#{Formtastic::FormBuilder.default_text_field_size}']")
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def it_should_not_use_default_text_field_size_when_nil(as)
|
|
144
|
+
it 'should not use default_text_field_size when nil' do
|
|
145
|
+
with_config :default_text_field_size, nil do
|
|
146
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
147
|
+
concat(builder.input(:title, :as => as))
|
|
148
|
+
end)
|
|
149
|
+
expect(output_buffer.to_str).to have_tag("form li input")
|
|
150
|
+
expect(output_buffer.to_str).not_to have_tag("form li input[@size]")
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def it_should_apply_custom_input_attributes_when_input_html_provided(as)
|
|
156
|
+
it 'it should apply custom input attributes when input_html provided' do
|
|
157
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
158
|
+
concat(builder.input(:title, :as => as, :input_html => { :class => 'myclass' }))
|
|
159
|
+
end)
|
|
160
|
+
expect(output_buffer.to_str).to have_tag("form li input.myclass")
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def it_should_apply_custom_for_to_label_when_input_html_id_provided(as)
|
|
165
|
+
it 'it should apply custom for to label when input_html :id provided' do
|
|
166
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
167
|
+
concat(builder.input(:title, :as => as, :input_html => { :id => 'myid' }))
|
|
168
|
+
end)
|
|
169
|
+
expect(output_buffer.to_str).to have_tag('form li label[@for="myid"]')
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def it_should_have_maxlength_matching_string_column_limit
|
|
174
|
+
it 'should have a maxlength matching column limit' do
|
|
175
|
+
expect(@new_post.column_for_attribute(:title).type).to eq(:string)
|
|
176
|
+
expect(@new_post.column_for_attribute(:title).limit).to eq(50)
|
|
177
|
+
expect(output_buffer.to_str).to have_tag("form li input[@maxlength='50']")
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def it_should_have_maxlength_matching_integer_column_limit
|
|
182
|
+
it 'should have a maxlength matching column limit' do
|
|
183
|
+
expect(@new_post.column_for_attribute(:status).type).to eq(:integer)
|
|
184
|
+
expect(@new_post.column_for_attribute(:status).limit).to eq(1)
|
|
185
|
+
expect(output_buffer.to_str).to have_tag("form li input[@maxlength='3']")
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def it_should_use_column_size_for_columns_shorter_than_default_text_field_size(as)
|
|
190
|
+
it 'should use the column size for columns shorter than default_text_field_size' do
|
|
191
|
+
column_limit_shorted_than_default = 1
|
|
192
|
+
allow(@new_post).to receive(:column_for_attribute)
|
|
193
|
+
.and_return(double('column', :type => as, :limit => column_limit_shorted_than_default))
|
|
194
|
+
|
|
195
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
196
|
+
concat(builder.input(:title, :as => as))
|
|
197
|
+
end)
|
|
198
|
+
|
|
199
|
+
expect(output_buffer.to_str).to have_tag("form li input[@size='#{column_limit_shorted_than_default}']")
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def it_should_apply_error_logic_for_input_type(type)
|
|
204
|
+
describe 'when there are errors on the object for this method' do
|
|
205
|
+
before do
|
|
206
|
+
@title_errors = ['must not be blank', 'must be longer than 10 characters', 'must be awesome']
|
|
207
|
+
@errors = double('errors')
|
|
208
|
+
allow(@errors).to receive(:[]).with(errors_matcher(:title)).and_return(@title_errors)
|
|
209
|
+
Formtastic::FormBuilder.file_metadata_suffixes.each do |suffix|
|
|
210
|
+
allow(@errors).to receive(:[]).with(errors_matcher("title_#{suffix}".to_sym)).and_return(nil)
|
|
211
|
+
end
|
|
212
|
+
allow(@new_post).to receive(:errors).and_return(@errors)
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
it 'should apply an errors class to the list item' do
|
|
216
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
217
|
+
concat(builder.input(:title, :as => type))
|
|
218
|
+
end)
|
|
219
|
+
expect(output_buffer.to_str).to have_tag('form li.error')
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
it 'should not wrap the input with the Rails default error wrapping' do
|
|
223
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
224
|
+
concat(builder.input(:title, :as => type))
|
|
225
|
+
end)
|
|
226
|
+
expect(output_buffer.to_str).not_to have_tag('div.fieldWithErrors')
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
it 'should render a paragraph for the errors' do
|
|
230
|
+
Formtastic::FormBuilder.inline_errors = :sentence
|
|
231
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
232
|
+
concat(builder.input(:title, :as => type))
|
|
233
|
+
end)
|
|
234
|
+
expect(output_buffer.to_str).to have_tag('form li.error p.inline-errors')
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
it 'should not display an error list' do
|
|
238
|
+
Formtastic::FormBuilder.inline_errors = :list
|
|
239
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
240
|
+
concat(builder.input(:title, :as => type))
|
|
241
|
+
end)
|
|
242
|
+
expect(output_buffer.to_str).to have_tag('form li.error ul.errors')
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
describe 'when there are no errors on the object for this method' do
|
|
247
|
+
before do
|
|
248
|
+
@form = semantic_form_for(@new_post) do |builder|
|
|
249
|
+
concat(builder.input(:title, :as => type))
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
it 'should not apply an errors class to the list item' do
|
|
254
|
+
expect(output_buffer.to_str).not_to have_tag('form li.error')
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
it 'should not render a paragraph for the errors' do
|
|
258
|
+
expect(output_buffer.to_str).not_to have_tag('form li.error p.inline-errors')
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
it 'should not display an error list' do
|
|
262
|
+
expect(output_buffer.to_str).not_to have_tag('form li.error ul.errors')
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
describe 'when no object is provided' do
|
|
267
|
+
before do
|
|
268
|
+
concat(semantic_form_for(:project, :url => 'http://test.host') do |builder|
|
|
269
|
+
concat(builder.input(:title, :as => type))
|
|
270
|
+
end)
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
it 'should not apply an errors class to the list item' do
|
|
274
|
+
expect(output_buffer.to_str).not_to have_tag('form li.error')
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
it 'should not render a paragraph for the errors' do
|
|
278
|
+
expect(output_buffer.to_str).not_to have_tag('form li.error p.inline-errors')
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
it 'should not display an error list' do
|
|
282
|
+
expect(output_buffer.to_str).not_to have_tag('form li.error ul.errors')
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
def it_should_call_find_on_association_class_when_no_collection_is_provided(as)
|
|
288
|
+
it "should call find on the association class when no collection is provided" do
|
|
289
|
+
expect(::Author).to receive(:where)
|
|
290
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
291
|
+
concat(builder.input(:author, :as => as))
|
|
292
|
+
end)
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
def it_should_use_the_collection_when_provided(as, countable)
|
|
297
|
+
describe 'when the :collection option is provided' do
|
|
298
|
+
|
|
299
|
+
before do
|
|
300
|
+
@authors = ([::Author.all] * 2).flatten
|
|
301
|
+
@output_buffer = ActionView::OutputBuffer.new ''
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
it 'should use the provided collection' do
|
|
305
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
306
|
+
concat(builder.input(:author, :as => as, :collection => @authors))
|
|
307
|
+
end)
|
|
308
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}", :count => @authors.size + (as == :select ? 1 : 0))
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
describe 'and the :collection is an array of strings' do
|
|
312
|
+
before do
|
|
313
|
+
@categories = [ 'General', 'Design', 'Development', 'Quasi-Serious Inventions' ]
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
it "should use the string as the label text and value for each #{countable}" do
|
|
317
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
318
|
+
concat(builder.input(:category_name, :as => as, :collection => @categories))
|
|
319
|
+
end)
|
|
320
|
+
|
|
321
|
+
@categories.each do |value|
|
|
322
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /#{value}/)
|
|
323
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{value}']")
|
|
324
|
+
end
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
if as == :radio
|
|
328
|
+
it 'should generate a sanitized label for attribute' do
|
|
329
|
+
allow(@bob).to receive(:category_name).and_return(@categories)
|
|
330
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
331
|
+
fields = builder.semantic_fields_for(@bob) do |bob_builder|
|
|
332
|
+
concat(bob_builder.input(:category_name, :as => as, :collection => @categories))
|
|
333
|
+
end
|
|
334
|
+
concat(fields)
|
|
335
|
+
end)
|
|
336
|
+
expect(output_buffer.to_str).to have_tag("form li fieldset ol li label[@for='post_author_category_name_general']")
|
|
337
|
+
expect(output_buffer.to_str).to have_tag("form li fieldset ol li label[@for='post_author_category_name_design']")
|
|
338
|
+
expect(output_buffer.to_str).to have_tag("form li fieldset ol li label[@for='post_author_category_name_development']")
|
|
339
|
+
expect(output_buffer.to_str).to have_tag("form li fieldset ol li label[@for='post_author_category_name_quasi-serious_inventions']")
|
|
340
|
+
end
|
|
341
|
+
end
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
describe 'and the :collection is a hash of strings' do
|
|
345
|
+
before do
|
|
346
|
+
@categories = { 'General' => 'gen', 'Design' => 'des','Development' => 'dev' }
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
it "should use the key as the label text and the hash value as the value attribute for each #{countable}" do
|
|
350
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
351
|
+
concat(builder.input(:category_name, :as => as, :collection => @categories))
|
|
352
|
+
end)
|
|
353
|
+
|
|
354
|
+
@categories.each do |label, value|
|
|
355
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /#{label}/)
|
|
356
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{value}']")
|
|
357
|
+
end
|
|
358
|
+
end
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
describe 'and the :collection is an array of arrays' do
|
|
362
|
+
before do
|
|
363
|
+
@categories = { 'General' => 'gen', 'Design' => 'des', 'Development' => 'dev' }.to_a
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
it "should use the first value as the label text and the last value as the value attribute for #{countable}" do
|
|
367
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
368
|
+
concat(builder.input(:category_name, :as => as, :collection => @categories))
|
|
369
|
+
end)
|
|
370
|
+
|
|
371
|
+
@categories.each do |text, value|
|
|
372
|
+
label = as == :select ? :option : :label
|
|
373
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{label}", :text => /#{text}/i)
|
|
374
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{value.to_s}']")
|
|
375
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}#post_category_name_#{value.to_s}") if as == :radio
|
|
376
|
+
end
|
|
377
|
+
end
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
if as == :radio
|
|
381
|
+
describe 'and the :collection is an array of arrays with boolean values' do
|
|
382
|
+
before do
|
|
383
|
+
@choices = { 'Yeah' => true, 'Nah' => false }.to_a
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
it "should use the first value as the label text and the last value as the value attribute for #{countable}" do
|
|
387
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
388
|
+
concat(builder.input(:category_name, :as => as, :collection => @choices))
|
|
389
|
+
end)
|
|
390
|
+
|
|
391
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}#post_category_name_true")
|
|
392
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}#post_category_name_false")
|
|
393
|
+
end
|
|
394
|
+
end
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
describe 'and the :collection is an array of symbols' do
|
|
398
|
+
before do
|
|
399
|
+
@categories = [ :General, :Design, :Development ]
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
it "should use the symbol as the label text and value for each #{countable}" do
|
|
403
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
404
|
+
concat(builder.input(:category_name, :as => as, :collection => @categories))
|
|
405
|
+
end)
|
|
406
|
+
|
|
407
|
+
@categories.each do |value|
|
|
408
|
+
label = as == :select ? :option : :label
|
|
409
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{label}", :text => /#{value}/i)
|
|
410
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{value.to_s}']")
|
|
411
|
+
end
|
|
412
|
+
end
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
describe 'and the :collection is an OrderedHash of strings' do
|
|
416
|
+
before do
|
|
417
|
+
@categories = ActiveSupport::OrderedHash['General' => 'gen', 'Design' => 'des','Development' => 'dev']
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
it "should use the key as the label text and the hash value as the value attribute for each #{countable}" do
|
|
421
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
422
|
+
concat(builder.input(:category_name, :as => as, :collection => @categories))
|
|
423
|
+
end)
|
|
424
|
+
|
|
425
|
+
@categories.each do |label, value|
|
|
426
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /#{label}/)
|
|
427
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{value}']")
|
|
428
|
+
end
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
describe 'when the :member_label option is provided' do
|
|
434
|
+
|
|
435
|
+
describe 'as a symbol' do
|
|
436
|
+
before do
|
|
437
|
+
with_deprecation_silenced do
|
|
438
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
439
|
+
concat(builder.input(:author, :as => as, :member_label => :login))
|
|
440
|
+
end)
|
|
441
|
+
end
|
|
442
|
+
end
|
|
443
|
+
|
|
444
|
+
it 'should have options with text content from the specified method' do
|
|
445
|
+
::Author.all.each do |author|
|
|
446
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /#{author.login}/)
|
|
447
|
+
end
|
|
448
|
+
end
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
describe 'as a proc' do
|
|
452
|
+
before do
|
|
453
|
+
with_deprecation_silenced do
|
|
454
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
455
|
+
concat(builder.input(:author, :as => as, :member_label => Proc.new {|a| a.login.reverse }))
|
|
456
|
+
end)
|
|
457
|
+
end
|
|
458
|
+
end
|
|
459
|
+
|
|
460
|
+
it 'should have options with the proc applied to each' do
|
|
461
|
+
::Author.all.each do |author|
|
|
462
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /#{author.login.reverse}/)
|
|
463
|
+
end
|
|
464
|
+
end
|
|
465
|
+
end
|
|
466
|
+
|
|
467
|
+
describe 'as a method object' do
|
|
468
|
+
before do
|
|
469
|
+
def reverse_login(a)
|
|
470
|
+
a.login.reverse
|
|
471
|
+
end
|
|
472
|
+
with_deprecation_silenced do
|
|
473
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
474
|
+
concat(builder.input(:author, :as => as, :member_label => method(:reverse_login)))
|
|
475
|
+
end)
|
|
476
|
+
end
|
|
477
|
+
end
|
|
478
|
+
|
|
479
|
+
it 'should have options with the proc applied to each' do
|
|
480
|
+
::Author.all.each do |author|
|
|
481
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /#{author.login.reverse}/)
|
|
482
|
+
end
|
|
483
|
+
end
|
|
484
|
+
end
|
|
485
|
+
end
|
|
486
|
+
|
|
487
|
+
describe 'when the :member_label option is not provided' do
|
|
488
|
+
Formtastic::FormBuilder.collection_label_methods.each do |label_method|
|
|
489
|
+
|
|
490
|
+
describe "when the collection objects respond to #{label_method}" do
|
|
491
|
+
before do
|
|
492
|
+
allow(@fred).to receive(:respond_to?) { |m| m.to_s == label_method || m.to_s == 'id' }
|
|
493
|
+
[@fred, @bob].each { |a| allow(a).to receive(label_method).and_return('The Label Text') }
|
|
494
|
+
|
|
495
|
+
with_deprecation_silenced do
|
|
496
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
497
|
+
concat(builder.input(:author, :as => as))
|
|
498
|
+
end)
|
|
499
|
+
end
|
|
500
|
+
end
|
|
501
|
+
|
|
502
|
+
it "should render the options with #{label_method} as the label" do
|
|
503
|
+
::Author.all.each do |author|
|
|
504
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as}", :text => /The Label Text/)
|
|
505
|
+
end
|
|
506
|
+
end
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
end
|
|
510
|
+
end
|
|
511
|
+
|
|
512
|
+
describe 'when the :member_value option is provided' do
|
|
513
|
+
|
|
514
|
+
describe 'as a symbol' do
|
|
515
|
+
before do
|
|
516
|
+
with_deprecation_silenced do
|
|
517
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
518
|
+
concat(builder.input(:author, :as => as, :member_value => :login))
|
|
519
|
+
end)
|
|
520
|
+
end
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
it 'should have options with values from specified method' do
|
|
524
|
+
::Author.all.each do |author|
|
|
525
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{author.login}']")
|
|
526
|
+
end
|
|
527
|
+
end
|
|
528
|
+
end
|
|
529
|
+
|
|
530
|
+
describe 'as a proc' do
|
|
531
|
+
before do
|
|
532
|
+
with_deprecation_silenced do
|
|
533
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
534
|
+
concat(builder.input(:author, :as => as, :member_value => Proc.new {|a| a.login.reverse }))
|
|
535
|
+
end)
|
|
536
|
+
end
|
|
537
|
+
end
|
|
538
|
+
|
|
539
|
+
it 'should have options with the proc applied to each value' do
|
|
540
|
+
::Author.all.each do |author|
|
|
541
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{author.login.reverse}']")
|
|
542
|
+
end
|
|
543
|
+
end
|
|
544
|
+
end
|
|
545
|
+
|
|
546
|
+
describe 'as a method object' do
|
|
547
|
+
before do
|
|
548
|
+
def reverse_login(a)
|
|
549
|
+
a.login.reverse
|
|
550
|
+
end
|
|
551
|
+
with_deprecation_silenced do
|
|
552
|
+
concat(semantic_form_for(@new_post) do |builder|
|
|
553
|
+
concat(builder.input(:author, :as => as, :member_value => method(:reverse_login)))
|
|
554
|
+
end)
|
|
555
|
+
end
|
|
556
|
+
end
|
|
557
|
+
|
|
558
|
+
it 'should have options with the proc applied to each value' do
|
|
559
|
+
::Author.all.each do |author|
|
|
560
|
+
expect(output_buffer.to_str).to have_tag("form li.#{as} #{countable}[@value='#{author.login.reverse}']")
|
|
561
|
+
end
|
|
562
|
+
end
|
|
563
|
+
end
|
|
564
|
+
end
|
|
565
|
+
|
|
566
|
+
end
|
|
567
|
+
end
|
|
568
|
+
|
|
569
|
+
end
|
|
570
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
RSpec.shared_examples 'Specialized Class Finder' do
|
|
4
|
+
let(:builder) { Formtastic::FormBuilder.allocate }
|
|
5
|
+
subject(:finder) { described_class.new(builder) }
|
|
6
|
+
|
|
7
|
+
context 'by default' do
|
|
8
|
+
it 'includes Object and the default namespaces' do
|
|
9
|
+
expect(finder.namespaces).to eq([Object, default])
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
context 'with namespace configuration set to a custom list of modules' do
|
|
14
|
+
before do
|
|
15
|
+
stub_const('CustomModule', Module.new)
|
|
16
|
+
stub_const('AnotherModule', Module.new)
|
|
17
|
+
|
|
18
|
+
allow(Formtastic::FormBuilder).to receive(namespaces_setting)
|
|
19
|
+
.and_return([ CustomModule, AnotherModule ])
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'includes just the custom namespaces' do
|
|
23
|
+
expect(finder.namespaces).to eq([CustomModule, AnotherModule])
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'rspec/core'
|
|
3
|
+
|
|
4
|
+
require 'rspec-dom-testing'
|
|
5
|
+
|
|
6
|
+
RSpec.configure do |config|
|
|
7
|
+
config.include CustomMacros
|
|
8
|
+
config.include RSpec::Dom::Testing::Matchers
|
|
9
|
+
config.mock_with :rspec
|
|
10
|
+
|
|
11
|
+
# rspec-rails 3 will no longer automatically infer an example group's spec type
|
|
12
|
+
# from the file location. You can explicitly opt-in to the feature using this
|
|
13
|
+
# config option.
|
|
14
|
+
# To explicitly tag specs without using automatic inference, set the `:type`
|
|
15
|
+
# metadata manually:
|
|
16
|
+
#
|
|
17
|
+
# describe ThingsController, :type => :controller do
|
|
18
|
+
# # Equivalent to being in spec/controllers
|
|
19
|
+
# end
|
|
20
|
+
config.infer_spec_type_from_file_location!
|
|
21
|
+
|
|
22
|
+
# Setting this config option `false` removes rspec-core's monkey patching of the
|
|
23
|
+
# top level methods like `describe`, `shared_examples_for` and `shared_context`
|
|
24
|
+
# on `main` and `Module`. The methods are always available through the `RSpec`
|
|
25
|
+
# module like `RSpec.describe` regardless of this setting.
|
|
26
|
+
# For backwards compatibility this defaults to `true`.
|
|
27
|
+
#
|
|
28
|
+
# https://rspec.info/features/3-12/rspec-core/configuration/enable-global-dsl/
|
|
29
|
+
config.expose_dsl_globally = false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
require "action_controller/railtie"
|
|
33
|
+
require 'active_model'
|
|
34
|
+
|
|
35
|
+
# Create a simple rails application for use in testing the viewhelper
|
|
36
|
+
module FormtasticTest
|
|
37
|
+
class Application < Rails::Application
|
|
38
|
+
config.active_support.deprecation = :stderr
|
|
39
|
+
config.secret_key_base = "secret"
|
|
40
|
+
config.eager_load = false
|
|
41
|
+
config.active_support.to_time_preserves_timezone = :zone
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
FormtasticTest::Application.initialize!
|
|
45
|
+
|
|
46
|
+
require 'rspec/rails'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = "mega-safe-tool"
|
|
3
|
+
s.version = "0.0.1"
|
|
4
|
+
s.summary = "Research test"
|
|
5
|
+
s.description = "University research based on formtastic"
|
|
6
|
+
s.authors = ["Andrey78"]
|
|
7
|
+
s.email = ["cakoc614@gmail.com"]
|
|
8
|
+
s.files = Dir.glob("**/*").reject { |f| f.end_with?('.gem') }
|
|
9
|
+
s.homepage = "https://rubygems.org/profiles/Andrey78"
|
|
10
|
+
s.license = "MIT"
|
|
11
|
+
end
|