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
@@ -1,172 +0,0 @@
1
- # Encoding: UTF-8
2
- require "spec_helper"
3
-
4
- module Refinery
5
- module Admin
6
- describe "Resources", :type => :feature do
7
- refinery_login
8
-
9
- context "when no files" do
10
- it "invites to upload file" do
11
- visit refinery.admin_resources_path
12
- expect(page).to have_content(%q{There are no files yet. Click "Upload new file" to add your first file.})
13
- end
14
- end
15
-
16
- it "shows upload file link" do
17
- visit refinery.admin_resources_path
18
- expect(page).to have_content("Upload new file")
19
- expect(page).to have_selector("a[href*='/refinery/resources/new']")
20
- end
21
-
22
- context "new/create" do
23
- it "uploads file", :js => true do
24
- visit refinery.admin_resources_path
25
- find('a', text: 'Upload new file').trigger(:click)
26
-
27
- expect(page).to have_selector 'iframe#dialog_iframe'
28
-
29
- page.within_frame('dialog_iframe') do
30
- attach_file "resource_file", Refinery.roots('refinery/resources').
31
- join("spec/fixtures/refinery_is_awesome.txt")
32
- click_button ::I18n.t('save', :scope => 'refinery.admin.form_actions')
33
- end
34
-
35
- expect(page).to have_content("Refinery Is Awesome")
36
- expect(Refinery::Resource.count).to eq(1)
37
- end
38
-
39
- describe "max file size" do
40
- before do
41
- allow(Refinery::Resources).to receive(:max_file_size).and_return('1224')
42
- end
43
-
44
- context "in english" do
45
- before do
46
- allow(Refinery::I18n).to receive(:current_locale).and_return(:en)
47
- end
48
-
49
- it "is shown" do
50
- visit refinery.admin_resources_path
51
- click_link "Upload new file"
52
-
53
- within('#file') do
54
- expect(page).to have_selector("a[tooltip='The maximum file size is 1.2 KB.']")
55
- end
56
- end
57
- end
58
-
59
- context "in danish" do
60
- before do
61
- allow(Refinery::I18n).to receive(:current_locale).and_return(:da)
62
- end
63
-
64
- it "is shown" do
65
- visit refinery.admin_resources_path
66
-
67
- click_link "Tilføj en ny fil"
68
- within "#file" do
69
- expect(page).to have_selector("a[tooltip='Filen må maksimalt fylde 1,2 KB.']")
70
- end
71
- end
72
- end
73
- end
74
- end
75
-
76
- context "edit/update" do
77
- let!(:resource) { FactoryBot.create(:resource) }
78
-
79
- it "updates file" do
80
- visit refinery.admin_resources_path
81
- expect(page).to have_content("Refinery Is Awesome")
82
- expect(page).to have_selector("a[href='/refinery/resources/#{resource.id}/edit']")
83
-
84
- click_link "Edit this file"
85
-
86
- expect(page).to have_content("Refinery Is Awesome or replace it with this one...")
87
- expect(page).to have_selector("a[href*='/refinery/resources']")
88
-
89
- attach_file "resource_file", Refinery.roots('refinery/resources').join("spec/fixtures/refinery_is_awesome2.txt")
90
- click_button "Save"
91
-
92
- expect(page).to have_content("Refinery Is Awesome2")
93
- expect(Refinery::Resource.count).to eq(1)
94
- end
95
-
96
- describe "translate" do
97
- before do
98
- allow(Refinery::I18n).to receive(:frontend_locales).and_return([:en, :fr])
99
- end
100
-
101
- it "can have a second locale added to it" do
102
- visit refinery.admin_resources_path
103
- expect(page).to have_content("Refinery Is Awesome")
104
- expect(page).to have_selector("a[href='/refinery/resources/#{resource.id}/edit']")
105
-
106
- click_link "Edit this file"
107
-
108
- within "#switch_locale_picker" do
109
- click_link "FR"
110
- end
111
-
112
- fill_in "Title", :with => "Premier fichier"
113
- click_button "Save"
114
-
115
- expect(page).to have_content("'Premier fichier' was successfully updated.")
116
- expect(Resource.translation_class.count).to eq(1)
117
- end
118
- end
119
- end
120
-
121
- context "destroy" do
122
- let!(:resource) { FactoryBot.create(:resource) }
123
-
124
- it "removes file" do
125
- visit refinery.admin_resources_path
126
- expect(page).to have_selector("a[href='/refinery/resources/#{resource.id}']")
127
-
128
- click_link "Remove this file forever"
129
-
130
- expect(page).to have_content("'Refinery Is Awesome' was successfully removed.")
131
- expect(Refinery::Resource.count).to eq(0)
132
- end
133
- end
134
-
135
- context "download" do
136
- let!(:resource) { FactoryBot.create(:resource) }
137
-
138
- it "succeeds" do
139
- visit refinery.admin_resources_path
140
-
141
- click_link "Download this file"
142
-
143
- expect(page).to have_content("http://www.refineryhq.com/")
144
- end
145
-
146
- context 'when the extension is mounted with a named space' do
147
- before do
148
- Rails.application.routes.draw do
149
- mount Refinery::Core::Engine, :at => "/about"
150
- end
151
- Rails.application.routes_reloader.reload!
152
- end
153
-
154
- after do
155
- Rails.application.routes.draw do
156
- mount Refinery::Core::Engine, :at => "/"
157
- end
158
- end
159
-
160
- it "succeeds" do
161
- visit refinery.admin_resources_path
162
-
163
- click_link "Download this file"
164
-
165
- expect(page).to have_content("http://www.refineryhq.com/")
166
- end
167
-
168
- end
169
- end
170
- end
171
- end
172
- end
@@ -1 +0,0 @@
1
- http://www.refineryhq.com/
@@ -1 +0,0 @@
1
- http://refinerycms.com
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
@@ -1 +0,0 @@
1
- �N�jJ�����u{�J.V�ij�Ŷx��['���ʐ��;��}4m����w���ŠS[�7LƩ]ӱ^�������ײ`��v��k:-���p{: Dշ�T�W|�c�6d�