pageflow-support 13.0.0.beta6 → 13.0.0.beta7
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 +4 -4
- data/pageflow/dummy/templates/create_test_hosted_file.rb +22 -1
- data/pageflow/global_config_api_test_helper.rb +53 -0
- data/pageflow/lint.rb +76 -0
- data/pageflow/test_page_type.rb +12 -0
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63d9a73a001f922496a2eda12bee4b8ea1b75a8914821f32ee2b89a7798d2206
|
4
|
+
data.tar.gz: e363ff87b846199f7a8e2eb4199916266021370405d76b8a866042b0bb321585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7af7609a6f6729b49dc23353a1d28b49302ed245ef7bfbe74d09a52e620b03d1af4a4de61a78685bcec73620bdc640d5567a0032c26e15b0188c3c94078babe5
|
7
|
+
data.tar.gz: fe9e865351dab7a67f3747671dfbe9942c941640bf234d98b5637d662e07bf5369c4c1b2c791f00ffe51fe49f4caf3cf5c7c1aa301fbc2c697a10915e4c9ec4e
|
@@ -1,7 +1,28 @@
|
|
1
1
|
class CreateTestHostedFile < ActiveRecord::Migration[4.2]
|
2
2
|
def change
|
3
3
|
create_table :test_hosted_files do |t|
|
4
|
-
|
4
|
+
t.belongs_to(:entry, index: true)
|
5
|
+
t.belongs_to(:uploader, index: true)
|
6
|
+
|
7
|
+
t.integer(:parent_file_id)
|
8
|
+
t.string(:parent_file_model_type)
|
9
|
+
|
10
|
+
t.string(:state)
|
11
|
+
t.string(:rights)
|
12
|
+
|
13
|
+
t.string(:attachment_on_filesystem_file_name)
|
14
|
+
t.string(:attachment_on_filesystem_content_type)
|
15
|
+
t.integer(:attachment_on_filesystem_file_size, limit: 8)
|
16
|
+
t.datetime(:attachment_on_filesystem_updated_at)
|
17
|
+
|
18
|
+
t.string(:attachment_on_s3_file_name)
|
19
|
+
t.string(:attachment_on_s3_content_type)
|
20
|
+
t.integer(:attachment_on_s3_file_size, limit: 8)
|
21
|
+
t.datetime(:attachment_on_s3_updated_at)
|
22
|
+
|
23
|
+
t.timestamps
|
24
|
+
|
25
|
+
t.string :custom
|
5
26
|
end
|
6
27
|
end
|
7
28
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Pageflow
|
2
|
+
# This helper allows to register a custom configure block that shall
|
3
|
+
# be executed in the context of a test. This is required when testing
|
4
|
+
# functionality that calls `Pageflow.config_for`, which builds up a
|
5
|
+
# new configuration object. Simply calling `Pageflow.configure` from
|
6
|
+
# inside a test does not work since there is no easy way to tear it
|
7
|
+
# down after the test.
|
8
|
+
#
|
9
|
+
# @since edge
|
10
|
+
module GlobalConfigApiTestHelper
|
11
|
+
mattr_accessor :custom_configure_block
|
12
|
+
|
13
|
+
# Call as part of test setup to add fixture configuration. Can be
|
14
|
+
# thought of as a test specific `Pageflow.configure`. Can only be
|
15
|
+
# used once per spec (including `before` blocks etc.)
|
16
|
+
#
|
17
|
+
# @example
|
18
|
+
#
|
19
|
+
# it 'works when the page type is registered'
|
20
|
+
# pageflow_configure do |config|
|
21
|
+
# config.page_types.register(Some.page_type)
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# # ...
|
25
|
+
# end
|
26
|
+
def pageflow_configure(&block)
|
27
|
+
GlobalConfigApiTestHelper.custom_configure_block = block
|
28
|
+
Pageflow.configure!
|
29
|
+
end
|
30
|
+
|
31
|
+
# Call from plugin test suite to make the `pageflow_configure`
|
32
|
+
# helper available and RSpec hooks to apply configuration changes.
|
33
|
+
def self.setup
|
34
|
+
return if @setup
|
35
|
+
@setup = true
|
36
|
+
|
37
|
+
RSpec.configure do |config|
|
38
|
+
config.include(GlobalConfigApiTestHelper)
|
39
|
+
|
40
|
+
config.before(:suite) do
|
41
|
+
Pageflow.configure do |pageflow_config|
|
42
|
+
GlobalConfigApiTestHelper.custom_configure_block&.call(pageflow_config)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
config.before do
|
47
|
+
GlobalConfigApiTestHelper.custom_configure_block = nil
|
48
|
+
Pageflow.configure!
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/pageflow/lint.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'pageflow/global_config_api_test_helper'
|
2
|
+
require 'pageflow/test_page_type'
|
3
|
+
|
4
|
+
module Pageflow
|
5
|
+
# Shared examples providing integration level specs for Pageflow
|
6
|
+
# components commonly defined by plugins.
|
7
|
+
#
|
8
|
+
# @since edge
|
9
|
+
module Lint
|
10
|
+
# Ensure file type json partials render correctly.
|
11
|
+
#
|
12
|
+
# @param name [String] File type name to use in spec descriptions
|
13
|
+
# @param create_file_type [#call] Proc creating the file type to test
|
14
|
+
# @param create_file [#call] Proc creating a fixture file of the
|
15
|
+
# file type
|
16
|
+
#
|
17
|
+
# @example
|
18
|
+
#
|
19
|
+
# require 'spec_helper'
|
20
|
+
# require 'pageflow/lint'
|
21
|
+
#
|
22
|
+
# module SomePlugin
|
23
|
+
# Pageflow::Lint.file_type('some file type',
|
24
|
+
# create_file_type: -> { SomePlugin.file_type },
|
25
|
+
# create_file: -> { create(:some_file) })
|
26
|
+
# end
|
27
|
+
def self.file_type(name, create_file_type:, create_file:)
|
28
|
+
GlobalConfigApiTestHelper.setup
|
29
|
+
|
30
|
+
RSpec.describe "file type #{name}", type: :helper do
|
31
|
+
let(:file_type, &create_file_type)
|
32
|
+
|
33
|
+
let(:file, &create_file)
|
34
|
+
|
35
|
+
before do
|
36
|
+
pageflow_configure do |config|
|
37
|
+
page_type = TestPageType.new(name: :test,
|
38
|
+
file_types: [file_type])
|
39
|
+
config.page_types.clear
|
40
|
+
config.page_types.register(page_type)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'renders seed json without error' do
|
45
|
+
expect {
|
46
|
+
helper.extend(FilesHelper)
|
47
|
+
helper.render(partial: 'pageflow/files/file',
|
48
|
+
formats: [:json],
|
49
|
+
locals: {
|
50
|
+
file: UsedFile.new(file, FileUsage.new),
|
51
|
+
file_type: file_type
|
52
|
+
})
|
53
|
+
}.not_to raise_error
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'renders editor json without error' do
|
57
|
+
helper.extend(FilesHelper)
|
58
|
+
helper.render(partial: 'pageflow/editor/files/file',
|
59
|
+
formats: [:json],
|
60
|
+
locals: {
|
61
|
+
file: UsedFile.new(file, FileUsage.new),
|
62
|
+
file_type: file_type
|
63
|
+
})
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'provides css_background_image_urls that returns hash if present' do
|
67
|
+
if file_type.css_background_image_urls
|
68
|
+
result = file_type.css_background_image_urls.call(file)
|
69
|
+
|
70
|
+
expect(result).to be_a(Hash)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pageflow-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 13.0.0.
|
4
|
+
version: 13.0.0.beta7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Codevise Solutions Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pageflow
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 13.0.0.
|
19
|
+
version: 13.0.0.beta7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 13.0.0.
|
26
|
+
version: 13.0.0.beta7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mysql2
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -187,8 +187,11 @@ files:
|
|
187
187
|
- pageflow/dummy/templates/database.yml
|
188
188
|
- pageflow/dummy/templates/test_theme.scss
|
189
189
|
- pageflow/dummy/templates/test_theme_preview.png
|
190
|
+
- pageflow/global_config_api_test_helper.rb
|
191
|
+
- pageflow/lint.rb
|
190
192
|
- pageflow/rails_version.rb
|
191
193
|
- pageflow/support.rb
|
194
|
+
- pageflow/test_page_type.rb
|
192
195
|
homepage: https://pageflow.io
|
193
196
|
licenses: []
|
194
197
|
metadata: {}
|