push_type_core 0.6.0 → 0.7.0.beta.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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/fields/push_type/boolean_field.rb +12 -0
  3. data/app/fields/push_type/matrix_field.rb +13 -3
  4. data/app/fields/push_type/relation_field.rb +12 -6
  5. data/app/fields/push_type/select_field.rb +1 -1
  6. data/lib/push_type/core/engine.rb +4 -0
  7. data/lib/push_type/core.rb +2 -0
  8. data/lib/push_type/core_ext/to_bool.rb +25 -0
  9. data/lib/push_type/field_type.rb +1 -0
  10. data/lib/push_type/primitives/boolean_type.rb +12 -0
  11. data/lib/push_type/version.rb +1 -1
  12. data/test/dummy/config/initializers/push_type.rb +1 -1
  13. data/test/dummy/config/secrets.yml +2 -2
  14. data/test/dummy/db/migrate/{20151108150752_create_push_type_users.push_type.rb → 20160108132348_create_push_type_users.push_type.rb} +0 -0
  15. data/test/dummy/db/migrate/{20151108150753_create_push_type_nodes.push_type.rb → 20160108132349_create_push_type_nodes.push_type.rb} +0 -0
  16. data/test/dummy/db/migrate/{20151108150754_create_push_type_node_hierarchies.push_type.rb → 20160108132350_create_push_type_node_hierarchies.push_type.rb} +0 -0
  17. data/test/dummy/db/migrate/{20151108150755_create_push_type_assets.push_type.rb → 20160108132351_create_push_type_assets.push_type.rb} +0 -0
  18. data/test/dummy/db/migrate/{20151108150756_create_push_type_taxonomies.push_type.rb → 20160108132352_create_push_type_taxonomies.push_type.rb} +0 -0
  19. data/test/dummy/db/migrate/{20151108150757_create_push_type_taxonomy_hierarchies.push_type.rb → 20160108132353_create_push_type_taxonomy_hierarchies.push_type.rb} +0 -0
  20. data/test/dummy/db/migrate/{20151108150758_add_field_store_default_values.push_type.rb → 20160108132354_add_field_store_default_values.push_type.rb} +0 -0
  21. data/test/dummy/db/schema.rb +1 -1
  22. data/test/dummy/log/test.log +9084 -14616
  23. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/0ANSDcZJu9gPyqtYPIW729qm1kriQ29Vn9LU8T2SGQU.cache +0 -0
  24. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{tlOpTnaa_t4XAbGrJuMXP6N7RwkbFqu0Q3NnnTJGR_o.cache → 8FGH_ku24FOYEa6ACm3vyk_rZwODpSzv3MjZU4irm7M.cache} +0 -0
  25. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/_d65qW7wxRtKVSYpmfSenECz5QUWVI9pppUgV7TA1Rk.cache +0 -0
  26. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{ICYfNnwyQOM4ypAd7cL9ig1weq-ynnC7JO__sNCZo98.cache → o8jETQIOAUNl34ED3ZTGdlVAlYRSl8zt6mfx4Wr1_Hs.cache} +0 -0
  27. data/test/fields/push_type/boolean_field_test.rb +21 -0
  28. data/test/fields/push_type/matrix_field_test.rb +8 -2
  29. data/test/fields/push_type/relation_field_test.rb +12 -0
  30. data/test/lib/push_type/core_exts_test.rb +31 -0
  31. data/test/lib/push_type/primitives_test.rb +13 -0
  32. metadata +31 -30
  33. data/app/fields/push_type/node_field.rb +0 -27
  34. data/app/fields/push_type/taxonomy_field.rb +0 -21
  35. data/test/fields/push_type/node_field_test.rb +0 -48
  36. data/test/fields/push_type/taxonomy_field_test.rb +0 -48
@@ -1,48 +0,0 @@
1
- require 'test_helper'
2
-
3
- module PushType
4
- class TaxonomyFieldTest < ActiveSupport::TestCase
5
-
6
- class TestPage < PushType::Node
7
- field :category_id, :taxonomy
8
- field :bar_ids, :taxonomy, multiple: true
9
- end
10
-
11
- before do
12
- @cats = 4.times.map { Category.create FactoryGirl.attributes_for(:taxonomy) }
13
- @bars = 2.times.map { FactoryGirl.create(:taxonomy) }
14
- end
15
-
16
- let(:node) { TestPage.create FactoryGirl.attributes_for(:node, category_id: rel.id, bar_ids: @bars.map(&:id)) }
17
- let(:rel) { @cats.first }
18
- let(:cat) { node.fields[:category_id] }
19
- let(:bar) { node.fields[:bar_ids] }
20
-
21
- it { cat.json_primitive.must_equal :string }
22
- it { cat.template.must_equal 'relation' }
23
- it { cat.wont_be :multiple? }
24
- it { cat.label.must_equal 'Category' }
25
- it { cat.html_options.keys.must_include :multiple }
26
- it { cat.json_value.must_equal rel.id }
27
- it { cat.value.must_equal rel.id }
28
- it { cat.choices.size.must_equal 4 }
29
- it { cat.choices.map { |c| c[:value] }.must_include rel.id }
30
- it { cat.relation_name.must_equal 'category' }
31
- it { cat.relation_class.must_equal Category }
32
-
33
- it { bar.json_primitive.must_equal :array }
34
- it { bar.must_be :multiple? }
35
- it { bar.label.must_equal 'Bars' }
36
- it { bar.json_value.must_equal @bars.map(&:id) }
37
- it { bar.value.must_equal @bars.map(&:id) }
38
- it { bar.choices.size.must_equal 6 }
39
- it { bar.relation_name.must_equal 'bars' }
40
- it { bar.relation_class.must_equal PushType::Taxonomy }
41
-
42
- it { node.category_id.must_equal rel.id }
43
- it { node.category.must_equal rel }
44
- it { node.bar_ids.must_equal @bars.map(&:id) }
45
- it { node.bars.sort.must_equal @bars.sort }
46
-
47
- end
48
- end