Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
tawan committed Dec 6, 2015
1 parent 32b3679 commit 3fc17ca
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
tbd (0.1.0)
rails_eb_job (0.1.0)
aws-sdk-core (~> 2)

GEM
Expand Down Expand Up @@ -141,8 +141,8 @@ DEPENDENCIES
fuubar
pry-byebug
rails (~> 4.2)
rails_eb_job!
rspec
tbd!

BUNDLED WITH
1.10.6
3 changes: 3 additions & 0 deletions lib/rails_eb_job/rack/sqs_processor.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "action_dispatch"

module RailsEbJob
module Rack
class SqsProcessor
Expand All @@ -6,6 +8,7 @@ def initialize(app)
end

def call(env)
request = ActionDispatch::Request.new env
@app.call(env)
end
end
Expand Down
27 changes: 27 additions & 0 deletions spec/integration/base_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require 'spec_helper'
require 'tempfile'

describe "standard scenario" do
before do
s3 = Aws::S3::Client.new(
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
region: ENV['AWS_REGION']
)

s3_resource = Aws::S3::Resource.new(client: s3)
s3_bucket = s3_resource.bucket('elasticbeanstalk-eu-west-1-103493342764')
s3_object = s3_bucket.object(SecureRandom.hex)

version = pack_version
s3_object.upload_file(version)
end

it "enqueues and consumes a job successfully" do

end

def pack_version
File.expand_path('../Gemfile', File.dirname(__FILE__))
end
end
3 changes: 1 addition & 2 deletions spec/integration/rails-app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ gem 'sdoc', '~> 0.4.0', group: :doc
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

gem 'rails_eb_job', :path => "../../../"
gem 'rails_eb_job', :path => "lib/rails_eb_job"

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
Expand All @@ -46,4 +46,3 @@ group :development do
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end

19 changes: 19 additions & 0 deletions spec/rails_eb_job/rack/sqs_processor_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'spec_helper'

describe RailsEbJob::Rack::SqsProcessor do
let(:env) { double("env") }
let(:app) { double("app") }

subject(:sqs_processor) { RailsEbJob::Rack::SqsProcessor.new(app) }

it "passes an ordinary request through" do
expect(app).to receive(:call).with(env)
sqs_processor.call(env)
end

context "when request is an SQS message" do
let(:env) {

}
end
end

0 comments on commit 3fc17ca

Please sign in to comment.