summaryrefslogtreecommitdiff
path: root/spec/factories/file_uploaders.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/file_uploaders.rb')
-rw-r--r--spec/factories/file_uploaders.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/factories/file_uploaders.rb b/spec/factories/file_uploaders.rb
new file mode 100644
index 00000000000..d397dd705a5
--- /dev/null
+++ b/spec/factories/file_uploaders.rb
@@ -0,0 +1,22 @@
+FactoryGirl.define do
+ factory :file_uploader do
+ skip_create
+
+ project factory: :empty_project
+ secret nil
+
+ transient do
+ fixture { 'rails_sample.jpg' }
+ path { File.join(Rails.root, 'spec/fixtures', fixture) }
+ file { Rack::Test::UploadedFile.new(path) }
+ end
+
+ after(:build) do |uploader, evaluator|
+ uploader.store!(evaluator.file)
+ end
+
+ initialize_with do
+ new(project, secret)
+ end
+ end
+end