carrierwave-dropbox 1.0.0 → 1.0.1
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/CHANGELOG.md +9 -0
- data/lib/carrierwave/dropbox/version.rb +1 -1
- data/lib/carrierwave/storage/dropbox.rb +8 -3
- data/spec/features/upload_file_spec.rb +22 -8
- data/spec/fixtures/rails.png +0 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 036f4a9a7dee7e258052fa335167e80a85a0855c
|
4
|
+
data.tar.gz: 773fa1295c62c022ae859947f2dcff55177ddc31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69c72ce968ebeb2a17b8f63106b79cc4a1ca92195ada41b1f6e299bffb7f2b1da57830d2f0f3dd46acd9fb8f099275078d6afe55899d22210d8e70da4ec6dc12
|
7
|
+
data.tar.gz: 2e19393057e6ce5a609198c2c2ef42715ac4834d8b7a8692c5b4fed7b072f015d0cea927b88b51edab0390b194428132eb06b8798143e8b2d32464d89837da22
|
data/CHANGELOG.md
ADDED
@@ -18,7 +18,7 @@ module CarrierWave
|
|
18
18
|
|
19
19
|
# Retrieve a single file
|
20
20
|
def retrieve!(file)
|
21
|
-
CarrierWave::Storage::Dropbox::File.new(uploader, config, uploader.store_path(file))
|
21
|
+
CarrierWave::Storage::Dropbox::File.new(uploader, config, uploader.store_path(file), dropbox_client)
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
@@ -48,14 +48,19 @@ module CarrierWave
|
|
48
48
|
include CarrierWave::Utilities::Uri
|
49
49
|
attr_reader :path
|
50
50
|
|
51
|
-
def initialize(uploader, config, path)
|
52
|
-
@uploader, @config, @path = uploader, config, path
|
51
|
+
def initialize(uploader, config, path, client)
|
52
|
+
@uploader, @config, @path, @client = uploader, config, path, client
|
53
53
|
end
|
54
54
|
|
55
55
|
def url
|
56
56
|
user_id, path = @config[:user_id], @path
|
57
57
|
"https://dl.dropboxusercontent.com/u/#{user_id}/#{path}"
|
58
58
|
end
|
59
|
+
|
60
|
+
def delete
|
61
|
+
path = "/Public/#{@path}" if @config[:access_type] == "dropbox"
|
62
|
+
@client.file_delete(path)
|
63
|
+
end
|
59
64
|
end
|
60
65
|
end
|
61
66
|
end
|
@@ -1,11 +1,10 @@
|
|
1
1
|
feature "Upload a file to Dropbox" do
|
2
|
-
|
2
|
+
|
3
|
+
scenario "Uploading a simple file then edit it" do
|
3
4
|
Article.delete_all
|
4
|
-
|
5
|
+
Article.count.should eq(0)
|
5
6
|
|
6
|
-
scenario "Uploading a simple file" do
|
7
7
|
visit "/articles/new"
|
8
|
-
Article.count.should eq(0)
|
9
8
|
|
10
9
|
within("form") do
|
11
10
|
fill_in "Title", with: "Hello world!"
|
@@ -18,15 +17,30 @@ feature "Upload a file to Dropbox" do
|
|
18
17
|
page.should have_content("Article was successfully created")
|
19
18
|
Article.count.should eq(1)
|
20
19
|
|
21
|
-
|
22
|
-
|
20
|
+
article = Article.last
|
21
|
+
|
22
|
+
image_path = article.image.url
|
23
|
+
thumb_path = article.image.url(:thumbnail)
|
23
24
|
|
24
25
|
visit image_path
|
25
26
|
image_path.should match(/foo/)
|
26
|
-
page.should have_css("img")
|
27
|
+
page.should have_css("img[src='#{image_path}']")
|
27
28
|
|
28
29
|
visit thumb_path
|
29
30
|
thumb_path.should match(/foo/)
|
30
|
-
page.should have_css("img")
|
31
|
+
page.should have_css("img[src='#{thumb_path}']")
|
32
|
+
|
33
|
+
visit "/articles/#{article.id}/edit"
|
34
|
+
|
35
|
+
within("form") do
|
36
|
+
attach_file "Image", File.expand_path('spec/fixtures/rails.png')
|
37
|
+
find("input[type='submit']").click
|
38
|
+
end
|
39
|
+
|
40
|
+
page.should have_content("Article was successfully updated")
|
41
|
+
new_image_path = Article.last.image.url
|
42
|
+
|
43
|
+
visit new_image_path
|
44
|
+
page.should have_css("img[src='#{new_image_path}']")
|
31
45
|
end
|
32
46
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave-dropbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robin Dupret
|
@@ -165,6 +165,7 @@ extra_rdoc_files: []
|
|
165
165
|
files:
|
166
166
|
- .gitignore
|
167
167
|
- .rspec
|
168
|
+
- CHANGELOG.md
|
168
169
|
- Gemfile
|
169
170
|
- LICENSE
|
170
171
|
- README.md
|
@@ -226,6 +227,7 @@ files:
|
|
226
227
|
- spec/dummy/public/favicon.ico
|
227
228
|
- spec/dummy/public/robots.txt
|
228
229
|
- spec/features/upload_file_spec.rb
|
230
|
+
- spec/fixtures/rails.png
|
229
231
|
- spec/fixtures/ruby.png
|
230
232
|
- spec/spec_helper.rb
|
231
233
|
homepage: https://github.com/robin850/carrierwave-dropbox
|
@@ -303,5 +305,6 @@ test_files:
|
|
303
305
|
- spec/dummy/public/favicon.ico
|
304
306
|
- spec/dummy/public/robots.txt
|
305
307
|
- spec/features/upload_file_spec.rb
|
308
|
+
- spec/fixtures/rails.png
|
306
309
|
- spec/fixtures/ruby.png
|
307
310
|
- spec/spec_helper.rb
|