eac_rails_utils 0.8.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -0
  3. data/{lib/eac → app/helpers/eac_rails_utils}/common_form_helper.rb +8 -1
  4. data/{lib/eac → app/helpers/eac_rails_utils}/common_form_helper/form_builder.rb +12 -2
  5. data/{lib/eac → app/helpers/eac_rails_utils}/common_form_helper/form_builder/association_select_field.rb +5 -2
  6. data/{lib/eac → app/helpers/eac_rails_utils}/common_form_helper/form_builder/common_text_fields.rb +4 -3
  7. data/{lib/eac → app/helpers/eac_rails_utils}/common_form_helper/form_builder/currency_field.rb +14 -12
  8. data/{lib/eac → app/helpers/eac_rails_utils}/common_form_helper/form_builder/date_field.rb +3 -1
  9. data/{lib/eac → app/helpers/eac_rails_utils}/common_form_helper/form_builder/fields_for.rb +3 -1
  10. data/{lib/eac → app/helpers/eac_rails_utils}/common_form_helper/form_builder/file_field.rb +2 -1
  11. data/{lib/eac → app/helpers/eac_rails_utils}/common_form_helper/form_builder/radio_select_field.rb +5 -2
  12. data/{lib/eac → app/helpers/eac_rails_utils}/common_form_helper/form_builder/searchable_association_field.rb +7 -3
  13. data/{lib/eac → app/helpers/eac_rails_utils}/common_form_helper/form_builder/select_field.rb +3 -1
  14. data/{lib/eac → app/helpers/eac_rails_utils}/common_form_helper/form_builder/time_field.rb +2 -1
  15. data/{lib/eac → app/helpers/eac_rails_utils}/common_form_helper/form_builder/year_month_field.rb +2 -1
  16. data/app/helpers/eac_rails_utils/data_table_helper.rb +13 -0
  17. data/{lib/eac → app/helpers/eac_rails_utils}/data_table_helper/column.rb +6 -3
  18. data/{lib/eac → app/helpers/eac_rails_utils}/data_table_helper/data_table.rb +13 -11
  19. data/{lib/eac → app/helpers/eac_rails_utils}/data_table_helper/setup.rb +3 -2
  20. data/app/helpers/eac_rails_utils/formatter_helper.rb +2 -0
  21. data/app/helpers/eac_rails_utils/links_helper.rb +12 -2
  22. data/{lib/eac → app/helpers/eac_rails_utils}/menus_helper.rb +10 -2
  23. data/{lib/eac → app/helpers/eac_rails_utils}/menus_helper/bootstrap_gui_builder.rb +8 -5
  24. data/{lib/eac → app/helpers/eac_rails_utils}/menus_helper/data_builder.rb +7 -2
  25. data/{lib/eac → app/helpers/eac_rails_utils}/menus_helper/gui_builder.rb +6 -3
  26. data/app/helpers/eac_rails_utils/open_graph_protocol_helper.rb +2 -0
  27. data/{lib/eac → app/validators/eac_rails_utils}/cpf_validator.rb +8 -4
  28. data/{lib/eac → app/validators/eac_rails_utils}/no_presence_validator.rb +3 -3
  29. data/lib/assets/javascripts/jMenu.jquery.min.js +12 -12
  30. data/lib/eac_rails_utils.rb +3 -41
  31. data/lib/eac_rails_utils/engine.rb +3 -0
  32. data/lib/{eac → eac_rails_utils}/htmlbeautifier.rb +3 -1
  33. data/lib/eac_rails_utils/models.rb +9 -0
  34. data/lib/eac_rails_utils/models/attribute_required.rb +43 -0
  35. data/lib/eac_rails_utils/models/fetch_errors.rb +92 -0
  36. data/lib/eac_rails_utils/models/inequality_queries.rb +39 -0
  37. data/lib/eac_rails_utils/models/tableless.rb +97 -0
  38. data/lib/eac_rails_utils/models/test_utils.rb +65 -0
  39. data/lib/eac_rails_utils/patches.rb +9 -0
  40. data/lib/eac_rails_utils/patches/action_controller_base.rb +3 -0
  41. data/lib/eac_rails_utils/version.rb +2 -1
  42. data/test/dummy/Rakefile +3 -1
  43. data/test/dummy/app/models/job.rb +2 -0
  44. data/test/dummy/app/models/user.rb +6 -0
  45. data/test/dummy/config.ru +2 -0
  46. data/test/dummy/config/application.rb +3 -1
  47. data/test/dummy/config/boot.rb +3 -1
  48. data/test/dummy/config/environment.rb +3 -1
  49. data/test/dummy/config/environments/test.rb +2 -0
  50. data/test/dummy/config/routes.rb +2 -0
  51. data/test/dummy/db/migrate/20160415125333_create_users.rb +2 -0
  52. data/test/dummy/db/migrate/20160415143123_create_jobs.rb +2 -0
  53. data/test/dummy/db/migrate/20160415143229_add_job_to_users.rb +2 -0
  54. data/test/{lib/eac → helpers/eac_rails_utils}/common_form_helper_test.rb +4 -2
  55. data/test/{lib/eac/data_table_test_helper.rb → helpers/eac_rails_utils/data_table_test_helper_test.rb} +4 -3
  56. data/test/{app/helpers → helpers}/eac_rails_utils/formatter_helper_test.rb +1 -0
  57. data/test/lib/eac_rails_utils/{patches/model_attribute_required_test.rb → models/attribute_required_test.rb} +3 -0
  58. data/test/lib/eac_rails_utils/models/fetch_errors_test.rb +80 -0
  59. data/test/lib/eac_rails_utils/models/tableless_test.rb +25 -0
  60. data/test/test_helper.rb +3 -1
  61. data/test/{lib/eac → validators}/cpf_validator_test.rb +4 -2
  62. metadata +91 -98
  63. data/lib/eac/data_table_helper.rb +0 -12
  64. data/lib/eac/inequality_queries.rb +0 -36
  65. data/lib/eac/model.rb +0 -87
  66. data/lib/eac/parsers/files_test.rb +0 -63
  67. data/lib/eac/source_target_fixtures.rb +0 -66
  68. data/lib/eac/test_utils.rb +0 -56
  69. data/lib/eac_rails_utils/patches/model_attribute_required.rb +0 -31
  70. data/lib/eac_rails_utils/patches/ofx_parser.rb +0 -42
  71. data/lib/eac_rails_utils/tableless_model.rb +0 -90
  72. data/test/lib/eac/model_test.rb +0 -76
  73. data/test/lib/eac/parsers/files_test_test.rb +0 -27
  74. data/test/lib/eac/parsers/ok_test_files/a.source.yaml +0 -1
  75. data/test/lib/eac/parsers/ok_test_files/a.target.yaml +0 -1
  76. data/test/lib/eac/parsers/ok_test_files/b.source.yaml +0 -1
  77. data/test/lib/eac/parsers/ok_test_files/b.target.yaml +0 -1
  78. data/test/lib/eac/source_target_fixtures_test.rb +0 -41
  79. data/test/lib/eac/source_target_fixtures_test_files/a.source.html +0 -1
  80. data/test/lib/eac/source_target_fixtures_test_files/a.target.yaml +0 -1
  81. data/test/lib/eac/source_target_fixtures_test_files/b.source.html +0 -1
  82. data/test/lib/eac/source_target_fixtures_test_files/c.target.yaml +0 -1
  83. data/test/lib/eac_rails_utils/tableless_model_test.rb +0 -23
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'test_helper'
3
-
4
- module Eac
5
- class SourceTargetFixturesTest < ActionView::TestCase
6
- def test_source_target_files
7
- r = ::Eac::SourceTargetFixtures.new(fixtures_dir).source_target_files
8
- assert_equal 3, r.count
9
-
10
- a = r.find { |x| x.source && File.basename(x.source) == 'a.source.html' }
11
- assert a
12
- assert_equal File.join(fixtures_dir, 'a.source.html'), a.source
13
- assert_equal File.join(fixtures_dir, 'a.target.yaml'), a.target
14
-
15
- b = r.find { |x| x.source && File.basename(x.source) == 'b.source.html' }
16
- assert b
17
- assert_equal File.join(fixtures_dir, 'b.source.html'), b.source
18
- assert_nil b.target
19
-
20
- c = r.find { |x| x.target && File.basename(x.target) == 'c.target.yaml' }
21
- assert c
22
- assert_nil c.source
23
- assert_equal File.join(fixtures_dir, 'c.target.yaml'), c.target
24
- end
25
-
26
- def test_source_files
27
- r = ::Eac::SourceTargetFixtures.new(fixtures_dir).source_files
28
- assert_equal 2, r.count
29
-
30
- %w(a.source.html b.source.html).each do |expected|
31
- assert r.include?(File.join(fixtures_dir, expected)), expected
32
- end
33
- end
34
-
35
- private
36
-
37
- def fixtures_dir
38
- File.expand_path('../source_target_fixtures_test_files', __FILE__)
39
- end
40
- end
41
- end
@@ -1,23 +0,0 @@
1
- # encoding: UTF-8
2
- # frozen_string_literal: true
3
- require 'test_helper'
4
-
5
- module EacRailsUtils
6
- class TablelessModelTest < ActiveSupport::TestCase
7
- class Stub < ::EacRailsUtils::TablelessModel
8
- attribute :tempo, DateTime
9
- end
10
-
11
- test 'date time array values' do
12
- stub = Stub.new('tempo(1i)' => '9', 'tempo(2i)' => '10', 'tempo(3i)' => '11',
13
- 'tempo(4i)' => '12', 'tempo(5i)' => '13', 'tempo(6i)' => '14')
14
- assert stub.tempo.is_a?(DateTime), "Class: |#{stub.tempo.class}|, Value: |#{stub.tempo}|"
15
- assert_equal 9, stub.tempo.year, 'Year'
16
- assert_equal 10, stub.tempo.month, 'Month'
17
- assert_equal 11, stub.tempo.day, 'Day'
18
- assert_equal 12, stub.tempo.hour, 'Hour'
19
- assert_equal 13, stub.tempo.minute, 'Minute'
20
- assert_equal 14, stub.tempo.second, 'Second'
21
- end
22
- end
23
- end