forked from kdiogenes/s3-upnow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
38 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
module S3UpNow | ||
class Engine < ::Rails::Engine | ||
initializer "s3-upnow.setup", before: :load_environment_config do | ||
ActionView::Base.send(:include, S3UpNow::S3UpNowHelper) if defined?(ActionView::Base) | ||
ActionView::Helpers::FormBuilder.send(:include, S3UpNow::S3UpNowFieldHelper) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
require 'spec_helper' | ||
describe S3UpNow do | ||
it "version must be defined" do | ||
S3UpNow::VERSION.should be_true | ||
expect(S3UpNow::VERSION).to be | ||
end | ||
|
||
it "config must be defined" do | ||
S3UpNow.config.should be_true | ||
expect(S3UpNow.config).to be | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require "spec_helper" | ||
|
||
describe S3UpNow::Generator do | ||
describe "policy_data" do | ||
describe "starts-with $key" do | ||
it "is configurable with the key_starts_with option" do | ||
key_starts_with = "uploads/" | ||
generator = S3UpNow::Generator.new({:key_starts_with => key_starts_with}) | ||
expect(generator.policy_data[:conditions]).to include ["starts-with", "$key", key_starts_with] | ||
end | ||
|
||
it "defaults to 'uploads/'" do | ||
generator = S3UpNow::Generator.new({}) | ||
expect(generator.policy_data[:conditions]).to include ["starts-with", "$key", "uploads/"] | ||
end | ||
end | ||
|
||
describe "starts-with $content-type" do | ||
it "is configurable with the content_type_starts_with option" do | ||
content_type_starts_with = "image/" | ||
generator = S3UpNow::Generator.new({:content_type_starts_with => content_type_starts_with}) | ||
expect(generator.policy_data[:conditions]).to include ["starts-with", "$content-type", content_type_starts_with] | ||
end | ||
|
||
it "is defaults to an empty string" do | ||
generator = S3UpNow::Generator.new({}) | ||
expect(generator.policy_data[:conditions]).to include ["starts-with", "$content-type", ""] | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters