carrierwave-dropbox 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2ca8dc58cbc02e2c7c1a98eed41c49ed45699b0
4
- data.tar.gz: 550df72f35dce48e4d39eb32d368f502968fcdeb
3
+ metadata.gz: 036f4a9a7dee7e258052fa335167e80a85a0855c
4
+ data.tar.gz: 773fa1295c62c022ae859947f2dcff55177ddc31
5
5
  SHA512:
6
- metadata.gz: ea3d13fe24390bab8c55344013277dfa0a08a141bfd1ab9d8b30277532036d42da685b3f48bd5dc37565f59dbc241a4b6bde876019a0414242be82fd3ae11551
7
- data.tar.gz: 499f42b826128d0e6f1b849a5991b76fae97765ef3a3da01cb32b4d6dcc3d682613f74f7cc6c0fa64975c41c6bd3b2ca998f70eddd4e839829b246942abf978a
6
+ metadata.gz: 69c72ce968ebeb2a17b8f63106b79cc4a1ca92195ada41b1f6e299bffb7f2b1da57830d2f0f3dd46acd9fb8f099275078d6afe55899d22210d8e70da4ec6dc12
7
+ data.tar.gz: 2e19393057e6ce5a609198c2c2ef42715ac4834d8b7a8692c5b4fed7b072f015d0cea927b88b51edab0390b194428132eb06b8798143e8b2d32464d89837da22
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## 1.0.1 (August 2, 2013)
4
+
5
+ * Ensure resource edition works
6
+
7
+ ## 1.0.0 (August 2, 2013)
8
+
9
+ * First release
@@ -1,5 +1,5 @@
1
1
  module CarrierWave
2
2
  module Dropbox
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -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
- before(:each) do
2
+
3
+ scenario "Uploading a simple file then edit it" do
3
4
  Article.delete_all
4
- end
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
- image_path = Article.last.image.url
22
- thumb_path = Article.last.image.url(:thumbnail)
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.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