push_type_core 0.5.1 → 0.5.2

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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/push_type/install/templates/push_type.rb +20 -3
  3. data/lib/generators/push_type/node/templates/node.rb +9 -6
  4. data/lib/generators/push_type/taxonomy/templates/taxonomy.rb +2 -1
  5. data/lib/push_type/core.rb +2 -0
  6. data/lib/push_type/core/engine.rb +4 -4
  7. data/lib/push_type/testing/setup.rb +3 -4
  8. data/lib/push_type/testing/support/expectations.rb +5 -0
  9. data/lib/push_type/version.rb +1 -1
  10. data/test/controllers/nodes_front_end_controller_test.rb +2 -2
  11. data/test/controllers/taxonomies_front_end_controller_test.rb +2 -2
  12. data/test/dummy/app/models/category.rb +2 -1
  13. data/test/dummy/app/models/page.rb +5 -4
  14. data/test/dummy/config/initializers/push_type.rb +21 -4
  15. data/test/dummy/config/secrets.yml +2 -2
  16. data/test/dummy/db/migrate/{20150816155440_create_push_type_users.push_type.rb → 20150824095144_create_push_type_users.push_type.rb} +0 -0
  17. data/test/dummy/db/migrate/{20150816155441_create_push_type_nodes.push_type.rb → 20150824095145_create_push_type_nodes.push_type.rb} +0 -0
  18. data/test/dummy/db/migrate/{20150816155442_create_push_type_node_hierarchies.push_type.rb → 20150824095146_create_push_type_node_hierarchies.push_type.rb} +0 -0
  19. data/test/dummy/db/migrate/{20150816155443_create_push_type_assets.push_type.rb → 20150824095147_create_push_type_assets.push_type.rb} +0 -0
  20. data/test/dummy/db/migrate/{20150816155444_create_push_type_taxonomies.push_type.rb → 20150824095148_create_push_type_taxonomies.push_type.rb} +0 -0
  21. data/test/dummy/db/migrate/{20150816155445_create_push_type_taxonomy_hierarchies.push_type.rb → 20150824095149_create_push_type_taxonomy_hierarchies.push_type.rb} +0 -0
  22. data/test/dummy/db/migrate/{20150816155446_add_field_store_default_values.push_type.rb → 20150824095150_add_field_store_default_values.push_type.rb} +0 -0
  23. data/test/dummy/db/schema.rb +1 -1
  24. data/test/dummy/log/test.log +6929 -7664
  25. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{XZ5YMTEXVVS0qOmL43QbUr0VO27mRh-7fqzgzfV5Ulc.cache → 8S3sfGL04Qzd-CkJWBN2O8-yN9aBez7PaqeA4JuW9o4.cache} +0 -0
  26. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{W8pDH0KBIZeASFfhb6FcCvgBnw5mwDr_n-_mL7uyJCg.cache → fpxsy_yXkhFWrdcFn1-yw_WQGpaE1o6EwLLBz1huQYQ.cache} +0 -0
  27. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/g97nJc5YmnbscVR5pZZoxgfj652ml7dLjUIu0FHDwLA.cache +0 -0
  28. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/vlJujjzOikOTUvCvT3C4o3vK0ySfxbQQ3RBE37vXH0U.cache +0 -0
  29. data/test/dummy/tmp/generators/app/models/home_page.rb +5 -5
  30. data/test/fields/push_type/asset_field_test.rb +3 -3
  31. data/test/fields/push_type/date_field_test.rb +3 -3
  32. data/test/fields/push_type/markdown_field_test.rb +3 -3
  33. data/test/fields/push_type/matrix_field_test.rb +3 -3
  34. data/test/fields/push_type/node_field_test.rb +3 -3
  35. data/test/fields/push_type/number_field_test.rb +3 -3
  36. data/test/fields/push_type/repeater_field_test.rb +2 -3
  37. data/test/fields/push_type/select_field_test.rb +2 -3
  38. data/test/fields/push_type/tag_list_field_test.rb +3 -3
  39. data/test/fields/push_type/taxonomy_field_test.rb +3 -3
  40. data/test/fields/push_type/text_field_test.rb +3 -3
  41. data/test/fields/push_type/time_field_test.rb +3 -3
  42. data/test/lib/generators/push_type/field_generator_test.rb +2 -2
  43. data/test/lib/generators/push_type/install_generator_test.rb +2 -2
  44. data/test/lib/generators/push_type/node_generator_test.rb +2 -2
  45. data/test/lib/generators/push_type/presenter_generator_test.rb +2 -2
  46. data/test/lib/generators/push_type/taxonomy_generator_test.rb +2 -2
  47. data/test/lib/push_type/core_test.rb +2 -2
  48. data/test/lib/push_type/field_type_test.rb +2 -2
  49. data/test/lib/push_type/menu_builder/menu_dsl_test.rb +2 -2
  50. data/test/lib/push_type/menu_builder/menu_item_dsl_test.rb +2 -2
  51. data/test/lib/push_type/menu_builder/menu_item_test.rb +2 -2
  52. data/test/lib/push_type/menu_builder/menu_renderer_test.rb +1 -1
  53. data/test/lib/push_type/menu_builder/menu_test.rb +2 -2
  54. data/test/lib/push_type/menu_builder_test.rb +2 -2
  55. data/test/lib/push_type/presenter_test.rb +2 -2
  56. data/test/models/concerns/push_type/customizable_test.rb +2 -2
  57. data/test/models/concerns/push_type/nestable_test.rb +2 -2
  58. data/test/models/concerns/push_type/presentable_test.rb +2 -2
  59. data/test/models/concerns/push_type/publishable_test.rb +6 -6
  60. data/test/models/concerns/push_type/templatable_test.rb +2 -2
  61. data/test/models/concerns/push_type/trashable_test.rb +2 -2
  62. data/test/models/concerns/push_type/unexposable_test.rb +1 -1
  63. data/test/models/push_type/asset_test.rb +2 -2
  64. data/test/models/push_type/node_test.rb +2 -2
  65. data/test/models/push_type/taxonomy_test.rb +2 -2
  66. data/test/models/push_type/user_test.rb +2 -2
  67. data/test/test_helper.rb +4 -25
  68. metadata +33 -33
@@ -1,12 +1,12 @@
1
1
  class HomePage < PushType::Node
2
2
 
3
- # Control child nodes
4
- # has_child_nodes :all
3
+ # By default a node can have children of any other node type.
4
+ # Optionally pass a list of acceptable node types or prevent
5
+ # any descendents by passing false.
6
+ has_child_nodes :all
5
7
 
6
- # Set custom fields
7
- # field :body, :text, validates: { presence: true }
8
+ # Model the content by adding custom fields to the node.
8
9
  field :foo, :string
9
10
  field :bar, :text
10
-
11
11
 
12
12
  end
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
+ class AssetFieldTest < ActiveSupport::TestCase
4
5
 
5
- describe AssetField do
6
6
  let(:field) { PushType::AssetField.new :foo }
7
7
 
8
8
  it { field.json_key.must_equal :foo_id }
@@ -32,6 +32,6 @@ module PushType
32
32
  it { node.foo.must_equal asset }
33
33
  end
34
34
  end
35
- end
36
35
 
36
+ end
37
37
  end
@@ -1,14 +1,14 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
+ class DateFieldTest < ActiveSupport::TestCase
4
5
 
5
- describe DateField do
6
6
  let(:field) { PushType::DateField.new :foo }
7
7
  let(:val) { Date.today.to_s }
8
8
 
9
9
  it { field.template.must_equal 'date' }
10
10
  it { field.form_helper.must_equal :date_field }
11
11
  it { field.from_json(val).must_be_instance_of Date }
12
- end
13
12
 
13
+ end
14
14
  end
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
+ class MarkdownFieldTest < ActiveSupport::TestCase
4
5
 
5
- describe MarkdownField do
6
6
  let(:field) { PushType::MarkdownField.new :foo }
7
7
 
8
8
  it { field.form_helper.must_equal :text_area }
@@ -30,6 +30,6 @@ module PushType
30
30
  it { node.present!.foo.strip.must_equal '<p><strong>foo</strong> <em>bar</em></p>' }
31
31
  end
32
32
  end
33
- end
34
33
 
34
+ end
35
35
  end
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
+ class MatrixFieldTest < ActiveSupport::TestCase
4
5
 
5
- describe MatrixField do
6
6
  let(:field) { PushType::MatrixField.new :foo, opts }
7
7
  let(:val) { [{ key: 1, value: 2 }, { key: 3, value: 4 }] }
8
8
 
@@ -30,6 +30,6 @@ module PushType
30
30
  it { field.from_json(val)[0].that.must_equal 'b' }
31
31
  it { field.from_json(val)[0].other.must_equal '99' }
32
32
  end
33
- end
34
33
 
34
+ end
35
35
  end
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
+ class NodeFieldTest < ActiveSupport::TestCase
4
5
 
5
- describe NodeField do
6
6
  let(:field) { PushType::NodeField.new :foo, opts }
7
7
 
8
8
  before do
@@ -66,6 +66,6 @@ module PushType
66
66
  it { node.foo.must_equal rel }
67
67
  end
68
68
  end
69
- end
70
69
 
70
+ end
71
71
  end
@@ -1,13 +1,13 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
+ class NumberFieldTest < ActiveSupport::TestCase
4
5
 
5
- describe NumberField do
6
6
  let(:field) { PushType::NumberField.new :foo }
7
7
 
8
8
  it { field.form_helper.must_equal :number_field }
9
9
  it { field.to_json(1).must_equal 1 }
10
10
  it { field.to_json('1').must_equal 1 }
11
- end
12
11
 
12
+ end
13
13
  end
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
+ class RepeaterFieldTest < ActiveSupport::TestCase
4
5
 
5
- describe RepeaterField do
6
6
  let(:field) { PushType::RepeaterField.new :foo }
7
7
  let(:val) { ['a', 'b', 'c'] }
8
8
 
@@ -17,5 +17,4 @@ module PushType
17
17
  end
18
18
 
19
19
  end
20
-
21
20
  end
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
+ class SelectFieldTest < ActiveSupport::TestCase
4
5
 
5
- describe SelectField do
6
6
  let(:field) { PushType::SelectField.new :foo, opts }
7
7
  let(:val) { 'a' }
8
8
 
@@ -36,5 +36,4 @@ module PushType
36
36
  end
37
37
 
38
38
  end
39
-
40
39
  end
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
+ class TagListFieldTest < ActiveSupport::TestCase
4
5
 
5
- describe TagListField do
6
6
  let(:field) { PushType::TagListField.new :tags, opts }
7
7
  let(:val) { ['foo', 'bar'] }
8
8
 
@@ -53,6 +53,6 @@ module PushType
53
53
  it { TestPage.all_tags { TestPage.published }.must_equal ['qux'] }
54
54
  end
55
55
  end
56
- end
57
56
 
57
+ end
58
58
  end
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
+ class TaxonomyFieldTest < ActiveSupport::TestCase
4
5
 
5
- describe TaxonomyField do
6
6
  let(:field) { PushType::TaxonomyField.new :foo, opts }
7
7
 
8
8
  before do
@@ -52,6 +52,6 @@ module PushType
52
52
  it { node.foo.must_equal taxonomy }
53
53
  end
54
54
  end
55
- end
56
55
 
56
+ end
57
57
  end
@@ -1,12 +1,12 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
+ class TextFieldTest < ActiveSupport::TestCase
4
5
 
5
- describe TextField do
6
6
  let(:field) { PushType::TextField.new :foo }
7
7
  let(:val) { '15:00' }
8
8
 
9
9
  it { field.form_helper.must_equal :text_area }
10
- end
11
10
 
11
+ end
12
12
  end
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
+ class TimeFieldTest < ActiveSupport::TestCase
4
5
 
5
- describe TimeField do
6
6
  let(:field) { PushType::TimeField.new :foo }
7
7
  let(:val) { '15:00' }
8
8
 
@@ -10,6 +10,6 @@ module PushType
10
10
  it { field.form_helper.must_equal :time_field }
11
11
  it { field.from_json(val).must_be_instance_of Time }
12
12
  it { field.from_json(val).hour.must_equal 15 }
13
- end
14
13
 
14
+ end
15
15
  end
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
  require "generators/push_type/field/field_generator"
3
3
 
4
4
  module PushType
5
- describe FieldGenerator do
5
+ class FieldGeneratorTest < Rails::Generators::TestCase
6
6
  tests FieldGenerator
7
7
  destination Rails.root.join('tmp/generators')
8
8
 
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
  require "generators/push_type/install/install_generator"
3
3
 
4
4
  module PushType
5
- describe InstallGenerator do
5
+ class InstallGeneratorTest < Rails::Generators::TestCase
6
6
  tests InstallGenerator
7
7
  destination Rails.root.join('tmp/generators')
8
8
 
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
  require "generators/push_type/node/node_generator"
3
3
 
4
4
  module PushType
5
- describe NodeGenerator do
5
+ class NodeGeneratorTest < Rails::Generators::TestCase
6
6
  tests NodeGenerator
7
7
  destination Rails.root.join('tmp/generators')
8
8
 
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
  require "generators/push_type/presenter/presenter_generator"
3
3
 
4
4
  module PushType
5
- describe PresenterGenerator do
5
+ class PresenterGeneratorTest < Rails::Generators::TestCase
6
6
  tests PresenterGenerator
7
7
  destination Rails.root.join('tmp/generators')
8
8
 
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
  require "generators/push_type/taxonomy/taxonomy_generator"
3
3
 
4
4
  module PushType
5
- describe TaxonomyGenerator do
5
+ class TaxonomyGeneratorTest < Rails::Generators::TestCase
6
6
  tests TaxonomyGenerator
7
7
  destination Rails.root.join('tmp/generators')
8
8
 
@@ -1,7 +1,7 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
- describe ::PushType do
4
+ class PushTypeTest < ActiveSupport::TestCase
5
5
 
6
6
  describe '.version' do
7
7
  subject { PushType.version }
@@ -1,7 +1,7 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
- describe FieldType do
4
+ class FieldTypeTest < ActiveSupport::TestCase
5
5
 
6
6
  let(:field) { PushType::FieldType.new :foo, opts }
7
7
  let(:val) { '1' }
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
4
  module MenuBuilder
5
- describe Dsl::Menu do
5
+ class Dsl::MenuTest < ActiveSupport::TestCase
6
6
 
7
7
  let(:menu) { MenuBuilder::Menu.new }
8
8
 
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
4
  module MenuBuilder
5
- describe Dsl::MenuItem do
5
+ class Dsl::MenuItemTest < ActiveSupport::TestCase
6
6
 
7
7
  let(:item) { MenuBuilder::MenuItem.new(:bar) }
8
8
 
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
4
  module MenuBuilder
5
- describe MenuItem do
5
+ class MenuItemTest < ActiveSupport::TestCase
6
6
 
7
7
  let(:item) { MenuBuilder::MenuItem.new :foo }
8
8
 
@@ -1,4 +1,4 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
4
  module MenuBuilder
@@ -1,8 +1,8 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
4
  module MenuBuilder
5
- describe Menu do
5
+ class MenuTest < ActiveSupport::TestCase
6
6
 
7
7
  let(:menu) { MenuBuilder::Menu.new }
8
8
 
@@ -1,7 +1,7 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
- describe MenuBuilder do
4
+ class MenuBuilderTest < ActiveSupport::TestCase
5
5
 
6
6
  before { MenuBuilder.class_variable_set :@@menus, {} }
7
7
  after { MenuBuilder.class_variable_set :@@menus, {} }
@@ -1,7 +1,7 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
- describe Presenter do
4
+ class PresenterTest < ActiveSupport::TestCase
5
5
 
6
6
  let(:page) { Page.create FactoryGirl.attributes_for(:node) }
7
7
 
@@ -1,7 +1,7 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
- describe Customizable do
4
+ class CustomizableTest < ActiveSupport::TestCase
5
5
 
6
6
  let(:page) { TestPage.new }
7
7
  let(:fields) { page.fields }
@@ -1,7 +1,7 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
- describe Nestable do
4
+ class NestableTest < ActiveSupport::TestCase
5
5
 
6
6
  let(:page) { TestPage.new }
7
7
  let(:roots) { PushType.root_nodes }
@@ -1,7 +1,7 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module PushType
4
- describe Presentable do
4
+ class PresentableTest < ActiveSupport::TestCase
5
5
 
6
6
  describe 'class methods' do
7
7
  it { Page.presenter_class_name.must_equal 'PagePresenter' }