spec/writer_spec.rb in alephant-publisher-queue-2.0.0 vs spec/writer_spec.rb in alephant-publisher-queue-2.0.1
- old
+ new
@@ -1,16 +1,16 @@
-require 'spec_helper'
+require "spec_helper"
describe Alephant::Publisher::Queue::Writer do
let(:opts) do
{
- :lookup_table_name => 'lookup_table_name',
- :msg_vary_id_path => '$.vary',
+ :lookup_table_name => "lookup_table_name",
+ :msg_vary_id_path => "$.vary",
:renderer_id => :renderer_id,
:s3_bucket_id => :s3_bucket_id,
:s3_object_path => :s3_object_path,
- :sequence_id_path => '$.sequence',
+ :sequence_id_path => "$.sequence",
:sequencer_table_name => :sequencer_table_name,
:view_path => :view_path
}
end
@@ -21,41 +21,49 @@
.with(
opts[:s3_bucket_id],
opts[:s3_object_path]
)
- allow_any_instance_of(Alephant::Sequencer::SequenceTable).to receive(:create)
- allow_any_instance_of(Alephant::Sequencer::Sequencer).to receive(:sequencer_id_from)
- .and_return(1)
+ allow_any_instance_of(
+ Alephant::Sequencer::SequenceTable
+ ).to receive(:create)
- allow_any_instance_of(Alephant::Sequencer::Sequencer).to receive(:set_last_seen)
- allow_any_instance_of(Alephant::Sequencer::Sequencer).to receive(:get_last_seen)
+ allow_any_instance_of(Alephant::Sequencer::Sequencer)
+ .to receive_messages(
+ :sequencer_id_from => nil,
+ :set_last_seen => nil,
+ :get_last_seen => nil
+ )
- allow_any_instance_of(Alephant::Lookup::LookupTable).to receive(:create)
+ allow_any_instance_of(Alephant::Lookup::LookupTable)
+ .to receive_messages(
+ :create => nil,
+ :table_name => nil
+ )
- allow_any_instance_of(Alephant::Lookup::LookupTable).to receive(:table_name)
-
- allow_any_instance_of(Alephant::Renderer::Renderer).to receive(:views).and_return({})
+ allow_any_instance_of(
+ Alephant::Renderer::Renderer
+ ).to receive(:views).and_return({})
end
describe "#run!" do
let(:msg) do
data = {
"sequence" => "1",
- "vary" => "foo"
+ "vary" => "foo"
}
- Struct.new(:body,:id).new(data.to_json,'id')
+ Struct.new(:body, :id).new(data.to_json, "id")
end
let(:expected_location) do
- 'renderer_id/component_id/218c835cec343537589dbf1619532e4d/1'
+ "renderer_id/component_id/218c835cec343537589dbf1619532e4d/1"
end
let(:renderer) do
- instance_double 'Alephant::Renderer::Renderer'
+ instance_double "Alephant::Renderer::Renderer"
end
subject do
Alephant::Publisher::Queue::Writer.new(opts, msg)
end
@@ -64,10 +72,10 @@
allow_any_instance_of(Alephant::Cache).to receive(:put)
allow_any_instance_of(Alephant::Lookup::LookupHelper).to receive(:write)
.with(
"component_id",
- {:variant=>"foo"},
+ { :variant => "foo" },
1,
expected_location
)
end