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,90 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
require 'formtastic/namespaced_class_finder'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Formtastic::NamespacedClassFinder do
|
|
6
|
+
include FormtasticSpecHelper
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
stub_const('SearchPath', Module.new)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
let(:search_path) { [ SearchPath ] }
|
|
13
|
+
subject(:finder) { Formtastic::NamespacedClassFinder.new(search_path) }
|
|
14
|
+
|
|
15
|
+
shared_examples 'Namespaced Class Finder' do
|
|
16
|
+
subject(:found_class) { finder.find(:custom_class) }
|
|
17
|
+
|
|
18
|
+
context 'Input defined in the Object scope' do
|
|
19
|
+
before do
|
|
20
|
+
stub_const('CustomClass', Class.new)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it { expect(found_class).to be(CustomClass) }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
context 'Input defined in the search path' do
|
|
27
|
+
before do
|
|
28
|
+
stub_const('SearchPath::CustomClass', Class.new)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it { expect(found_class).to be(SearchPath::CustomClass) }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
context 'Input defined both in the Object scope and the search path' do
|
|
35
|
+
before do
|
|
36
|
+
stub_const('CustomClass', Class.new)
|
|
37
|
+
stub_const('SearchPath::CustomClass', Class.new)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it { expect(found_class).to be(SearchPath::CustomClass) }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
context 'Input defined outside the search path' do
|
|
44
|
+
before do
|
|
45
|
+
stub_const('Foo', Module.new)
|
|
46
|
+
stub_const('Foo::CustomClass', Class.new)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
let(:error) { Formtastic::NamespacedClassFinder::NotFoundError }
|
|
50
|
+
|
|
51
|
+
it { expect { found_class }.to raise_error(error) }
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
context '#finder' do
|
|
56
|
+
before do
|
|
57
|
+
allow(Rails.application.config).to receive(:eager_load).and_return(eager_load)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
context 'when eager_load is on' do
|
|
61
|
+
let(:eager_load) { true }
|
|
62
|
+
|
|
63
|
+
it "finder_method is :find_with_const_defined" do
|
|
64
|
+
expect(described_class.finder_method).to eq(:find_with_const_defined)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it_behaves_like 'Namespaced Class Finder'
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
context 'when eager_load is off' do
|
|
71
|
+
let(:eager_load) { false }
|
|
72
|
+
|
|
73
|
+
it "finder_method is :find_by_trying" do
|
|
74
|
+
described_class.instance_variable_set(:@finder_method, nil) # clear cache
|
|
75
|
+
expect(described_class.finder_method).to eq(:find_by_trying)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it_behaves_like 'Namespaced Class Finder'
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
context '#find' do
|
|
83
|
+
it 'caches calls' do
|
|
84
|
+
expect(subject).to receive(:resolve).once.and_call_original
|
|
85
|
+
subject.find(:object)
|
|
86
|
+
subject.find(:object)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
ActiveRecord::Schema.define(version: 20170208011723) do
|
|
3
|
+
|
|
4
|
+
create_table "posts", force: :cascade do |t|
|
|
5
|
+
t.integer "author_id", limit: 4, null: false
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
create_table "authors", force: :cascade do |t|
|
|
9
|
+
t.integer "age", limit: 4, null: false
|
|
10
|
+
t.string "name", limit: 255, null: false
|
|
11
|
+
t.string "surname", limit: 255, null: false
|
|
12
|
+
t.string "login", limit: 255
|
|
13
|
+
t.datetime "created_at"
|
|
14
|
+
t.datetime "updated_at"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
#non-rails foreign id convention
|
|
18
|
+
create_table "legacy_posts", force: :cascade do |t|
|
|
19
|
+
t.integer "post_author", limit: 4, null: false
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require 'active_support'
|
|
5
|
+
require 'action_pack'
|
|
6
|
+
require 'action_view'
|
|
7
|
+
require 'action_controller'
|
|
8
|
+
require 'action_dispatch'
|
|
9
|
+
require 'active_record'
|
|
10
|
+
|
|
11
|
+
ActiveRecord::Base.establish_connection('url' => 'sqlite3::memory:', 'pool' => 1)
|
|
12
|
+
load 'spec/schema.rb'
|
|
13
|
+
|
|
14
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '../lib/formtastic'))
|
|
15
|
+
|
|
16
|
+
require 'ammeter/init'
|
|
17
|
+
|
|
18
|
+
# Requires supporting files with custom matchers and macros, etc,
|
|
19
|
+
# in ./support/ and its subdirectories in alphabetic order.
|
|
20
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each {|f| require f}
|
|
21
|
+
|
|
22
|
+
I18n.enforce_available_locales = false if I18n.respond_to?(:enforce_available_locales)
|
|
23
|
+
|
|
24
|
+
module FakeHelpersModule
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
module FormtasticSpecHelper
|
|
28
|
+
include ActionPack
|
|
29
|
+
include ActionView::Context if defined?(ActionView::Context)
|
|
30
|
+
include ActionController::RecordIdentifier if defined?(ActionController::RecordIdentifier)
|
|
31
|
+
include ActionView::Helpers::FormHelper
|
|
32
|
+
include ActionView::Helpers::FormTagHelper
|
|
33
|
+
include ActionView::Helpers::FormOptionsHelper
|
|
34
|
+
include ActionView::Helpers::UrlHelper
|
|
35
|
+
include ActionView::Helpers::TagHelper
|
|
36
|
+
include ActionView::Helpers::TextHelper
|
|
37
|
+
include ActionView::Helpers::ActiveRecordHelper if defined?(ActionView::Helpers::ActiveRecordHelper)
|
|
38
|
+
include ActionView::Helpers::ActiveModelHelper if defined?(ActionView::Helpers::ActiveModelHelper)
|
|
39
|
+
include ActionView::Helpers::DateHelper
|
|
40
|
+
include ActionView::Helpers::CaptureHelper
|
|
41
|
+
include ActionView::Helpers::AssetTagHelper
|
|
42
|
+
include ActiveSupport
|
|
43
|
+
include ActionController::PolymorphicRoutes if defined?(ActionController::PolymorphicRoutes)
|
|
44
|
+
include ActionDispatch::Routing::PolymorphicRoutes
|
|
45
|
+
include AbstractController::UrlFor if defined?(AbstractController::UrlFor)
|
|
46
|
+
include ActionView::RecordIdentifier if defined?(ActionView::RecordIdentifier)
|
|
47
|
+
|
|
48
|
+
include Formtastic::Helpers::FormHelper
|
|
49
|
+
|
|
50
|
+
def default_input_type(column_type, column_name = :generic_column_name)
|
|
51
|
+
allow(@new_post).to receive(column_name)
|
|
52
|
+
allow(@new_post).to receive(:column_for_attribute).and_return(double('column', :type => column_type)) unless column_type.nil?
|
|
53
|
+
|
|
54
|
+
semantic_form_for(@new_post) do |builder|
|
|
55
|
+
@default_type = builder.send(:default_input_type, column_name)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
return @default_type
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def active_model_validator(kind, attributes, options = {})
|
|
62
|
+
validator = double("ActiveModel::Validations::#{kind.to_s.titlecase}Validator", :attributes => attributes, :options => options)
|
|
63
|
+
allow(validator).to receive(:kind).and_return(kind)
|
|
64
|
+
validator
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def active_model_presence_validator(attributes, options = {})
|
|
68
|
+
active_model_validator(:presence, attributes, options)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def active_model_length_validator(attributes, options = {})
|
|
72
|
+
active_model_validator(:length, attributes, options)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def active_model_inclusion_validator(attributes, options = {})
|
|
76
|
+
active_model_validator(:inclusion, attributes, options)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def active_model_numericality_validator(attributes, options = {})
|
|
80
|
+
active_model_validator(:numericality, attributes, options)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
class ::MongoPost
|
|
84
|
+
include MongoMapper::Document if defined?(MongoMapper::Document)
|
|
85
|
+
|
|
86
|
+
def id
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def persisted?
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class ::Post
|
|
95
|
+
extend ActiveModel::Naming if defined?(ActiveModel::Naming)
|
|
96
|
+
include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
|
|
97
|
+
|
|
98
|
+
def id
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def persisted?
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
module ::Namespaced
|
|
106
|
+
class Post < ActiveRecord::Base
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
class ::Author < ActiveRecord::Base
|
|
111
|
+
def new_record?
|
|
112
|
+
!id
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def to_label
|
|
116
|
+
[name, surname].compact.join(' ')
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
class ::HashBackedAuthor < Hash
|
|
121
|
+
extend ActiveModel::Naming if defined?(ActiveModel::Naming)
|
|
122
|
+
include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
|
|
123
|
+
def persisted?; false; end
|
|
124
|
+
def name
|
|
125
|
+
'hash backed author'
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
class ::LegacyPost < ActiveRecord::Base
|
|
130
|
+
belongs_to :author, foreign_key: :post_author
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
class ::Continent
|
|
134
|
+
extend ActiveModel::Naming if defined?(ActiveModel::Naming)
|
|
135
|
+
include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
class ::PostModel
|
|
139
|
+
extend ActiveModel::Naming if defined?(ActiveModel::Naming)
|
|
140
|
+
include ActiveModel::Conversion if defined?(ActiveModel::Conversion)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
##
|
|
144
|
+
# We can't mock :respond_to?, so we need a concrete class override
|
|
145
|
+
class ::MongoidReflectionMock < RSpec::Mocks::Double
|
|
146
|
+
def initialize(name=nil, stubs_and_options={})
|
|
147
|
+
super name, stubs_and_options
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def respond_to?(sym)
|
|
151
|
+
sym == :options ? false : super
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Model.all returns an association proxy, which quacks a lot like an array.
|
|
156
|
+
# We use this in stubs or mocks where we need to return the later.
|
|
157
|
+
#
|
|
158
|
+
# TODO try delegate?
|
|
159
|
+
# delegate :map, :size, :length, :first, :to_ary, :each, :include?, :to => :array
|
|
160
|
+
class MockScope
|
|
161
|
+
attr_reader :array
|
|
162
|
+
|
|
163
|
+
def initialize(the_array)
|
|
164
|
+
@array = the_array
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def map(&block)
|
|
168
|
+
array.map(&block)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def where(*args)
|
|
172
|
+
# array
|
|
173
|
+
self
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def includes(*args)
|
|
177
|
+
self
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def size
|
|
181
|
+
array.size
|
|
182
|
+
end
|
|
183
|
+
alias_method :length, :size
|
|
184
|
+
|
|
185
|
+
def first
|
|
186
|
+
array.first
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def to_ary
|
|
190
|
+
array
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def each(&block)
|
|
194
|
+
array.each(&block)
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def include?(*args)
|
|
198
|
+
array.include?(*args)
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def _routes
|
|
203
|
+
url_helpers = double('url_helpers')
|
|
204
|
+
allow(url_helpers).to receive(:hash_for_posts_path).and_return({})
|
|
205
|
+
allow(url_helpers).to receive(:hash_for_post_path).and_return({})
|
|
206
|
+
allow(url_helpers).to receive(:hash_for_post_models_path).and_return({})
|
|
207
|
+
allow(url_helpers).to receive(:hash_for_authors_path).and_return({})
|
|
208
|
+
|
|
209
|
+
double('_routes',
|
|
210
|
+
:url_helpers => url_helpers,
|
|
211
|
+
:url_for => "/mock/path",
|
|
212
|
+
:polymorphic_mappings => {}
|
|
213
|
+
)
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def controller
|
|
217
|
+
env = double('env', :[] => nil)
|
|
218
|
+
request = double('request', :env => env)
|
|
219
|
+
double('controller', :controller_path= => '', :params => {}, :request => request)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def default_url_options
|
|
223
|
+
{}
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def mock_everything
|
|
227
|
+
|
|
228
|
+
# Resource-oriented styles like form_for(@post) will expect a path method for the object,
|
|
229
|
+
# so we're defining some here.
|
|
230
|
+
def post_models_path(*args); "/postmodels/1"; end
|
|
231
|
+
|
|
232
|
+
def post_path(*args); "/posts/1"; end
|
|
233
|
+
def posts_path(*args); "/posts"; end
|
|
234
|
+
def new_post_path(*args); "/posts/new"; end
|
|
235
|
+
|
|
236
|
+
def author_path(*args); "/authors/1"; end
|
|
237
|
+
def authors_path(*args); "/authors"; end
|
|
238
|
+
def new_author_path(*args); "/authors/new"; end
|
|
239
|
+
|
|
240
|
+
def author_array_or_scope(the_array = [@fred, @bob])
|
|
241
|
+
MockScope.new(the_array)
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
@fred = ::Author.new(login: 'fred_smith', age: 27, name: 'Fred', id: 37)
|
|
245
|
+
@bob = ::Author.new(login: 'bob', age: 43, name: 'Bob', id: 42)
|
|
246
|
+
@james = ::Author.new(age: 38, id: 75)
|
|
247
|
+
|
|
248
|
+
allow(::Author).to receive(:scoped).and_return(::Author)
|
|
249
|
+
allow(::Author).to receive(:find).and_return(author_array_or_scope)
|
|
250
|
+
allow(::Author).to receive(:all).and_return(author_array_or_scope)
|
|
251
|
+
allow(::Author).to receive(:where).and_return(author_array_or_scope)
|
|
252
|
+
allow(::Author).to receive(:human_attribute_name) { |column_name| column_name.humanize }
|
|
253
|
+
allow(::Author).to receive(:human_name).and_return('::Author')
|
|
254
|
+
allow(::Author).to receive(:reflect_on_association) { |column_name| double('reflection', :scope => nil, :options => {}, :klass => Post, :macro => :has_many) if column_name == :posts }
|
|
255
|
+
allow(::Author).to receive(:content_columns).and_return([double('column', :name => 'login'), double('column', :name => 'created_at')])
|
|
256
|
+
allow(::Author).to receive(:to_key).and_return(nil)
|
|
257
|
+
allow(::Author).to receive(:persisted?).and_return(nil)
|
|
258
|
+
|
|
259
|
+
@hash_backed_author = HashBackedAuthor.new
|
|
260
|
+
|
|
261
|
+
# Sometimes we need a mock @post object and some Authors for belongs_to
|
|
262
|
+
@new_post = double('post')
|
|
263
|
+
allow(@new_post).to receive(:class).and_return(::Post)
|
|
264
|
+
allow(@new_post).to receive(:id).and_return(nil)
|
|
265
|
+
allow(@new_post).to receive(:new_record?).and_return(true)
|
|
266
|
+
allow(@new_post).to receive(:errors).and_return(double('errors', :[] => nil))
|
|
267
|
+
allow(@new_post).to receive(:author).and_return(nil)
|
|
268
|
+
allow(@new_post).to receive(:author_attributes=).and_return(nil)
|
|
269
|
+
allow(@new_post).to receive(:authors).and_return(author_array_or_scope([@fred]))
|
|
270
|
+
allow(@new_post).to receive(:authors_attributes=)
|
|
271
|
+
allow(@new_post).to receive(:reviewer).and_return(nil)
|
|
272
|
+
allow(@new_post).to receive(:main_post).and_return(nil)
|
|
273
|
+
allow(@new_post).to receive(:sub_posts).and_return([]) #TODO should be a mock with methods for adding sub posts
|
|
274
|
+
allow(@new_post).to receive(:to_key).and_return(nil)
|
|
275
|
+
allow(@new_post).to receive(:to_model).and_return(@new_post)
|
|
276
|
+
allow(@new_post).to receive(:persisted?).and_return(nil)
|
|
277
|
+
allow(@new_post).to receive(:model_name){ @new_post.class.model_name}
|
|
278
|
+
|
|
279
|
+
@freds_post = double('post')
|
|
280
|
+
allow(@freds_post).to receive(:to_ary)
|
|
281
|
+
allow(@freds_post).to receive(:class).and_return(::Post)
|
|
282
|
+
allow(@freds_post).to receive(:to_label).and_return('Fred Smith')
|
|
283
|
+
allow(@freds_post).to receive(:id).and_return(19)
|
|
284
|
+
allow(@freds_post).to receive(:title).and_return("Hello World")
|
|
285
|
+
allow(@freds_post).to receive(:author).and_return(@fred)
|
|
286
|
+
allow(@freds_post).to receive(:author_id).and_return(@fred.id)
|
|
287
|
+
allow(@freds_post).to receive(:authors).and_return([@fred])
|
|
288
|
+
allow(@freds_post).to receive(:author_ids).and_return([@fred.id])
|
|
289
|
+
allow(@freds_post).to receive(:new_record?).and_return(false)
|
|
290
|
+
allow(@freds_post).to receive(:errors).and_return(double('errors', :[] => nil))
|
|
291
|
+
allow(@freds_post).to receive(:to_key).and_return(nil)
|
|
292
|
+
allow(@freds_post).to receive(:persisted?).and_return(nil)
|
|
293
|
+
allow(@freds_post).to receive(:model_name){ @freds_post.class.model_name}
|
|
294
|
+
allow(@freds_post).to receive(:to_model).and_return(@freds_post)
|
|
295
|
+
allow(@fred).to receive(:posts).and_return(author_array_or_scope([@freds_post]))
|
|
296
|
+
allow(@fred).to receive(:post_ids).and_return([@freds_post.id])
|
|
297
|
+
|
|
298
|
+
allow(::Post).to receive(:scoped).and_return(::Post)
|
|
299
|
+
allow(::Post).to receive(:human_attribute_name) { |column_name| column_name.humanize }
|
|
300
|
+
allow(::Post).to receive(:human_name).and_return('Post')
|
|
301
|
+
allow(::Post).to receive(:reflect_on_all_validations).and_return([])
|
|
302
|
+
allow(::Post).to receive(:reflect_on_validations_for).and_return([])
|
|
303
|
+
allow(::Post).to receive(:reflections).and_return({})
|
|
304
|
+
allow(::Post).to receive(:reflect_on_association) { |column_name|
|
|
305
|
+
case column_name
|
|
306
|
+
when :author, :author_status
|
|
307
|
+
mock = double('reflection', :scope => nil, :options => {}, :klass => ::Author, :macro => :belongs_to)
|
|
308
|
+
allow(mock).to receive(:[]).with(:class_name).and_return("Author")
|
|
309
|
+
mock
|
|
310
|
+
when :reviewer
|
|
311
|
+
mock = double('reflection', :scope => nil, :options => {:class_name => 'Author'}, :klass => ::Author, :macro => :belongs_to)
|
|
312
|
+
allow(mock).to receive(:[]).with(:class_name).and_return("Author")
|
|
313
|
+
mock
|
|
314
|
+
when :authors
|
|
315
|
+
double('reflection', :scope => nil, :options => {}, :klass => ::Author, :macro => :has_and_belongs_to_many)
|
|
316
|
+
when :sub_posts
|
|
317
|
+
double('reflection', :scope => nil, :options => {}, :klass => ::Post, :macro => :has_many)
|
|
318
|
+
when :main_post
|
|
319
|
+
double('reflection', :scope => nil, :options => {}, :klass => ::Post, :macro => :belongs_to)
|
|
320
|
+
when :mongoid_reviewer
|
|
321
|
+
::MongoidReflectionMock.new('reflection',
|
|
322
|
+
:scope => nil,
|
|
323
|
+
:options => Proc.new { raise NoMethodError, "Mongoid has no reflection.options" },
|
|
324
|
+
:klass => ::Author, :macro => :referenced_in, :foreign_key => "reviewer_id") # custom id
|
|
325
|
+
end
|
|
326
|
+
}
|
|
327
|
+
allow(::Post).to receive(:find).and_return(author_array_or_scope([@freds_post]))
|
|
328
|
+
allow(::Post).to receive(:all).and_return(author_array_or_scope([@freds_post]))
|
|
329
|
+
allow(::Post).to receive(:where).and_return(author_array_or_scope([@freds_post]))
|
|
330
|
+
allow(::Post).to receive(:content_columns).and_return([double('column', :name => 'title'), double('column', :name => 'body'), double('column', :name => 'created_at')])
|
|
331
|
+
allow(::Post).to receive(:to_key).and_return(nil)
|
|
332
|
+
allow(::Post).to receive(:persisted?).and_return(nil)
|
|
333
|
+
allow(::Post).to receive(:to_ary)
|
|
334
|
+
|
|
335
|
+
allow(::MongoPost).to receive(:human_attribute_name) { |column_name| column_name.humanize }
|
|
336
|
+
allow(::MongoPost).to receive(:human_name).and_return('MongoPost')
|
|
337
|
+
allow(::MongoPost).to receive(:associations).and_return({
|
|
338
|
+
:sub_posts => double('reflection', :options => {:polymorphic => true}, :klass => ::MongoPost, :macro => :has_many),
|
|
339
|
+
:options => []
|
|
340
|
+
})
|
|
341
|
+
allow(::MongoPost).to receive(:find).and_return(author_array_or_scope([@freds_post]))
|
|
342
|
+
allow(::MongoPost).to receive(:all).and_return(author_array_or_scope([@freds_post]))
|
|
343
|
+
allow(::MongoPost).to receive(:where).and_return(author_array_or_scope([@freds_post]))
|
|
344
|
+
allow(::MongoPost).to receive(:to_key).and_return(nil)
|
|
345
|
+
allow(::MongoPost).to receive(:persisted?).and_return(nil)
|
|
346
|
+
allow(::MongoPost).to receive(:to_ary)
|
|
347
|
+
allow(::MongoPost).to receive(:model_name).and_return( double(:model_name_mock, :singular => "post", :plural => "posts", :param_key => "post", :route_key => "posts", :name => "post") )
|
|
348
|
+
|
|
349
|
+
@new_mm_post = double('mm_post')
|
|
350
|
+
allow(@new_mm_post).to receive(:class).and_return(::MongoPost)
|
|
351
|
+
allow(@new_mm_post).to receive(:id).and_return(nil)
|
|
352
|
+
allow(@new_mm_post).to receive(:new_record?).and_return(true)
|
|
353
|
+
allow(@new_mm_post).to receive(:errors).and_return(double('errors', :[] => nil))
|
|
354
|
+
allow(@new_mm_post).to receive(:title).and_return("Hello World")
|
|
355
|
+
allow(@new_mm_post).to receive(:sub_posts).and_return([]) #TODO should be a mock with methods for adding sub posts
|
|
356
|
+
allow(@new_mm_post).to receive(:to_key).and_return(nil)
|
|
357
|
+
allow(@new_mm_post).to receive(:to_model).and_return(@new_mm_post)
|
|
358
|
+
allow(@new_mm_post).to receive(:persisted?).and_return(nil)
|
|
359
|
+
allow(@new_mm_post).to receive(:model_name).and_return(::MongoPost.model_name)
|
|
360
|
+
|
|
361
|
+
@mock_file = double('file')
|
|
362
|
+
Formtastic::FormBuilder.file_methods.each do |method|
|
|
363
|
+
allow(@mock_file).to receive(method).and_return(true)
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
allow(@new_post).to receive(:title)
|
|
367
|
+
allow(@new_post).to receive(:status)
|
|
368
|
+
allow(@new_post).to receive(:email)
|
|
369
|
+
allow(@new_post).to receive(:url)
|
|
370
|
+
allow(@new_post).to receive(:phone)
|
|
371
|
+
allow(@new_post).to receive(:search)
|
|
372
|
+
allow(@new_post).to receive(:to_ary)
|
|
373
|
+
allow(@new_post).to receive(:body)
|
|
374
|
+
allow(@new_post).to receive(:published)
|
|
375
|
+
allow(@new_post).to receive(:publish_at)
|
|
376
|
+
allow(@new_post).to receive(:created_at)
|
|
377
|
+
allow(@new_post).to receive(:secret).and_return(1)
|
|
378
|
+
allow(@new_post).to receive(:url)
|
|
379
|
+
allow(@new_post).to receive(:email)
|
|
380
|
+
allow(@new_post).to receive(:color)
|
|
381
|
+
allow(@new_post).to receive(:search)
|
|
382
|
+
allow(@new_post).to receive(:phone)
|
|
383
|
+
allow(@new_post).to receive(:time_zone)
|
|
384
|
+
allow(@new_post).to receive(:category_name)
|
|
385
|
+
allow(@new_post).to receive(:allow_comments).and_return(true)
|
|
386
|
+
allow(@new_post).to receive(:answer_comments)
|
|
387
|
+
allow(@new_post).to receive(:country)
|
|
388
|
+
allow(@new_post).to receive(:country_subdivision)
|
|
389
|
+
allow(@new_post).to receive(:country_code)
|
|
390
|
+
allow(@new_post).to receive(:document).and_return(@mock_file)
|
|
391
|
+
allow(@new_post).to receive(:column_for_attribute).with(:meta_description).and_return(double('column', :type => :string, :limit => 255))
|
|
392
|
+
allow(@new_post).to receive(:column_for_attribute).with(:title).and_return(double('column', :type => :string, :limit => 50))
|
|
393
|
+
allow(@new_post).to receive(:column_for_attribute).with(:status).and_return(double('column', :type => :integer, :limit => 1))
|
|
394
|
+
allow(@new_post).to receive(:column_for_attribute).with(:body).and_return(double('column', :type => :text))
|
|
395
|
+
allow(@new_post).to receive(:column_for_attribute).with(:published).and_return(double('column', :type => :boolean))
|
|
396
|
+
allow(@new_post).to receive(:column_for_attribute).with(:publish_at).and_return(double('column', :type => :date))
|
|
397
|
+
allow(@new_post).to receive(:column_for_attribute).with(:time_zone).and_return(double('column', :type => :string))
|
|
398
|
+
allow(@new_post).to receive(:column_for_attribute).with(:allow_comments).and_return(double('column', :type => :boolean))
|
|
399
|
+
allow(@new_post).to receive(:column_for_attribute).with(:author).and_return(double('column', :type => :integer))
|
|
400
|
+
allow(@new_post).to receive(:column_for_attribute).with(:country).and_return(double('column', :type => :string, :limit => 255))
|
|
401
|
+
allow(@new_post).to receive(:column_for_attribute).with(:country_subdivision).and_return(double('column', :type => :string, :limit => 255))
|
|
402
|
+
allow(@new_post).to receive(:column_for_attribute).with(:country_code).and_return(double('column', :type => :string, :limit => 255))
|
|
403
|
+
allow(@new_post).to receive(:column_for_attribute).with(:email).and_return(double('column', :type => :string, :limit => 255))
|
|
404
|
+
allow(@new_post).to receive(:column_for_attribute).with(:color).and_return(double('column', :type => :string, :limit => 255))
|
|
405
|
+
allow(@new_post).to receive(:column_for_attribute).with(:url).and_return(double('column', :type => :string, :limit => 255))
|
|
406
|
+
allow(@new_post).to receive(:column_for_attribute).with(:phone).and_return(double('column', :type => :string, :limit => 255))
|
|
407
|
+
allow(@new_post).to receive(:column_for_attribute).with(:search).and_return(double('column', :type => :string, :limit => 255))
|
|
408
|
+
allow(@new_post).to receive(:column_for_attribute).with(:document).and_return(nil)
|
|
409
|
+
|
|
410
|
+
allow(@new_post).to receive(:author).and_return(@bob)
|
|
411
|
+
allow(@new_post).to receive(:author_id).and_return(@bob.id)
|
|
412
|
+
|
|
413
|
+
allow(@new_post).to receive(:reviewer).and_return(@fred)
|
|
414
|
+
allow(@new_post).to receive(:reviewer_id).and_return(@fred.id)
|
|
415
|
+
|
|
416
|
+
# @new_post.should_receive(:publish_at=).at_least(:once)
|
|
417
|
+
allow(@new_post).to receive(:publish_at=)
|
|
418
|
+
# @new_post.should_receive(:title=).at_least(:once)
|
|
419
|
+
allow(@new_post).to receive(:title=)
|
|
420
|
+
allow(@new_post).to receive(:main_post_id).and_return(nil)
|
|
421
|
+
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
def self.included(base)
|
|
425
|
+
base.class_eval do
|
|
426
|
+
|
|
427
|
+
attr_accessor :output_buffer
|
|
428
|
+
|
|
429
|
+
def protect_against_forgery?
|
|
430
|
+
false
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
def _helpers
|
|
434
|
+
FakeHelpersModule
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
end
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
def with_config(config_method_name, value, &block)
|
|
441
|
+
old_value = Formtastic::FormBuilder.send(config_method_name)
|
|
442
|
+
Formtastic::FormBuilder.send(:"#{config_method_name}=", value)
|
|
443
|
+
yield
|
|
444
|
+
Formtastic::FormBuilder.send(:"#{config_method_name}=", old_value)
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
RSpec::Matchers.define :errors_matcher do |expected|
|
|
448
|
+
match { |actual| actual.to_s == expected.to_s }
|
|
449
|
+
end
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
class ::ActionView::Base
|
|
453
|
+
include Formtastic::Helpers::FormHelper
|
|
454
|
+
end
|
|
455
|
+
|
|
456
|
+
RSpec.configure do |config|
|
|
457
|
+
config.infer_spec_type_from_file_location!
|
|
458
|
+
|
|
459
|
+
config.filter_run focus: true
|
|
460
|
+
config.filter_run_excluding skip: true
|
|
461
|
+
config.run_all_when_everything_filtered = true
|
|
462
|
+
|
|
463
|
+
config.before(:example) do
|
|
464
|
+
Formtastic::Localizer.cache.clear!
|
|
465
|
+
end
|
|
466
|
+
end
|