s3_relay 0.6.2 → 0.7.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.
@@ -1,5 +1,5 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :product do
3
- name "Flux Capacitor"
3
+ name { "Flux Capacitor" }
4
4
  end
5
5
  end
@@ -1,23 +1,23 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :upload, class: "S3Relay::Upload" do
3
3
  uuid { SecureRandom.uuid }
4
4
  end
5
5
 
6
6
  factory :file_upload, parent: :upload do
7
- filename "cat.png"
8
- content_type "image/png"
9
- upload_type "FileUpload"
7
+ filename { "cat.png" }
8
+ content_type { "image/png" }
9
+ upload_type { "FileUpload" }
10
10
  end
11
11
 
12
12
  factory :icon_upload, parent: :upload do
13
- filename "cat.png"
14
- content_type "image/png"
15
- upload_type "IconUpload"
13
+ filename { "cat.png" }
14
+ content_type { "image/png" }
15
+ upload_type { "IconUpload" }
16
16
  end
17
17
 
18
18
  factory :photo_upload, parent: :upload do
19
- filename "cat.png"
20
- content_type "image/png"
21
- upload_type "PhotoUpload"
19
+ filename { "cat.png" }
20
+ content_type { "image/png" }
21
+ upload_type { "PhotoUpload" }
22
22
  end
23
23
  end
@@ -1,7 +1,10 @@
1
1
  require "test_helper"
2
2
 
3
+ include ActionView::Helpers::FormTagHelper
4
+ include S3Relay::UploadsHelper
5
+
3
6
  describe S3Relay::UploadsHelper do
4
- before { @product = FactoryGirl.create(:product) }
7
+ before { @product = FactoryBot.create(:product) }
5
8
 
6
9
  describe "#s3_relay_field" do
7
10
  describe "without options" do
@@ -2,19 +2,19 @@ require "test_helper"
2
2
 
3
3
  describe S3Relay::Model do
4
4
  before do
5
- @product = FactoryGirl.build(:product)
5
+ @product = FactoryBot.build(:product)
6
6
  end
7
7
 
8
8
  describe "#s3_relay" do
9
9
 
10
10
  describe "associations" do
11
11
  it "has_one" do
12
- Product.reflect_on_association(:icon_upload).macro
12
+ _(Product.reflect_on_association(:icon_upload).macro)
13
13
  .must_equal(:has_one)
14
14
  end
15
15
 
16
16
  it "has_many" do
17
- Product.reflect_on_association(:photo_uploads).macro
17
+ _(Product.reflect_on_association(:photo_uploads).macro)
18
18
  .must_equal(:has_many)
19
19
  end
20
20
  end
@@ -22,41 +22,41 @@ describe S3Relay::Model do
22
22
  describe "scopes" do
23
23
  before do
24
24
  @product.save
25
- @icon = FactoryGirl.create(:icon_upload, parent: @product)
26
- @photo_1 = FactoryGirl.create(:photo_upload, parent: @product)
27
- @photo_2 = FactoryGirl.create(:photo_upload, parent: @product)
25
+ @icon = FactoryBot.create(:icon_upload, parent: @product)
26
+ @photo_1 = FactoryBot.create(:photo_upload, parent: @product)
27
+ @photo_2 = FactoryBot.create(:photo_upload, parent: @product)
28
28
  end
29
29
 
30
30
  describe "has_one" do
31
- it { @product.icon_upload.must_equal @icon }
31
+ it { _(@product.icon_upload).must_equal @icon }
32
32
  end
33
33
 
34
34
  describe "has_many" do
35
35
  it do
36
- @product.photo_uploads.pluck(:id).sort
36
+ _(@product.photo_uploads.pluck(:id).sort)
37
37
  .must_equal [@photo_1.id, @photo_2.id]
38
38
  end
39
39
  end
40
40
  end
41
41
 
42
42
  describe "virtual attribute for UUID assignment" do
43
- it { @product.must_respond_to :new_photo_uploads_uuids= }
43
+ it { _(@product).must_respond_to :new_photo_uploads_uuids= }
44
44
  end
45
45
 
46
46
  describe "association method" do
47
47
  before do
48
- @product = FactoryGirl.create(:product)
49
- @icon = FactoryGirl.create(:icon_upload)
50
- @photo_1 = FactoryGirl.create(:photo_upload)
51
- @photo_2 = FactoryGirl.create(:photo_upload)
48
+ @product = FactoryBot.create(:product)
49
+ @icon = FactoryBot.create(:icon_upload)
50
+ @photo_1 = FactoryBot.create(:photo_upload)
51
+ @photo_2 = FactoryBot.create(:photo_upload)
52
52
  end
53
53
 
54
54
  describe "has_many" do
55
55
  it do
56
- @product.photo_uploads.must_equal []
56
+ _(@product.photo_uploads).must_equal []
57
57
  @product.new_photo_uploads_uuids = [@photo_1.uuid, @photo_2.uuid]
58
58
  @product.associate_photo_uploads
59
- @product.photo_uploads.must_equal [@photo_1, @photo_2]
59
+ _(@product.photo_uploads).must_equal [@photo_1, @photo_2]
60
60
  end
61
61
  end
62
62
  end
@@ -21,7 +21,7 @@ describe S3Relay::PrivateUrl do
21
21
  time = Time.parse("2014-01-01 12:00am")
22
22
  url = S3Relay::PrivateUrl.new(uuid, file, expires: time).generate
23
23
 
24
- url.must_equal "https://bucket.s3-region.amazonaws.com/123-456-789/Crazy%20%2B%20c@t%20picture.png?AWSAccessKeyId=access-key-id&Expires=1388563200&Signature=8Kp5NL77iycg4CFFwxboo905t%2Fs%3D"
24
+ _(url).must_equal "https://s3.region.amazonaws.com/bucket/123-456-789/Crazy%20%2B%20c@t%20picture.png?AWSAccessKeyId=access-key-id&Expires=1388563200&Signature=8Kp5NL77iycg4CFFwxboo905t%2Fs%3D"
25
25
  end
26
26
  end
27
27
 
@@ -23,15 +23,15 @@ describe S3Relay::UploadPresigner do
23
23
 
24
24
  data = S3Relay::UploadPresigner.new(expires: time).form_data
25
25
 
26
- data["awsaccesskeyid"].must_equal "access-key-id"
27
- data["x_amz_server_side_encryption"].must_equal "AES256"
28
- data["key"].must_equal "#{uuid}/${filename}"
29
- data["success_action_status"].must_equal "201"
30
- data["acl"].must_equal "acl"
31
- data["endpoint"].must_equal "https://bucket.s3-region.amazonaws.com"
32
- data["policy"].length.must_equal 400 # TODO: Improve this
33
- data["signature"].length.must_equal 28 # TODO: Improve this
34
- data["uuid"].must_equal uuid
26
+ _(data["awsaccesskeyid"]).must_equal "access-key-id"
27
+ _(data["x_amz_server_side_encryption"]).must_equal "AES256"
28
+ _(data["key"]).must_equal "#{uuid}/${filename}"
29
+ _(data["success_action_status"]).must_equal "201"
30
+ _(data["acl"]).must_equal "acl"
31
+ _(data["endpoint"]).must_equal "https://s3.region.amazonaws.com/bucket"
32
+ _(data["policy"].length).must_equal 400 # TODO: Improve this
33
+ _(data["signature"].length).must_equal 28 # TODO: Improve this
34
+ _(data["uuid"]).must_equal uuid
35
35
  end
36
36
  end
37
37
 
@@ -2,13 +2,13 @@ require "test_helper"
2
2
 
3
3
  describe S3Relay::Upload do
4
4
  before do
5
- @upload = FactoryGirl.build(:upload)
5
+ @upload = FactoryBot.build(:upload)
6
6
  end
7
7
 
8
8
  describe "associations" do
9
9
  describe "parent" do
10
10
  it do
11
- S3Relay::Upload.reflect_on_association(:parent).macro
11
+ _(S3Relay::Upload.reflect_on_association(:parent).macro)
12
12
  .must_equal :belongs_to
13
13
  end
14
14
  end
@@ -19,34 +19,34 @@ describe S3Relay::Upload do
19
19
  it "validates presence" do
20
20
  @upload.uuid = nil
21
21
  @upload.valid?
22
- @upload.errors[:uuid].must_include("can't be blank")
22
+ _(@upload.errors[:uuid]).must_include("can't be blank")
23
23
  end
24
24
 
25
25
  it "validates uniqueness" do
26
- FactoryGirl.create(:file_upload, uuid: @upload.uuid)
26
+ FactoryBot.create(:file_upload, uuid: @upload.uuid)
27
27
  @upload.valid?
28
- @upload.errors[:uuid].must_include("has already been taken")
28
+ _(@upload.errors[:uuid]).must_include("has already been taken")
29
29
  end
30
30
  end
31
31
 
32
32
  describe "upload_type" do
33
33
  it "validates presence" do
34
34
  @upload.valid?
35
- @upload.errors[:upload_type].must_include("can't be blank")
35
+ _(@upload.errors[:upload_type]).must_include("can't be blank")
36
36
  end
37
37
  end
38
38
 
39
39
  describe "filename" do
40
40
  it "validates presence" do
41
41
  @upload.valid?
42
- @upload.errors[:filename].must_include("can't be blank")
42
+ _(@upload.errors[:filename]).must_include("can't be blank")
43
43
  end
44
44
  end
45
45
 
46
46
  describe "content_type" do
47
47
  it "validates presence" do
48
48
  @upload.valid?
49
- @upload.errors[:content_type].must_include("can't be blank")
49
+ _(@upload.errors[:content_type]).must_include("can't be blank")
50
50
  end
51
51
  end
52
52
 
@@ -54,68 +54,68 @@ describe S3Relay::Upload do
54
54
  it "validates presence" do
55
55
  @upload.pending_at = nil
56
56
  @upload.valid?
57
- @upload.errors[:pending_at].must_include("can't be blank")
57
+ _(@upload.errors[:pending_at]).must_include("can't be blank")
58
58
  end
59
59
  end
60
60
  end
61
61
 
62
62
  describe "scopes" do
63
63
  before do
64
- @pending = FactoryGirl.build(:file_upload)
64
+ @pending = FactoryBot.build(:file_upload)
65
65
  .tap { |u| u.save(validate: false) }
66
- @imported = FactoryGirl.build(:upload, state: "imported")
66
+ @imported = FactoryBot.build(:upload, state: "imported")
67
67
  .tap { |u| u.save(validate: false) }
68
68
  end
69
69
 
70
70
  describe "pending" do
71
71
  it do
72
72
  results = S3Relay::Upload.pending.all
73
- results.must_include @pending
74
- results.wont_include @imported
73
+ _(results).must_include @pending
74
+ _(results).wont_include @imported
75
75
  end
76
76
  end
77
77
 
78
78
  describe "imported" do
79
79
  it do
80
80
  results = S3Relay::Upload.imported.all
81
- results.wont_include @pending
82
- results.must_include @imported
81
+ _(results).wont_include @pending
82
+ _(results).must_include @imported
83
83
  end
84
84
  end
85
85
  end
86
86
 
87
87
  describe "upon finalization" do
88
88
  it do
89
- @upload.state.must_equal "pending"
90
- @upload.pending_at.wont_equal nil
89
+ _(@upload.state).must_equal "pending"
90
+ _(@upload.pending_at).wont_equal nil
91
91
  end
92
92
  end
93
93
 
94
94
  describe "#pending?" do
95
- it { @upload.pending?.must_equal true }
95
+ it { _(@upload.pending?).must_equal true }
96
96
  end
97
97
 
98
98
  describe "#imported" do
99
99
  it do
100
100
  @upload.state = "imported"
101
- @upload.imported?.must_equal true
101
+ _(@upload.imported?).must_equal true
102
102
  end
103
103
  end
104
104
 
105
105
  describe "#mark_imported!" do
106
106
  it do
107
107
  @upload.mark_imported!
108
- @upload.state.must_equal "imported"
109
- @upload.imported_at.wont_equal nil
108
+ _(@upload.state).must_equal "imported"
109
+ _(@upload.imported_at).wont_equal nil
110
110
  end
111
111
  end
112
112
 
113
113
  describe "#notify_parent" do
114
- before { @upload = FactoryGirl.build(:file_upload) }
114
+ before { @upload = FactoryBot.build(:file_upload) }
115
115
 
116
116
  describe "when the parent is associated" do
117
117
  it do
118
- @product = FactoryGirl.create(:product)
118
+ @product = FactoryBot.create(:product)
119
119
  @upload.parent = @product
120
120
  @product.expects(:import_upload)
121
121
  @upload.save
@@ -135,7 +135,7 @@ describe S3Relay::Upload do
135
135
  S3Relay::PrivateUrl.expects(:new).with(uuid, filename).returns(klass)
136
136
  klass.expects(:generate).returns(url)
137
137
 
138
- @upload.private_url.must_equal url
138
+ _(@upload.private_url).must_equal url
139
139
  end
140
140
  end
141
141
 
@@ -1,4 +1,4 @@
1
- ENV["RAILS_ENV"] = "test"
1
+ ENV["RAILS_ENV"] ||= "test"
2
2
 
3
3
  IS_RAKE_TASK = (!! ($0 =~ /rake/))
4
4
 
@@ -14,16 +14,13 @@ if IS_RAKE_TASK
14
14
  end
15
15
  end
16
16
 
17
- ENV["RAILS_ENV"] = "test"
18
17
  require File.expand_path("../dummy/config/environment", __FILE__)
19
18
 
20
19
  Dir[File.join("./test/factories/*.rb")].sort.each { |f| require f }
21
20
 
22
- require "minitest/autorun"
23
21
  require "rails/generators"
24
22
  require "rails/test_help"
25
23
  require "minitest/rails"
26
- require "minitest/pride"
27
- require "mocha/mini_test"
24
+ require "mocha/minitest"
28
25
 
29
26
  Dir[File.join("./test/support/*.rb")].sort.each { |f| require f }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_relay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenny Johnston
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-24 00:00:00.000000000 Z
11
+ date: 2020-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-rails
@@ -30,128 +30,108 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '5.1'
33
+ version: '5.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '5.1'
40
+ version: '5.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: addressable
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 2.3.8
47
+ version: 2.5.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 2.3.8
55
- - !ruby/object:Gem::Dependency
56
- name: guard-minitest
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '2.4'
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: 2.4.6
65
- type: :development
66
- prerelease: false
67
- version_requirements: !ruby/object:Gem::Requirement
68
- requirements:
69
- - - "~>"
70
- - !ruby/object:Gem::Version
71
- version: '2.4'
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: 2.4.6
54
+ version: 2.5.2
75
55
  - !ruby/object:Gem::Dependency
76
56
  name: minitest-rails
77
57
  requirement: !ruby/object:Gem::Requirement
78
58
  requirements:
79
59
  - - "~>"
80
60
  - !ruby/object:Gem::Version
81
- version: 3.0.0
61
+ version: '5.2'
82
62
  - - ">="
83
63
  - !ruby/object:Gem::Version
84
- version: 3.0.0
64
+ version: 5.2.0
85
65
  type: :development
86
66
  prerelease: false
87
67
  version_requirements: !ruby/object:Gem::Requirement
88
68
  requirements:
89
69
  - - "~>"
90
70
  - !ruby/object:Gem::Version
91
- version: 3.0.0
71
+ version: '5.2'
92
72
  - - ">="
93
73
  - !ruby/object:Gem::Version
94
- version: 3.0.0
74
+ version: 5.2.0
95
75
  - !ruby/object:Gem::Dependency
96
76
  name: mocha
97
77
  requirement: !ruby/object:Gem::Requirement
98
78
  requirements:
99
79
  - - "~>"
100
80
  - !ruby/object:Gem::Version
101
- version: '1.2'
81
+ version: '1.11'
102
82
  - - ">="
103
83
  - !ruby/object:Gem::Version
104
- version: 1.2.1
84
+ version: 1.11.2
105
85
  type: :development
106
86
  prerelease: false
107
87
  version_requirements: !ruby/object:Gem::Requirement
108
88
  requirements:
109
89
  - - "~>"
110
90
  - !ruby/object:Gem::Version
111
- version: '1.2'
91
+ version: '1.11'
112
92
  - - ">="
113
93
  - !ruby/object:Gem::Version
114
- version: 1.2.1
94
+ version: 1.11.2
115
95
  - !ruby/object:Gem::Dependency
116
96
  name: pg
117
97
  requirement: !ruby/object:Gem::Requirement
118
98
  requirements:
119
99
  - - "~>"
120
100
  - !ruby/object:Gem::Version
121
- version: '0.21'
101
+ version: '1.2'
122
102
  - - ">="
123
103
  - !ruby/object:Gem::Version
124
- version: 0.21.0
104
+ version: 1.2.3
125
105
  type: :development
126
106
  prerelease: false
127
107
  version_requirements: !ruby/object:Gem::Requirement
128
108
  requirements:
129
109
  - - "~>"
130
110
  - !ruby/object:Gem::Version
131
- version: '0.21'
111
+ version: '1.2'
132
112
  - - ">="
133
113
  - !ruby/object:Gem::Version
134
- version: 0.21.0
114
+ version: 1.2.3
135
115
  - !ruby/object:Gem::Dependency
136
116
  name: simplecov
137
117
  requirement: !ruby/object:Gem::Requirement
138
118
  requirements:
139
119
  - - "~>"
140
120
  - !ruby/object:Gem::Version
141
- version: '0.14'
121
+ version: '0.20'
142
122
  - - ">="
143
123
  - !ruby/object:Gem::Version
144
- version: 0.14.1
124
+ version: 0.20.0
145
125
  type: :development
146
126
  prerelease: false
147
127
  version_requirements: !ruby/object:Gem::Requirement
148
128
  requirements:
149
129
  - - "~>"
150
130
  - !ruby/object:Gem::Version
151
- version: '0.14'
131
+ version: '0.20'
152
132
  - - ">="
153
133
  - !ruby/object:Gem::Version
154
- version: 0.14.1
134
+ version: 0.20.0
155
135
  - !ruby/object:Gem::Dependency
156
136
  name: thor
157
137
  requirement: !ruby/object:Gem::Requirement
@@ -166,9 +146,8 @@ dependencies:
166
146
  - - ">="
167
147
  - !ruby/object:Gem::Version
168
148
  version: '0'
169
- description: |-
170
- Enables direct file uploads to Amazon S3 and provides a flexible pattern for
171
- your Rails app to asynchronously ingest the files.
149
+ description: Enables direct file uploads to Amazon S3 and provides a flexible pattern
150
+ for your Rails app to asynchronously ingest the files.
172
151
  email:
173
152
  - kjohnston.ca@gmail.com
174
153
  executables: []
@@ -268,7 +247,7 @@ homepage: http://github.com/kjohnston/s3_relay
268
247
  licenses:
269
248
  - MIT
270
249
  metadata: {}
271
- post_install_message:
250
+ post_install_message:
272
251
  rdoc_options: []
273
252
  require_paths:
274
253
  - lib
@@ -283,9 +262,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
283
262
  - !ruby/object:Gem::Version
284
263
  version: '0'
285
264
  requirements: []
286
- rubyforge_project:
287
- rubygems_version: 2.7.4
288
- signing_key:
265
+ rubygems_version: 3.1.4
266
+ signing_key:
289
267
  specification_version: 4
290
268
  summary: Direct uploads to S3 and ingestion by your Rails app.
291
269
  test_files: