# HG changeset patch # User Mahlon E. Smith # Date 1412803925 25200 # Wed Oct 08 14:32:05 2014 -0700 # Node ID f935efac757ca4354c1d9b681541cea64a0a97c6 # Parent 1f9edecf087dbe65ca1aeb074485dcf21ba3626f Misc cleanups, dependency updates, get tests passing again. diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -11,3 +11,4 @@ integration/ logs/ etc/thingfish.conf$ +tmp/ diff --git a/.rvm.gems b/.rvm.gems --- a/.rvm.gems +++ b/.rvm.gems @@ -1,7 +1,8 @@ -configurability -v2.1.0 -loggability -v0.10.0 +configurability -v2.2.0 +loggability -v0.11.0 hoe-deveiate -v0.3.0 sequel -v4.3.0 sequel_pg -v1.6.8 strelka -v0.8.0 ruby-mp3info -v0.8.2 +rspec -v3.1.0 diff --git a/etc/m2-config.rb b/etc/m2-config.rb --- a/etc/m2-config.rb +++ b/etc/m2-config.rb @@ -4,7 +4,7 @@ # The Mongrel config used by the examples. Load it with: # -# m2sh.rb -c examples/mongrel2.sqlite load examples/gen-config.rb +# m2sh.rb -c mongrel2.sqlite load examples/m2-config.rb # require 'mongrel2' diff --git a/lib/thingfish/datastore/memory.rb b/lib/thingfish/datastore/memory.rb --- a/lib/thingfish/datastore/memory.rb +++ b/lib/thingfish/datastore/memory.rb @@ -80,5 +80,13 @@ return @storage.each_key( &block ) end + ### Iterator -- yield a pair: + ### UUID => datablob + ### of each object in the datastore to the block, or return an Enumerator + ### for each UUID if called without a block. + def each( &block ) + return @storage.each( &block ) + end + end # class Thingfish::MemoryDatastore diff --git a/lib/thingfish/mixins.rb b/lib/thingfish/mixins.rb --- a/lib/thingfish/mixins.rb +++ b/lib/thingfish/mixins.rb @@ -9,7 +9,6 @@ module Thingfish - # A collection of functions for dealing with object IDs. module Normalization diff --git a/spec/helpers.rb b/spec/helpers.rb --- a/spec/helpers.rb +++ b/spec/helpers.rb @@ -18,6 +18,7 @@ require 'simplecov' if ENV['COVERAGE'] require 'stringio' +require 'time' require_relative 'constants' @@ -64,7 +65,6 @@ include Strelka::Constants include Thingfish::SpecHelpers - c.treat_symbols_as_metadata_keys_with_true_values = true c.run_all_when_everything_filtered = true c.filter_run :focus c.order = 'random' diff --git a/spec/thingfish/handler_spec.rb b/spec/thingfish/handler_spec.rb --- a/spec/thingfish/handler_spec.rb +++ b/spec/thingfish/handler_spec.rb @@ -17,7 +17,7 @@ end before( :each ) do - @png_io = StringIO.new( TEST_PNG_DATA.dup ) + @png_io = StringIO.new( TEST_PNG_DATA.dup ) @text_io = StringIO.new( TEST_TEXT_DATA.dup ) @handler = described_class.new( TEST_APPID, TEST_SEND_SPEC, TEST_RECV_SPEC ) end @@ -568,7 +568,7 @@ expect( @handler.metastore.fetch(uuid) ). to include( 'test:comment' => 'Yo, it totally worked.') related_uuids = @handler.metastore.fetch_related_uuids( uuid ) - expect( related_uuids ).to have( 1 ).member + expect( related_uuids.size ).to be( 1 ) r_uuid = related_uuids.first.downcase expect( @handler.metastore.fetch_value(r_uuid, 'relation') ).to eq( uuid ) @@ -610,7 +610,7 @@ handles = ZMQ.select( [@subsock], nil, nil, 0 ) expect( handles ).to be_an( Array ) - expect( handles[0] ).to have( 1 ).socket + expect( handles[0].size ).to be( 1 ) expect( handles[0].first ).to be( @subsock ) event = @subsock.recv diff --git a/spec/thingfish/metastore/memory_spec.rb b/spec/thingfish/metastore/memory_spec.rb --- a/spec/thingfish/metastore/memory_spec.rb +++ b/spec/thingfish/metastore/memory_spec.rb @@ -100,7 +100,7 @@ @store.remove_except( TEST_UUID, :format, :extent ) metadata = @store.fetch( TEST_UUID ) - expect( metadata ).to have( 2 ).members + expect( metadata.size ).to be( 2 ) expect( metadata.keys ).to include( 'format', 'extent' ) end @@ -167,7 +167,7 @@ it "can apply criteria to searches" do results = @store.search( :criteria => {'format' => 'audio/mp3'} ) - expect( results ).to have( 2 ).matches + expect( results.size ).to be( 2 ) results.each do |uuid| expect( @store.fetch_value(uuid, 'format') ).to eq( 'audio/mp3' ) end diff --git a/spec/thingfish/processor_spec.rb b/spec/thingfish/processor_spec.rb --- a/spec/thingfish/processor_spec.rb +++ b/spec/thingfish/processor_spec.rb @@ -38,7 +38,7 @@ it "can declare a list of media types it handles" do subclass.handled_types( 'image/*', 'video/*' ) - expect( subclass.handled_types ).to have( 2 ).handled_types + expect( subclass.handled_types.size ).to be( 2 ) expect( subclass.handled_types[0] ).to be_a( Strelka::HTTPRequest::MediaType ) end