spec/writer_spec.rb in alephant-publisher-0.1.4 vs spec/writer_spec.rb in alephant-publisher-0.1.5

- old
+ new

@@ -48,13 +48,13 @@ Alephant::Sequencer::Sequencer .any_instance .stub(:get_last_seen) - Alephant::Lookup::LookupHelper + Alephant::Lookup::LookupTable .any_instance - .stub(:create_lookup_table) + .stub(:create) Alephant::Lookup::LookupTable .any_instance .stub(:table_name) @@ -65,15 +65,11 @@ 'component_id' => Struct.new(:render).new('content') }) end - subject do - Alephant::Publisher::Writer.new(opts) - end - - describe "#write(data, version)" do + describe "#run!" do let(:msg) do data = { "sequence" => "1", "vary" => "foo" } @@ -82,18 +78,24 @@ let(:expected_location) do 'renderer_id/component_id/218c835cec343537589dbf1619532e4d/1' end + subject do + Alephant::Publisher::Writer.new(opts, msg) + end + it "should write the correct lookup location" do Alephant::Cache.any_instance.stub(:put) Alephant::Lookup::LookupHelper .any_instance .should_receive(:write) .with( + "component_id", {:variant=>"foo"}, + 1, expected_location ) end it "should put the correct location, content to cache" do @@ -104,9 +106,9 @@ .should_receive(:put) .with(expected_location, "content") end after do - subject.write(msg) + subject.run! end end end