rails-uploader 0.5.7 → 0.5.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12397692cb77791fc651ff6ee848e3e9a376327eb531187a0bccb14d3208f18f
4
- data.tar.gz: 013dd49aaca77295f886e66c1b8fc5e2d3ed86af4b0c027a2d645532c8e9dae4
3
+ metadata.gz: bd3d3610d3f91d0664616a93f69f14e5d1493f7b7671722104b9b12ca75d9441
4
+ data.tar.gz: d84492649655991cd0f03e823fb910ce21cf4623bb8c6571b62195fbc0b6c028
5
5
  SHA512:
6
- metadata.gz: c3f7ff5f6530a221a1d91dc55fd231d6d78baa63d3b6511ec2ef5c5aff46c10b9e1ef5d4068d4d314bd422ae6919f209a54bb48c7d6eeca1186333ed9a293058
7
- data.tar.gz: f1d41d67e22055e0b6fe8cbb13fa86c9eabc4326c93b8ac53b86f03d88a9c6b62547d50813f3080280af66182708f68d5602a8bae2281856d8385e57dce4f753
6
+ metadata.gz: '0756498c5abb96d3b48f1fdb0f06c0e6b096d2b582953eaca8a7c5d7eb8acce0ac350716552f8b3067b4b963c192ee36455d87f7b7f5d0481ba8f877e593476f'
7
+ data.tar.gz: 387826cfcbae71415a4d139c77759ce79cf438867bd9870bc74168eaab31bc72445465b31c542f2051c14d8d5868f3fa36da995278faccd1dd43e33837e07968
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://travis-ci.org/superp/rails-uploader.svg?branch=master)](https://travis-ci.org/superp/rails-uploader)
1
+ [![Build Status](https://app.travis-ci.com/superp/rails-uploader.svg?branch=master)](https://app.travis-ci.com/superp/rails-uploader)
2
2
 
3
3
  # HTML5 File uploader for rails
4
4
 
@@ -21,7 +21,7 @@ mount Uploader::Engine => '/uploader'
21
21
  Migration for ActiveRecord:
22
22
 
23
23
  ```bash
24
- $ bundle exec rails g uploader:install
24
+ bundle exec rails g uploader:install
25
25
  ```
26
26
 
27
27
  ## Usage
@@ -286,6 +286,8 @@ That's it!
286
286
 
287
287
  ## Testing
288
288
 
289
- rspec ./spec/
289
+ ```
290
+ rspec ./spec/
291
+ ```
290
292
 
291
- Copyright (c) 2016 Fodojo LLC, released under the MIT license
293
+ Copyright (c) 2022 Fodojo LLC, released under the MIT license
@@ -76,7 +76,7 @@ module Uploader
76
76
  @input_html ||= { multiple: multiple?, class: 'uploader' }.merge(input_html_options)
77
77
  @input_html[:data] ||= {}
78
78
  @input_html[:data][:url] ||= attachments_path(singular: !multiple?)
79
- @input_html[:accept] ||= extract_extension_whitelist
79
+ @input_html[:accept] ||= extension_whitelist
80
80
  @input_html
81
81
  end
82
82
 
@@ -84,6 +84,12 @@ module Uploader
84
84
  @options.reject { |key, _value| RESERVED_OPTIONS_KEYS.include?(key.to_s) }
85
85
  end
86
86
 
87
+ def extension_whitelist
88
+ @extension_whitelist ||= extract_extension_whitelist
89
+ end
90
+
91
+ private
92
+
87
93
  def extract_extension_whitelist
88
94
  return unless klass.respond_to?(:uploaders)
89
95
  return unless klass.uploaders[:data].try(:const_defined?, :EXTENSION_WHITELIST)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uploader
4
- VERSION = '0.5.7'
4
+ VERSION = '0.5.8'
5
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Uploader::Fileuploads do
@@ -5,41 +7,41 @@ describe Uploader::Fileuploads do
5
7
  @picture = FactoryGirl.create(:picture, assetable_type: 'Article')
6
8
  end
7
9
 
8
- it "should be a Module" do
10
+ it 'should be a Module' do
9
11
  Uploader::Fileuploads.should be_a(Module)
10
12
  end
11
13
 
12
- context "instance methods" do
14
+ context 'instance methods' do
13
15
  before(:each) do
14
16
  @article = FactoryGirl.build(:article)
15
17
  end
16
18
 
17
- it "should return asset class" do
18
- @article.fileupload_klass("picture").should == Picture
19
+ it 'should return asset class' do
20
+ @article.fileupload_klass('picture').should == Picture
19
21
  end
20
22
 
21
- it "should find asset by guid" do
23
+ it 'should find asset by guid' do
22
24
  @picture.update_column(:guid, @article.fileupload_guid)
23
25
 
24
26
  asset = @article.fileupload_asset('picture')
25
27
  asset.should == @picture
26
28
  end
27
29
 
28
- it "should generate guid" do
30
+ it 'should generate guid' do
29
31
  @article.fileupload_guid.should_not be_blank
30
32
  end
31
33
 
32
- it "should change guid" do
33
- @article.fileupload_guid = "other guid"
34
- @article.fileupload_changed?.should be_true
35
- @article.fileupload_guid.should == "other guid"
34
+ it 'should change guid' do
35
+ @article.fileupload_guid = 'other guid'
36
+ @article.fileupload_changed?.should be_truthy
37
+ @article.fileupload_guid.should == 'other guid'
36
38
  end
37
39
 
38
- it "should not multiplay upload" do
39
- @article.fileupload_multiple?("picture").should be_false
40
+ it 'should not multiplay upload' do
41
+ @article.fileupload_multiple?('picture').should be_falsey
40
42
  end
41
43
 
42
- it "should find uploaded asset or build new record" do
44
+ it 'should find uploaded asset or build new record' do
43
45
  picture = @article.fileupload_asset(:picture)
44
46
  picture.should_not be_nil
45
47
  picture.should be_new_record
data/spec/mongoid_spec.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'mongoid'
3
5
 
@@ -33,7 +35,7 @@ describe Uploader::Asset do
33
35
  asset.should == @picture
34
36
  end
35
37
 
36
- it "should update asset target_id by guid" do
38
+ it 'should update asset target_id by guid' do
37
39
  @article.save
38
40
 
39
41
  @picture.reload
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Configure Rails Envinronment
2
4
  ENV['RAILS_ENV'] = 'test'
3
5
 
@@ -1,17 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Uploader do
4
- it "should be a Module" do
6
+ it 'should be a Module' do
5
7
  Uploader.should be_a(Module)
6
8
  end
7
9
 
8
- it "should generate random string" do
10
+ it 'should generate random string' do
9
11
  value = Uploader.guid
10
12
  value.should_not be_blank
11
13
  value.size.should == 22
12
14
  end
13
15
 
14
- it "should find all precompile assets" do
16
+ it 'should find all precompile assets' do
15
17
  Uploader.assets.should_not be_nil
16
18
  Uploader.assets.should include('uploader/jquery.fileupload.js')
17
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-uploader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Galeta
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-03-28 00:00:00.000000000 Z
12
+ date: 2022-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: carrierwave