Sha256: 32cd53b8058ef8774969c9f3b855a94158e650a06aac3a3d252d28e6a5a2de34
Contents?: true
Size: 1.48 KB
Versions: 3
Compression:
Stored size: 1.48 KB
Contents
require 'spec_helper' describe Alephant::Writer do before(:each) do Alephant::RenderMapper.any_instance.stub(:initialize) Alephant::Cache.any_instance.stub(:initialize) end subject do Alephant::Writer.new({ :renderer_id => 'renderer_id', :lookup_table_name => 'lookup_table_name' }) end describe "#write(data, version)" do before(:each) do Alephant::RenderMapper.any_instance .stub(:generate) .and_return({ 'component_id' => Struct.new(:render).new('content') }) end it "should write the correct lookup location" do options = { :key => :value } data = { :options => options } Alephant::Cache.any_instance .stub(:put) Alephant::Lookup .should_receive(:create) .with('lookup_table_name', 'component_id') .and_call_original Alephant::Lookup::Lookup.any_instance .stub(:initialize) Alephant::Lookup::Lookup.any_instance .should_receive(:write) .with(options, 'renderer_id/component_id/42de5e5c6f74b9fe4d956704a6d9e1c7/0') subject.write(data, 0) end it "should put the correct location, content to cache" do Alephant::Lookup::Lookup.any_instance.stub(:initialize) Alephant::Lookup::Lookup.any_instance.stub(:write) Alephant::Cache.any_instance .should_receive(:put).with('renderer_id/component_id/35589a1cc0b3ca90fc52d0e711c0c434/0', 'content') subject.write({}, 0) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
alephant-0.1.4.1-java | spec/writer_spec.rb |
alephant-0.1.4-java | spec/writer_spec.rb |
alephant-0.1.3-java | spec/writer_spec.rb |