M .hgignore +1 -0
@@ 11,3 11,4 @@ doc/
integration/
logs/
etc/thingfish.conf$
+tmp/
M .rvm.gems +3 -2
@@ 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
M etc/m2-config.rb +1 -1
@@ 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'
M lib/thingfish/datastore/memory.rb +8 -0
@@ 80,5 80,13 @@ class Thingfish::MemoryDatastore < Thing
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
M lib/thingfish/mixins.rb +0 -1
@@ 9,7 9,6 @@ require 'thingfish' unless defined?( Thi
module Thingfish
-
# A collection of functions for dealing with object IDs.
module Normalization
M spec/helpers.rb +1 -1
@@ 18,6 18,7 @@ BEGIN {
require 'simplecov' if ENV['COVERAGE']
require 'stringio'
+require 'time'
require_relative 'constants'
@@ 64,7 65,6 @@ RSpec.configure do |c|
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'
M spec/thingfish/handler_spec.rb +3 -3
@@ 17,7 17,7 @@ describe Thingfish::Handler do
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 @@ describe Thingfish::Handler do
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 @@ describe Thingfish::Handler do
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
M spec/thingfish/metastore/memory_spec.rb +2 -2
@@ 100,7 100,7 @@ describe Thingfish::Metastore, "memory"
@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 @@ describe Thingfish::Metastore, "memory"
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
M spec/thingfish/processor_spec.rb +1 -1
@@ 38,7 38,7 @@ describe Thingfish::Processor do
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