refinerycms-resources 4.0.3 → 4.1.0

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/refinery/admin/resources_controller.rb +17 -9
  3. data/app/helpers/refinery/admin/resource_helper.rb +10 -0
  4. data/app/models/refinery/resource.rb +17 -12
  5. data/app/views/refinery/admin/resources/_existing_resource.html.erb +21 -14
  6. data/app/views/refinery/admin/resources/_form.html.erb +2 -2
  7. data/app/views/refinery/admin/resources/_resource.html.erb +8 -26
  8. data/app/views/refinery/admin/resources/_resources.html.erb +2 -2
  9. data/config/locales/en.yml +3 -1
  10. data/config/locales/fr.yml +3 -1
  11. data/config/locales/sk.yml +5 -0
  12. data/db/migrate/20150430180959_add_translated_title_to_refinery_resources.rb +13 -7
  13. data/lib/generators/refinery/resources/templates/config/initializers/refinery/resources.rb.erb +3 -0
  14. data/lib/refinery/resources/configuration.rb +40 -4
  15. data/lib/refinery/resources/validators/file_size_validator.rb +3 -4
  16. data/lib/refinery/resources.rb +3 -3
  17. data/lib/refinerycms/resources.rb +1 -0
  18. data/refinerycms-resources.gemspec +13 -22
  19. data/spec/factories/resource.rb +4 -2
  20. data/spec/fixtures/cape-town-tide-table.pdf +0 -0
  21. data/spec/fixtures/cape-town-tide-table2.pdf +0 -0
  22. data/spec/fixtures/refinery_is_secure.html +1 -0
  23. data/spec/lib/refinery/resources/engine_spec.rb +12 -0
  24. data/spec/models/refinery/resource_spec.rb +80 -54
  25. data/spec/system/refinery/admin/resources_spec.rb +213 -0
  26. metadata +20 -119
  27. checksums.yaml.gz.sig +0 -0
  28. data/spec/features/refinery/admin/resources_spec.rb +0 -172
  29. data/spec/fixtures/refinery_is_awesome.txt +0 -1
  30. data/spec/fixtures/refinery_is_awesome2.txt +0 -1
  31. data.tar.gz.sig +0 -0
  32. metadata.gz.sig +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 541475b2762e29b98bed166abf3deaf928185554f3eab6e9d3df36978c3175d0
4
- data.tar.gz: f60700c0fd97507a48bbfd768f999da97b6072d403041b12051d5a1a8c36c54c
3
+ metadata.gz: a15e938be73aa108af03594c3bcb68b6f721eba9318fd1d44efa37a67446e3ab
4
+ data.tar.gz: 8095ff93237239effda4fd3de0d298f01dca2d32a382068a889c3a86050b0c05
5
5
  SHA512:
6
- metadata.gz: 0ea2919ec5fdb1657d80126ef6a1340c55569c4de4e6aa92ba5cb1c23ec1df8b3bd94140b7ca96cb9671ebd9d31fbff73e19628369b97500e920a91a61382367
7
- data.tar.gz: e40dfae8d11a177511f9045850156eb42341272e7cbd6e796aa8b34ef5935bfb527e8e94b3eb7217ee2ae74b5a9082450d6a72676b8073d8ddbd407be3240fbe
6
+ metadata.gz: bb84a2c3f1d6232edce4a6af69d71fd776bf13f3fdbd26939166fe7b9ba720cfe67dc20364fc12ff32726e9d6e60ed4ef4d06540ec79ef5b9c0afc96607d7da3
7
+ data.tar.gz: e9b084f83aa1000f58f042994890021fede450dc4e72962f2de71ec37fe190e20090b60bf998740338180bb11a1d6b0bbba1fdcfd695f750c48d305f9c5b2db1
@@ -1,9 +1,11 @@
1
1
  module Refinery
2
2
  module Admin
3
3
  class ResourcesController < ::Refinery::AdminController
4
+ helper Refinery::Admin::ResourceHelper
4
5
 
5
6
  crudify :'refinery/resource',
6
7
  include: [:translations],
8
+ exclude_from_find: :show,
7
9
  order: "updated_at DESC",
8
10
  sortable: false
9
11
 
@@ -44,8 +46,7 @@ module Refinery
44
46
 
45
47
  def insert
46
48
  self.new if @resource.nil?
47
-
48
- @url_override = refinery.admin_resources_path(request.query_parameters.merge(:insert => true))
49
+ @url_override = refinery.admin_resources_path(request.query_parameters.merge(insert: true))
49
50
 
50
51
  if params[:conditions].present?
51
52
  extra_condition = params[:conditions].split(',')
@@ -53,11 +54,20 @@ module Refinery
53
54
  extra_condition[1] = true if extra_condition[1] == "true"
54
55
  extra_condition[1] = false if extra_condition[1] == "false"
55
56
  extra_condition[1] = nil if extra_condition[1] == "nil"
56
- paginate_resources({extra_condition[0] => extra_condition[1]})
57
+ end
58
+
59
+ find_all_resources(({extra_condition[0] => extra_condition[1]} if extra_condition.present?))
60
+ search_all_resources if searching?
61
+
62
+ paginate_resources
63
+
64
+ @resource_area_selected = from_dialog?
65
+
66
+ if params[:visual_editor]
67
+ render '/refinery/admin/pages_dialogs/link_to'
57
68
  else
58
- paginate_resources
69
+ render 'insert'
59
70
  end
60
- render 'insert'
61
71
  end
62
72
 
63
73
  protected
@@ -77,10 +87,8 @@ module Refinery
77
87
  super unless action_name == 'insert'
78
88
  end
79
89
 
80
- def paginate_resources(conditions = {})
81
- @resources = Resource.where(conditions).
82
- paginate(:page => params[:page], :per_page => Resource.per_page(from_dialog?)).
83
- order('created_at DESC')
90
+ def paginate_resources
91
+ @resources = @resources.paginate(page: params[:page], per_page: Resource.per_page(from_dialog?))
84
92
  end
85
93
 
86
94
  def resource_params
@@ -0,0 +1,10 @@
1
+ module Refinery
2
+ module Admin
3
+ module ResourceHelper
4
+
5
+ def resource_meta_information(resource)
6
+ tag.span number_to_human_size(resource.size), class: [:label, :meta]
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,21 +1,26 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dragonfly'
2
4
 
3
5
  module Refinery
4
6
  class Resource < Refinery::Core::BaseModel
5
7
  include Resources::Validators
6
8
 
9
+ extend Mobility
7
10
  translates :resource_title
8
11
 
9
- attribute :resource_title
10
-
11
- dragonfly_accessor :file, :app => :refinery_resources
12
+ dragonfly_accessor :file, app: :refinery_resources
12
13
 
13
- validates :file, :presence => true
14
+ validates :file, presence: true
14
15
  validates_with FileSizeValidator
16
+ validates_property :mime_type,
17
+ of: :file,
18
+ in: ::Refinery::Resources.whitelisted_mime_types,
19
+ message: :incorrect_format
15
20
 
16
- delegate :ext, :size, :mime_type, :url, :to => :file
21
+ delegate :ext, :size, :mime_type, :url, to: :file
17
22
 
18
- before_destroy :cached_mime_type, :prepend => true
23
+ before_destroy :cached_mime_type, prepend: true
19
24
 
20
25
  def cached_mime_type
21
26
  @cached_mime_type ||= mime_type
@@ -23,18 +28,18 @@ module Refinery
23
28
 
24
29
  # used for searching
25
30
  def type_of_content
26
- cached_mime_type.split("/").join(" ")
31
+ cached_mime_type.split('/').join(' ')
27
32
  end
28
33
 
29
34
  # Returns a titleized version of the filename
30
35
  # my_file.pdf returns My File
31
36
  def title
32
- resource_title.presence || CGI::unescape(file_name.to_s).gsub(/\.\w+$/, '').titleize
37
+ resource_title.presence || CGI.unescape(file_name.to_s).gsub(/\.\w+$/, '').titleize
33
38
  end
34
39
 
35
40
  def update_index
36
- return if self.aai_config.disable_auto_indexing
37
- copy = self.dup.tap{ |r| r.file_uid = r.file_uid_was}
41
+ return if aai_config.disable_auto_indexing
42
+ copy = dup.tap { |r| r.file_uid = r.file_uid_was }
38
43
  self.class.index_remove(copy)
39
44
  self.class.index_add(self)
40
45
  end
@@ -48,9 +53,9 @@ module Refinery
48
53
  def create_resources(params)
49
54
  resources = []
50
55
 
51
- if params.present? and params[:file].is_a?(Array)
56
+ if params.present? && params[:file].is_a?(Array)
52
57
  params[:file].each do |resource|
53
- resources << create({:file => resource}.merge(params.except(:file).to_h))
58
+ resources << create({ file: resource }.merge(params.except(:file).to_h))
54
59
  end
55
60
  else
56
61
  resources << create(params)
@@ -1,20 +1,27 @@
1
1
  <div id="existing_resource_area" class="dialog_area" <%= 'style="display:none;"'.html_safe if @resource.errors.any? %>>
2
+ <%= render '/refinery/admin/search', url: refinery.insert_admin_resources_path(params.to_unsafe_h.dup.except('resource')) %>
3
+
2
4
  <input type="hidden" name="linked_resource" id="linked_resource" />
5
+
3
6
  <div id="existing_resource_area_content" class="clearfix">
4
- <div id="pages_list" class="pages_list">
5
- <ul class="link_list">
6
- <% @resources.each do |resource| -%>
7
- <% resource_linked = ((@resource_id.present? && @resource_id == resource.id) || (params[:current_link].present? && resource.url == params[:current_link])) %>
8
- <li<%= ' class="linked"'.html_safe if resource_linked %>>
9
- <%= link_to "#{resource.title} (#{resource.file_name})", path_to_asset(resource.url),
10
- :title => t('.link_to_file'),
11
- :rel => resource.title,
12
- :class => 'page_link',
13
- :id => "resource_#{resource.id}" %>
14
- </li>
15
- <% end %>
16
- </ul>
17
- </div>
7
+ <% if @resources.any? %>
8
+ <div id="pages_list" class="pages_list">
9
+ <ul class="link_list">
10
+ <% @resources.each do |resource| -%>
11
+ <% resource_linked = ((@resource_id.present? && @resource_id == resource.id) || (params[:current_link].present? && resource.url == params[:current_link])) %>
12
+ <li<%= ' class="linked"'.html_safe if resource_linked %>>
13
+ <%= link_to "#{resource.title} (#{resource.file_name})", path_to_asset(resource.url),
14
+ :title => t('.link_to_file'),
15
+ :rel => resource.title,
16
+ :class => 'page_link',
17
+ :id => "resource_#{resource.id}" %>
18
+ </li>
19
+ <% end %>
20
+ </ul>
21
+ </div>
22
+ <% elsif searching? %>
23
+ <%= t('no_results', scope: 'refinery.admin.search') %>
24
+ <% end %>
18
25
  </div>
19
26
 
20
27
  <%= will_paginate @resources, :params => params.dup.merge(:action => "insert") %>
@@ -6,7 +6,7 @@
6
6
  :object => @resource,
7
7
  :include_object_name => false %>
8
8
 
9
- <%= render '/refinery/admin/locale_picker', :current_locale => Globalize.locale if @resource.persisted? %>
9
+ <%= render '/refinery/admin/locale_picker', :current_locale => Mobility.locale if @resource.persisted? %>
10
10
 
11
11
  <div class="field" id="file">
12
12
  <span class='label_with_help'>
@@ -57,4 +57,4 @@
57
57
  link_dialog.init();
58
58
  });
59
59
  </script>
60
- <% end if from_dialog? %>
60
+ <% end if from_dialog? %>
@@ -1,33 +1,15 @@
1
1
  <%
2
+ # setup params for various action links
2
3
  edit_url = refinery.edit_admin_resource_path(resource)
3
4
  delete_url = refinery.admin_resource_path(resource)
4
- delete_options = {data: {confirm: t('message', scope: 'refinery.admin.delete', title: resource.title)}}
5
+ delete_options = {data: {confirm: t('message', scope: 'refinery.admin.delete', title: translated_field(resource, :title))}}
6
+ translated_locales = locales_with_translated_field(resource, 'resource_title')
5
7
  %>
6
- <li class="clearfix record <%= cycle('on', 'on-hover') %>">
7
-
8
- <span class="title <%= resource.ext.try(:downcase) %>">
9
- <%= translated_field(resource, :title) %>
10
- </span>
11
-
12
- <% if Refinery::I18n.frontend_locales.many? %>
13
- <span class='locales'>
14
- <% resource.translations.sort_by{ |t| Refinery::I18n.frontend_locales.index(t.locale)}.each do |translation| %>
15
- <% if translation.resource_title.present? %>
16
- <%= link_to refinery.edit_admin_resource_path(resource, switch_locale: translation.locale),
17
- class: 'locale', title: translation.locale.upcase do %>
18
-
19
- <div class="<%=translation.locale %> locale_marker">
20
- <%= locale_text_icon(translation.locale.upcase) %>
21
- </div>
22
- <% end %>
23
- <% end %>
24
- <% end %>
25
- </span>
26
- <% end %>
27
-
28
- <span class="preview">
29
- <%= resource.file_name %> - <%= number_to_human_size(resource.size) %>
30
- </span>
8
+ <li class="record resource item <%= cycle('on', 'on-hover') %>">
9
+ <%= mime_type_icon(resource.mime_type) %>
10
+ <%= link_to translated_field(resource, :title), edit_url, class: [:title, :edit] %>
11
+ <%= resource_meta_information resource %>
12
+ <%= edit_in_locales(edit_url, translated_locales) %>
31
13
 
32
14
  <span class="actions">
33
15
  <%= action_icon :download, resource.url, t('.download', size: number_to_human_size(resource.size)) %>
@@ -1,7 +1,7 @@
1
1
  <%= will_paginate @resources if Refinery::Admin::ResourcesController.pageable? %>
2
2
  <div class="<%= ['clearfix', 'pagination_frame', pagination_css_class].compact.join(' ') %>">
3
- <% group_by_date(@resources).each do |container|
4
- date = Date.parse((resource_group = container.last).first.created_at.to_s) %>
3
+ <% group_by_date(@resources, :updated_at).each do |container|
4
+ date = Date.parse((resource_group = container.last).first.updated_at.to_s) %>
5
5
  <h3><%= l(date, :format => :long ) %></h3>
6
6
  <ul>
7
7
  <%= render :partial => 'resource', :collection => resource_group %>
@@ -36,4 +36,6 @@ en:
36
36
  models:
37
37
  refinery/resource:
38
38
  blank: You must specify file for upload
39
- too_big: File should be smaller than %{size} bytes in size
39
+ incorrect_format: "File type is not allowed. Your file must be a MP4, MPEG, WMV, AVI, WAV,
40
+ GIF, JPEG, PNG, SVG, TIFF, PSD, CSV, PDF, TXT, RAR, ZIP, XLS, PPT or a DOC"
41
+ too_big: File should be smaller than %{size} bytes in size
@@ -36,4 +36,6 @@ fr:
36
36
  models:
37
37
  refinery/resource:
38
38
  blank: Vous devez spécifier un fichier à télécharger
39
- too_big: Le poids maximal des fichiers est de %{size} megaoctets
39
+ incorrect_format: "Type de fichier non autorisé. Votre fichier doit être un MP4, MPEG, WMV, AVI, WAV,
40
+ GIF, JPEG, PNG, SVG, TIFF, PSD, CSV, PDF, TXT, RAR, ZIP, XLS, PPT ou un DOC"
41
+ too_big: Le poids maximal des fichiers est de %{size} megaoctets
@@ -13,6 +13,9 @@ sk:
13
13
  or: alebo
14
14
  replace: " nahradiť týmto..."
15
15
  maximum_file_size: Maximálna veľkosť súboru je %{bytes}.
16
+ resource_file: Súbor
17
+ resource_title: Názov
18
+ resource_title_help: Názov zobrazený návštevníkom stránky
16
19
  resource:
17
20
  download: Stiahnuť súbor (%{size})
18
21
  actions:
@@ -33,4 +36,6 @@ sk:
33
36
  models:
34
37
  refinery/resource:
35
38
  blank: Musíte vybrať súbor pre nahranie.
39
+ incorrect_format: "Typ súboru nie je povolený. Váš súbor musí byť typu MP4, MPEG, WMV, AVI, WAV,
40
+ GIF, JPEG, PNG, SVG, TIFF, PSD, CSV, PDF, TXT, RAR, ZIP, XLS, PPT alebo DOC"
36
41
  too_big: Maximálna veľkosť súboru je %{size} MB.
@@ -1,11 +1,17 @@
1
1
  class AddTranslatedTitleToRefineryResources < ActiveRecord::Migration[4.2]
2
- def self.up
3
- Refinery::Resource.create_translation_table!({
4
- resource_title: :string
5
- })
6
- end
2
+ def change
3
+ create_table :refinery_resource_translations do |t|
4
+
5
+ # Translated attribute(s)
6
+ t.string :resource_title
7
+
8
+ t.string :locale, null: false
9
+ t.integer :refinery_resource_id, null: false
10
+
11
+ t.timestamps null: false
12
+ end
7
13
 
8
- def self.down
9
- Refinery::Resource.drop_translation_table!
14
+ add_index :refinery_resource_translations, :locale, name: :index_refinery_resource_translations_on_locale
15
+ add_index :refinery_resource_translations, [:refinery_resource_id, :locale], name: :index_35a57b749803d8437ea64c64da3fb2cb0fbf457a, unique: true
10
16
  end
11
17
  end
@@ -9,6 +9,9 @@ Refinery::Resources.configure do |config|
9
9
  # Configure how many resources per page should be displayed in the list of resources in the admin area
10
10
  # config.pages_per_admin_index = <%= Refinery::Resources.pages_per_admin_index.inspect %>
11
11
 
12
+ # Configure allowed mime types for validation
13
+ # config.whitelisted_mime_types = <%= Refinery::Resources.whitelisted_mime_types.inspect %>
14
+
12
15
  # Configure Dragonfly.
13
16
  # Refer to config/initializers/refinery/dragonfly.rb for the full list of dragonfly configurations which can be used.
14
17
  # This includes all dragonfly config for Dragonfly v 1.1.1
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Refinery
2
4
  module Resources
3
-
4
5
  extend Refinery::Dragonfly::ExtensionConfiguration
5
6
  include ActiveSupport::Configurable
6
7
 
7
- config_accessor :max_file_size, :pages_per_dialog, :pages_per_admin_index, :content_disposition
8
+ config_accessor :max_file_size, :pages_per_dialog, :pages_per_admin_index,
9
+ :content_disposition, :whitelisted_mime_types
8
10
 
9
11
  self.content_disposition = :attachment
10
12
  self.max_file_size = 52_428_800
@@ -13,6 +15,40 @@ module Refinery
13
15
 
14
16
  self.dragonfly_name = :refinery_resources
15
17
 
16
- end
17
- end
18
+ self.whitelisted_mime_types = %w[
19
+ audio/mp4
20
+ audio/mpeg
21
+ audio/wav
22
+ audio/x-wav
23
+
24
+ image/gif
25
+ image/jpeg
26
+ image/png
27
+ image/svg+xml
28
+ image/tiff
29
+ image/x-psd
30
+
31
+ video/mp4
32
+ video/mpeg
33
+ video/quicktime
34
+ video/x-msvideo
35
+ video/x-ms-wmv
18
36
 
37
+ text/csv
38
+ text/plain
39
+
40
+ application/pdf
41
+ application/rtf
42
+ application/x-rar
43
+ application/zip
44
+
45
+ application/vnd.ms-excel
46
+ application/vnd.ms-powerpoint
47
+ application/vnd.msword
48
+
49
+ application/vnd.openxmlformats-officedocument.presentationml.presentation
50
+ application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
51
+ application/vnd.openxmlformats-officedocument.wordprocessingml.document
52
+ ]
53
+ end
54
+ end
@@ -7,12 +7,11 @@ module Refinery
7
7
  file = record.file
8
8
 
9
9
  if file.respond_to?(:length) && file.length > Resources.max_file_size
10
- record.errors[:file] << ::I18n.t('too_big',
11
- :scope => 'activerecord.errors.models.refinery/resource',
12
- :size => Resources.max_file_size)
10
+ record.errors.add :file, ::I18n.t('too_big',
11
+ scope: 'activerecord.errors.models.refinery/resource',
12
+ size: Resources.max_file_size)
13
13
  end
14
14
  end
15
-
16
15
  end
17
16
  end
18
17
  end
@@ -1,5 +1,5 @@
1
- require 'refinerycms-core'
2
- require 'refinerycms-dragonfly'
1
+ require 'refinerycms/core'
2
+ require 'refinerycms/dragonfly'
3
3
 
4
4
  module Refinery
5
5
  autoload :ResourcesGenerator, 'generators/refinery/resources/resources_generator'
@@ -24,5 +24,5 @@ module Refinery
24
24
  end
25
25
 
26
26
  ActiveSupport.on_load(:active_record) do
27
- require 'globalize'
27
+ require 'mobility'
28
28
  end
@@ -0,0 +1 @@
1
+ require_relative '../refinery/resources'
@@ -1,35 +1,26 @@
1
- # Encoding: UTF-8
2
- require File.expand_path('../../core/lib/refinery/version', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('../core/lib/refinery/version', __dir__)
3
4
 
4
5
  version = Refinery::Version.to_s
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.platform = Gem::Platform::RUBY
8
- s.name = %q{refinerycms-resources}
9
+ s.name = 'refinerycms-resources'
9
10
  s.version = version
10
- s.summary = %q{Resources extension for Refinery CMS}
11
- s.description = %q{Handles all file upload and processing functionality in Refinery CMS.}
12
- s.email = %q{refinerycms@p.arndt.io}
13
- s.homepage = %q{https://www.refinerycms.com}
14
- s.rubyforge_project = %q{refinerycms}
15
- s.authors = ['Philip Arndt', 'Uģis Ozols', 'Rob Yurkowski']
16
- s.license = %q{MIT}
17
- s.require_paths = %w(lib)
11
+ s.summary = 'Resources extension for Refinery CMS'
12
+ s.description = 'Handles all file upload and processing functionality in Refinery CMS.'
13
+ s.email = 'gems@p.arndt.io'
14
+ s.homepage = 'https://www.refinerycms.com'
15
+ s.authors = ['Philip Arndt', 'David Jones', 'Uģis Ozols', 'Brice Sanchez']
16
+ s.license = 'MIT'
17
+ s.require_paths = %w[lib]
18
18
 
19
19
  s.files = `git ls-files`.split("\n")
20
20
  s.test_files = `git ls-files -- spec/*`.split("\n")
21
21
 
22
- s.add_dependency 'acts_as_indexed', '~> 0.8.0'
23
- s.add_dependency 'dragonfly', '~> 1.1', '>= 1.1.0'
24
- s.add_dependency 'globalize', ['>= 5.1.0.beta1', '< 5.2']
25
- s.add_dependency 'activemodel-serializers-xml', '~> 1.0', '>= 1.0.1'
26
- s.add_dependency 'refinerycms-core', version
27
- s.add_dependency 'refinerycms-dragonfly', '~> 1.0'
22
+ s.add_dependency 'refinerycms-core', version
23
+ s.add_dependency 'refinerycms-dragonfly', '~> 1.0'
28
24
 
29
25
  s.required_ruby_version = Refinery::Version.required_ruby_version
30
-
31
- s.cert_chain = [File.expand_path("../../certs/parndt.pem", __FILE__)]
32
- if $0 =~ /gem\z/ && ARGV.include?("build") && ARGV.include?(__FILE__)
33
- s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem")
34
- end
35
26
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  FactoryBot.define do
2
- factory :resource, :class => Refinery::Resource do
3
- file Refinery.roots('refinery/resources').join("spec/fixtures/refinery_is_awesome.txt")
4
+ factory :resource, class: Refinery::Resource do
5
+ file { Refinery.roots('refinery/resources').join('spec/fixtures/cape-town-tide-table.pdf') }
4
6
  end
5
7
  end
@@ -0,0 +1 @@
1
+ https://www.refinerycms.com/
@@ -4,5 +4,17 @@ module Refinery
4
4
  describe Resources do
5
5
  it_has_behaviour 'Creates a dragonfly App:'
6
6
  it_has_behaviour 'adds the dragonfly app to the middleware stack'
7
+
8
+ it 'calls dragonfly#before_serve to set configuration' do
9
+ dummy_proc = -> (_job, _env) {}
10
+ expect_any_instance_of(::Dragonfly::Server).to(
11
+ receive(:before_serve) { |&block| expect(block).to be(dummy_proc) }
12
+ )
13
+ ::Refinery::Resources.configure do |config|
14
+ config.dragonfly_before_serve = dummy_proc
15
+ end
16
+
17
+ ::Refinery::Dragonfly.configure!(::Refinery::Resources)
18
+ end
7
19
  end
8
20
  end