push_type_core 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/fields/push_type/tag_list_field.rb +60 -4
- data/lib/push_type/version.rb +1 -1
- data/test/dummy/config/initializers/push_type.rb +1 -1
- data/test/dummy/config/secrets.yml +2 -2
- data/test/dummy/db/migrate/{20150716155017_create_push_type_users.push_type.rb → 20150816155440_create_push_type_users.push_type.rb} +0 -0
- data/test/dummy/db/migrate/{20150716155018_create_push_type_nodes.push_type.rb → 20150816155441_create_push_type_nodes.push_type.rb} +0 -0
- data/test/dummy/db/migrate/{20150716155019_create_push_type_node_hierarchies.push_type.rb → 20150816155442_create_push_type_node_hierarchies.push_type.rb} +0 -0
- data/test/dummy/db/migrate/{20150716155020_create_push_type_assets.push_type.rb → 20150816155443_create_push_type_assets.push_type.rb} +0 -0
- data/test/dummy/db/migrate/{20150716155021_create_push_type_taxonomies.push_type.rb → 20150816155444_create_push_type_taxonomies.push_type.rb} +0 -0
- data/test/dummy/db/migrate/{20150716155022_create_push_type_taxonomy_hierarchies.push_type.rb → 20150816155445_create_push_type_taxonomy_hierarchies.push_type.rb} +0 -0
- data/test/dummy/db/migrate/{20150716155023_add_field_store_default_values.push_type.rb → 20150816155446_add_field_store_default_values.push_type.rb} +0 -0
- data/test/dummy/db/schema.rb +1 -1
- data/test/dummy/log/test.log +6465 -5452
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{DIGO2XX0gV_Ebgs43ap-65y0MyrcySF3iz56xum2NCQ.cache → W8pDH0KBIZeASFfhb6FcCvgBnw5mwDr_n-_mL7uyJCg.cache} +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{0tutfZEltPbqMrjMJpcgLOWDEBEA1_i4wAlgfGmDMaM.cache → XZ5YMTEXVVS0qOmL43QbUr0VO27mRh-7fqzgzfV5Ulc.cache} +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/g97nJc5YmnbscVR5pZZoxgfj652ml7dLjUIu0FHDwLA.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/vlJujjzOikOTUvCvT3C4o3vK0ySfxbQQ3RBE37vXH0U.cache +0 -0
- data/test/dummy/tmp/generators/app/models/home_page.rb +12 -0
- data/test/dummy/tmp/generators/app/views/nodes/home_page.html.erb +13 -0
- data/test/fields/push_type/tag_list_field_test.rb +29 -4
- metadata +28 -31
- data/lib/push_type/tag_list_query.rb +0 -38
- data/test/dummy/tmp/generators/config/initializers/push_type.rb +0 -38
- data/test/dummy/tmp/generators/config/routes.rb +0 -59
- data/test/lib/push_type/tag_list_query_test.rb +0 -36
File without changes
|
File without changes
|
Binary file
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<h1><%= @node.title %></h1>
|
2
|
+
<p>This is a generated HomePage template.</p>
|
3
|
+
<p>Find me at: app/views/nodes/home_page.html.erb</p>
|
4
|
+
|
5
|
+
<div>
|
6
|
+
<div>Foo:</div>
|
7
|
+
<div><%= @node.foo %></div>
|
8
|
+
</div>
|
9
|
+
<div>
|
10
|
+
<div>Bar:</div>
|
11
|
+
<div><%= @node.bar %></div>
|
12
|
+
</div>
|
13
|
+
|
@@ -20,13 +20,38 @@ module PushType
|
|
20
20
|
before do
|
21
21
|
TestPage.instance_variable_set '@fields', ActiveSupport::OrderedHash.new
|
22
22
|
TestPage.field :tags, :tag_list
|
23
|
-
TestPage.create FactoryGirl.attributes_for(:node, tags: ['foo', 'bar'])
|
23
|
+
TestPage.create FactoryGirl.attributes_for(:node, tags: ['foo', 'bar', 'foo'])
|
24
24
|
TestPage.create FactoryGirl.attributes_for(:node, tags: ['baz', 'bar'])
|
25
|
-
TestPage.create FactoryGirl.attributes_for(:
|
25
|
+
TestPage.create FactoryGirl.attributes_for(:published_node, tags: ['qux'])
|
26
|
+
@first = TestPage.create FactoryGirl.attributes_for(:node, tags: ['foo', 'bar', 'qux'])
|
27
|
+
TestPage.create FactoryGirl.attributes_for(:published_node)
|
26
28
|
end
|
27
29
|
after { TestPage.instance_variable_set '@fields', ActiveSupport::OrderedHash.new }
|
28
|
-
|
29
|
-
|
30
|
+
|
31
|
+
describe '#with_all_tags' do
|
32
|
+
let(:tags) { ['foo', 'foo', 'bar', 'qux'] }
|
33
|
+
it { TestPage.must_respond_to :with_all_tags }
|
34
|
+
it { TestPage.with_all_tags(tags).must_be_instance_of TestPage::ActiveRecord_Relation }
|
35
|
+
it { TestPage.with_all_tags(tags).count.must_equal 1 }
|
36
|
+
it { TestPage.published.with_all_tags(tags).count.must_equal 0 }
|
37
|
+
it { TestPage.published.with_all_tags('qux').count.must_equal 1 }
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#with_any_tags' do
|
41
|
+
let(:tags) { ['foo', 'foo', 'bar', 'qux'] }
|
42
|
+
it { TestPage.must_respond_to :with_any_tags }
|
43
|
+
it { TestPage.with_any_tags(tags).must_be_instance_of Array }
|
44
|
+
it { TestPage.with_any_tags(tags).count.must_equal 4 }
|
45
|
+
it { TestPage.with_any_tags(tags).first.must_equal @first }
|
46
|
+
it { TestPage.published.with_any_tags(tags).count.must_equal 1 }
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#all_tags' do
|
50
|
+
it { TestPage.must_respond_to :all_tags }
|
51
|
+
it { TestPage.all_tags.must_equal ['bar', 'baz', 'foo', 'qux'] }
|
52
|
+
it { TestPage.published.all_tags.must_equal ['qux'] }
|
53
|
+
it { TestPage.all_tags { TestPage.published }.must_equal ['qux'] }
|
54
|
+
end
|
30
55
|
end
|
31
56
|
end
|
32
57
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: push_type_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Russell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -122,8 +122,8 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 4.5.0
|
125
|
-
description: The core engine for
|
126
|
-
|
125
|
+
description: The core engine for PushType CMS. Required by all other PushType engines.
|
126
|
+
PushType is a modern, open source content management system for Ruby on Rails.
|
127
127
|
email:
|
128
128
|
- aaron@gc4.co.uk
|
129
129
|
executables: []
|
@@ -215,7 +215,6 @@ files:
|
|
215
215
|
- lib/push_type/menu_builder/menu_renderer.rb
|
216
216
|
- lib/push_type/presenter.rb
|
217
217
|
- lib/push_type/rails/routes.rb
|
218
|
-
- lib/push_type/tag_list_query.rb
|
219
218
|
- lib/push_type/testing/common_rake.rb
|
220
219
|
- lib/push_type/testing/factories.rb
|
221
220
|
- lib/push_type/testing/setup.rb
|
@@ -260,13 +259,13 @@ files:
|
|
260
259
|
- test/dummy/config/locales/en.yml
|
261
260
|
- test/dummy/config/routes.rb
|
262
261
|
- test/dummy/config/secrets.yml
|
263
|
-
- test/dummy/db/migrate/
|
264
|
-
- test/dummy/db/migrate/
|
265
|
-
- test/dummy/db/migrate/
|
266
|
-
- test/dummy/db/migrate/
|
267
|
-
- test/dummy/db/migrate/
|
268
|
-
- test/dummy/db/migrate/
|
269
|
-
- test/dummy/db/migrate/
|
262
|
+
- test/dummy/db/migrate/20150816155440_create_push_type_users.push_type.rb
|
263
|
+
- test/dummy/db/migrate/20150816155441_create_push_type_nodes.push_type.rb
|
264
|
+
- test/dummy/db/migrate/20150816155442_create_push_type_node_hierarchies.push_type.rb
|
265
|
+
- test/dummy/db/migrate/20150816155443_create_push_type_assets.push_type.rb
|
266
|
+
- test/dummy/db/migrate/20150816155444_create_push_type_taxonomies.push_type.rb
|
267
|
+
- test/dummy/db/migrate/20150816155445_create_push_type_taxonomy_hierarchies.push_type.rb
|
268
|
+
- test/dummy/db/migrate/20150816155446_add_field_store_default_values.push_type.rb
|
270
269
|
- test/dummy/db/schema.rb
|
271
270
|
- test/dummy/db/seeds.rb
|
272
271
|
- test/dummy/log/test.log
|
@@ -275,16 +274,16 @@ files:
|
|
275
274
|
- test/dummy/public/500.html
|
276
275
|
- test/dummy/public/favicon.ico
|
277
276
|
- test/dummy/public/robots.txt
|
278
|
-
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/0tutfZEltPbqMrjMJpcgLOWDEBEA1_i4wAlgfGmDMaM.cache
|
279
277
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/5hBD45unr3-A8x6pxXjxq708mnY9gJisy1yA5AojZWQ.cache
|
280
|
-
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/DIGO2XX0gV_Ebgs43ap-65y0MyrcySF3iz56xum2NCQ.cache
|
281
278
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/M0EVptJKeB1GMjwoMb3w3mgp8VB55MSbItnFhItY4hA.cache
|
282
279
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/MSjNaQjz3SH1LnDyk7nWta_i3hcCEV9m1eoNFbOXjwI.cache
|
280
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/W8pDH0KBIZeASFfhb6FcCvgBnw5mwDr_n-_mL7uyJCg.cache
|
281
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/XZ5YMTEXVVS0qOmL43QbUr0VO27mRh-7fqzgzfV5Ulc.cache
|
283
282
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/g97nJc5YmnbscVR5pZZoxgfj652ml7dLjUIu0FHDwLA.cache
|
284
283
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/utXmZy0kE8zUnHIqwtbjUUJlYlFcGDJreK2YPDuR3n8.cache
|
285
284
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/vlJujjzOikOTUvCvT3C4o3vK0ySfxbQQ3RBE37vXH0U.cache
|
286
|
-
- test/dummy/tmp/generators/
|
287
|
-
- test/dummy/tmp/generators/
|
285
|
+
- test/dummy/tmp/generators/app/models/home_page.rb
|
286
|
+
- test/dummy/tmp/generators/app/views/nodes/home_page.html.erb
|
288
287
|
- test/fields/push_type/asset_field_test.rb
|
289
288
|
- test/fields/push_type/date_field_test.rb
|
290
289
|
- test/fields/push_type/markdown_field_test.rb
|
@@ -315,7 +314,6 @@ files:
|
|
315
314
|
- test/lib/push_type/menu_builder/menu_test.rb
|
316
315
|
- test/lib/push_type/menu_builder_test.rb
|
317
316
|
- test/lib/push_type/presenter_test.rb
|
318
|
-
- test/lib/push_type/tag_list_query_test.rb
|
319
317
|
- test/models/concerns/push_type/customizable_test.rb
|
320
318
|
- test/models/concerns/push_type/nestable_test.rb
|
321
319
|
- test/models/concerns/push_type/presentable_test.rb
|
@@ -328,7 +326,7 @@ files:
|
|
328
326
|
- test/models/push_type/taxonomy_test.rb
|
329
327
|
- test/models/push_type/user_test.rb
|
330
328
|
- test/test_helper.rb
|
331
|
-
homepage: http://
|
329
|
+
homepage: http://www.pushtype.org
|
332
330
|
licenses:
|
333
331
|
- MIT
|
334
332
|
metadata: {}
|
@@ -351,7 +349,7 @@ rubyforge_project:
|
|
351
349
|
rubygems_version: 2.4.2
|
352
350
|
signing_key:
|
353
351
|
specification_version: 4
|
354
|
-
summary: The core engine for
|
352
|
+
summary: The core engine for PushType CMS.
|
355
353
|
test_files:
|
356
354
|
- test/controllers/nodes_front_end_controller_test.rb
|
357
355
|
- test/controllers/taxonomies_front_end_controller_test.rb
|
@@ -387,13 +385,13 @@ test_files:
|
|
387
385
|
- test/dummy/config/routes.rb
|
388
386
|
- test/dummy/config/secrets.yml
|
389
387
|
- test/dummy/config.ru
|
390
|
-
- test/dummy/db/migrate/
|
391
|
-
- test/dummy/db/migrate/
|
392
|
-
- test/dummy/db/migrate/
|
393
|
-
- test/dummy/db/migrate/
|
394
|
-
- test/dummy/db/migrate/
|
395
|
-
- test/dummy/db/migrate/
|
396
|
-
- test/dummy/db/migrate/
|
388
|
+
- test/dummy/db/migrate/20150816155440_create_push_type_users.push_type.rb
|
389
|
+
- test/dummy/db/migrate/20150816155441_create_push_type_nodes.push_type.rb
|
390
|
+
- test/dummy/db/migrate/20150816155442_create_push_type_node_hierarchies.push_type.rb
|
391
|
+
- test/dummy/db/migrate/20150816155443_create_push_type_assets.push_type.rb
|
392
|
+
- test/dummy/db/migrate/20150816155444_create_push_type_taxonomies.push_type.rb
|
393
|
+
- test/dummy/db/migrate/20150816155445_create_push_type_taxonomy_hierarchies.push_type.rb
|
394
|
+
- test/dummy/db/migrate/20150816155446_add_field_store_default_values.push_type.rb
|
397
395
|
- test/dummy/db/schema.rb
|
398
396
|
- test/dummy/db/seeds.rb
|
399
397
|
- test/dummy/log/test.log
|
@@ -404,16 +402,16 @@ test_files:
|
|
404
402
|
- test/dummy/public/robots.txt
|
405
403
|
- test/dummy/Rakefile
|
406
404
|
- test/dummy/README.rdoc
|
407
|
-
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/0tutfZEltPbqMrjMJpcgLOWDEBEA1_i4wAlgfGmDMaM.cache
|
408
405
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/5hBD45unr3-A8x6pxXjxq708mnY9gJisy1yA5AojZWQ.cache
|
409
|
-
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/DIGO2XX0gV_Ebgs43ap-65y0MyrcySF3iz56xum2NCQ.cache
|
410
406
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/g97nJc5YmnbscVR5pZZoxgfj652ml7dLjUIu0FHDwLA.cache
|
411
407
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/M0EVptJKeB1GMjwoMb3w3mgp8VB55MSbItnFhItY4hA.cache
|
412
408
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/MSjNaQjz3SH1LnDyk7nWta_i3hcCEV9m1eoNFbOXjwI.cache
|
413
409
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/utXmZy0kE8zUnHIqwtbjUUJlYlFcGDJreK2YPDuR3n8.cache
|
414
410
|
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/vlJujjzOikOTUvCvT3C4o3vK0ySfxbQQ3RBE37vXH0U.cache
|
415
|
-
- test/dummy/tmp/
|
416
|
-
- test/dummy/tmp/
|
411
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/W8pDH0KBIZeASFfhb6FcCvgBnw5mwDr_n-_mL7uyJCg.cache
|
412
|
+
- test/dummy/tmp/cache/assets/test/sprockets/v3.0/XZ5YMTEXVVS0qOmL43QbUr0VO27mRh-7fqzgzfV5Ulc.cache
|
413
|
+
- test/dummy/tmp/generators/app/models/home_page.rb
|
414
|
+
- test/dummy/tmp/generators/app/views/nodes/home_page.html.erb
|
417
415
|
- test/fields/push_type/asset_field_test.rb
|
418
416
|
- test/fields/push_type/date_field_test.rb
|
419
417
|
- test/fields/push_type/markdown_field_test.rb
|
@@ -444,7 +442,6 @@ test_files:
|
|
444
442
|
- test/lib/push_type/menu_builder/menu_test.rb
|
445
443
|
- test/lib/push_type/menu_builder_test.rb
|
446
444
|
- test/lib/push_type/presenter_test.rb
|
447
|
-
- test/lib/push_type/tag_list_query_test.rb
|
448
445
|
- test/models/concerns/push_type/customizable_test.rb
|
449
446
|
- test/models/concerns/push_type/nestable_test.rb
|
450
447
|
- test/models/concerns/push_type/presentable_test.rb
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module PushType
|
2
|
-
class TagListQuery
|
3
|
-
|
4
|
-
def initialize(name, type)
|
5
|
-
@name = name
|
6
|
-
@type = type
|
7
|
-
end
|
8
|
-
|
9
|
-
def all(opts = {})
|
10
|
-
@opts = { type: @type }.merge(opts)
|
11
|
-
connection.select_all(query).rows.flatten
|
12
|
-
end
|
13
|
-
|
14
|
-
def node_types
|
15
|
-
PushType.subclasses_from_list(:node, @opts[:type]).map { |n| "'#{ n.camelcase }'" }
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def connection
|
21
|
-
PushType::Node.connection
|
22
|
-
end
|
23
|
-
|
24
|
-
def query
|
25
|
-
[
|
26
|
-
"SELECT DISTINCT jsonb_array_elements_text(field_store->'#{ @name }') AS _tag",
|
27
|
-
"FROM push_type_nodes",
|
28
|
-
where_sql,
|
29
|
-
"ORDER BY _tag"
|
30
|
-
].compact.join(' ')
|
31
|
-
end
|
32
|
-
|
33
|
-
def where_sql
|
34
|
-
"WHERE push_type_nodes.type IN (#{ node_types.join(', ') })" unless @opts[:type] == :all || node_types.blank?
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
PushType.setup do |config|
|
2
|
-
|
3
|
-
config.root_nodes = :all
|
4
|
-
|
5
|
-
config.unexposed_nodes = []
|
6
|
-
|
7
|
-
config.home_slug = 'home'
|
8
|
-
|
9
|
-
config.unexposed_taxonomies = []
|
10
|
-
|
11
|
-
config.media_styles = {
|
12
|
-
large: '1024x1024>',
|
13
|
-
medium: '512x512>',
|
14
|
-
small: '256x256>'
|
15
|
-
}
|
16
|
-
|
17
|
-
# Configure the default mailer "from" address
|
18
|
-
config.mailer_sender = 'pushtype@example.com'
|
19
|
-
|
20
|
-
# Dragonfly datastore configuration
|
21
|
-
config.dragonfly_datastore = :file
|
22
|
-
config.dragonfly_datastore_options = {
|
23
|
-
root_path: Rails.root.join('public/system/dragonfly', Rails.env),
|
24
|
-
server_root: Rails.root.join('public')
|
25
|
-
}
|
26
|
-
|
27
|
-
# For S3 storage, remember to add to Gemfile:
|
28
|
-
# gem 'dragonfly-s3_data_store'
|
29
|
-
# config.dragonfly_datastore = :s3
|
30
|
-
# config.dragonfly_datastore_options = {
|
31
|
-
# bucket_name: ENV['S3_BUCKET'],
|
32
|
-
# access_key_id: ENV['S3_ACCESS_KEY_ID'],
|
33
|
-
# secret_access_key: ENV['SECRET_ACCESS_KEY_ID']
|
34
|
-
# }
|
35
|
-
|
36
|
-
# config.dragonfly_secret = '44e1892734ed4d66cc27a4d83f3e09807491a01759063549073bacb407bf3af6'
|
37
|
-
|
38
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
Rails.application.routes.draw do
|
2
|
-
|
3
|
-
mount_push_type
|
4
|
-
|
5
|
-
# The priority is based upon order of creation: first created -> highest priority.
|
6
|
-
# See how all your routes lay out with "rake routes".
|
7
|
-
|
8
|
-
# You can have the root of your site routed with "root"
|
9
|
-
# root 'welcome#index'
|
10
|
-
|
11
|
-
# Example of regular route:
|
12
|
-
# get 'products/:id' => 'catalog#view'
|
13
|
-
|
14
|
-
# Example of named route that can be invoked with purchase_url(id: product.id)
|
15
|
-
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
16
|
-
|
17
|
-
# Example resource route (maps HTTP verbs to controller actions automatically):
|
18
|
-
# resources :products
|
19
|
-
|
20
|
-
# Example resource route with options:
|
21
|
-
# resources :products do
|
22
|
-
# member do
|
23
|
-
# get 'short'
|
24
|
-
# post 'toggle'
|
25
|
-
# end
|
26
|
-
#
|
27
|
-
# collection do
|
28
|
-
# get 'sold'
|
29
|
-
# end
|
30
|
-
# end
|
31
|
-
|
32
|
-
# Example resource route with sub-resources:
|
33
|
-
# resources :products do
|
34
|
-
# resources :comments, :sales
|
35
|
-
# resource :seller
|
36
|
-
# end
|
37
|
-
|
38
|
-
# Example resource route with more complex sub-resources:
|
39
|
-
# resources :products do
|
40
|
-
# resources :comments
|
41
|
-
# resources :sales do
|
42
|
-
# get 'recent', on: :collection
|
43
|
-
# end
|
44
|
-
# end
|
45
|
-
|
46
|
-
# Example resource route with concerns:
|
47
|
-
# concern :toggleable do
|
48
|
-
# post 'toggle'
|
49
|
-
# end
|
50
|
-
# resources :posts, concerns: :toggleable
|
51
|
-
# resources :photos, concerns: :toggleable
|
52
|
-
|
53
|
-
# Example resource route within a namespace:
|
54
|
-
# namespace :admin do
|
55
|
-
# # Directs /admin/products/* to Admin::ProductsController
|
56
|
-
# # (app/controllers/admin/products_controller.rb)
|
57
|
-
# resources :products
|
58
|
-
# end
|
59
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module PushType
|
4
|
-
describe TagListQuery do
|
5
|
-
|
6
|
-
before do
|
7
|
-
Page.instance_variable_set '@fields', ActiveSupport::OrderedHash.new
|
8
|
-
TestPage.instance_variable_set '@fields', ActiveSupport::OrderedHash.new
|
9
|
-
Page.field :tags, :tag_list
|
10
|
-
TestPage.field :tags, :tag_list
|
11
|
-
Page.create FactoryGirl.attributes_for(:node, tags: ['foo', 'bar'])
|
12
|
-
Page.create FactoryGirl.attributes_for(:node, tags: ['baz'])
|
13
|
-
TestPage.create FactoryGirl.attributes_for(:node, tags: ['foo', 'bang'])
|
14
|
-
end
|
15
|
-
|
16
|
-
after do
|
17
|
-
Page.instance_variable_set '@fields', ActiveSupport::OrderedHash.new
|
18
|
-
TestPage.instance_variable_set '@fields', ActiveSupport::OrderedHash.new
|
19
|
-
end
|
20
|
-
|
21
|
-
let(:query) { TagListQuery.new('tags', 'page') }
|
22
|
-
|
23
|
-
describe '.all' do
|
24
|
-
it 'should return the subjects tags' do
|
25
|
-
query.all.must_equal ['bar', 'baz', 'foo']
|
26
|
-
end
|
27
|
-
it 'should return all node types tags' do
|
28
|
-
query.all(type: :all).must_equal ['bang', 'bar', 'baz', 'foo']
|
29
|
-
end
|
30
|
-
it 'should return TestPage tags' do
|
31
|
-
query.all(type: :test_page).must_equal ['bang', 'foo']
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|