entity_store 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/entity_store/mongo_entity_store.rb +1 -1
- data/lib/entity_store/version.rb +1 -1
- data/spec/entity_store/entity_spec.rb +3 -3
- data/spec/entity_store/event_bus_spec.rb +4 -4
- data/spec/entity_store/mongo_entity_store_spec.rb +2 -2
- data/spec/entity_store/store_spec.rb +11 -11
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 052a7001f93a43e4ae8c511c24d5c38a68da7b52
         | 
| 4 | 
            +
              data.tar.gz: fb2de290d23c3302760094e4d1e3cc20293f7f5c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 17ea22adc9908daffd9b06a2e5050f8b26719da3e5eb8f044d88793481ec191aa1d3eb0f575864bf7a1149a4bd21f07411c51f9ddd331c0a8366d80c274be68a
         | 
| 7 | 
            +
              data.tar.gz: 803f25ab786ec3175c747fa923c7ac211c20df2826e7f8e4691507745051364ec3e516485b2798e318b6ee9ab585d1a03809ede057bdf1f7f02e358d12a54d43
         | 
    
        data/lib/entity_store/version.rb
    CHANGED
    
    
| @@ -12,9 +12,9 @@ end | |
| 12 12 | 
             
            describe Entity do
         | 
| 13 13 | 
             
              describe ".related_entities" do
         | 
| 14 14 | 
             
                before(:each) do
         | 
| 15 | 
            -
                  @entity_loader =  | 
| 16 | 
            -
                  @club =  | 
| 17 | 
            -
                  @user =  | 
| 15 | 
            +
                  @entity_loader = double(Store)
         | 
| 16 | 
            +
                  @club = double('Entity', :id => random_string)
         | 
| 17 | 
            +
                  @user = double('Entity', :id => random_string)
         | 
| 18 18 | 
             
                  @entity = DummyEntity.new(:related_entity_loader => @entity_loader, :club_id => @club.id, :user_id => @user.id)
         | 
| 19 19 | 
             
                  @entity_loader.stub(:get) { |id| 
         | 
| 20 20 | 
             
                    case id
         | 
| @@ -27,7 +27,7 @@ describe EventBus do | |
| 27 27 | 
             
                before(:each) do
         | 
| 28 28 | 
             
                  @subscriber = DummySubscriber.new
         | 
| 29 29 | 
             
                  DummySubscriber.stub(:new) { @subscriber }
         | 
| 30 | 
            -
                  @subscriber_class2 =  | 
| 30 | 
            +
                  @subscriber_class2 = double("SubscriberClass", :instance_methods => ['bilge'], :name => "SubscriberClass")
         | 
| 31 31 | 
             
                  @all_subscriber = DummyAllSubscriber.new
         | 
| 32 32 | 
             
                  DummyAllSubscriber.stub(:new) { @all_subscriber }
         | 
| 33 33 | 
             
                  @event_bus.stub(:subscribers).and_return([DummySubscriber, @subscriber_class2, DummyAllSubscriber])
         | 
| @@ -56,7 +56,7 @@ describe EventBus do | |
| 56 56 |  | 
| 57 57 | 
             
              describe ".publish_to_feed" do
         | 
| 58 58 | 
             
                before(:each) do
         | 
| 59 | 
            -
                  @feed_store =  | 
| 59 | 
            +
                  @feed_store = double(ExternalStore)
         | 
| 60 60 | 
             
                  @event_bus.stub(:feed_store) { @feed_store }
         | 
| 61 61 | 
             
                end
         | 
| 62 62 |  | 
| @@ -72,10 +72,10 @@ describe EventBus do | |
| 72 72 | 
             
                before(:each) do
         | 
| 73 73 | 
             
                  @since = random_time
         | 
| 74 74 | 
             
                  @type = 'DummyEvent'
         | 
| 75 | 
            -
                  @subscriber =  | 
| 75 | 
            +
                  @subscriber = double("Subscriber", :dummy_event => true)
         | 
| 76 76 | 
             
                  DummySubscriber.stub(:new) { @subscriber }
         | 
| 77 77 |  | 
| 78 | 
            -
                  @feed_store =  | 
| 78 | 
            +
                  @feed_store = double(ExternalStore)
         | 
| 79 79 | 
             
                  @id = random_object_id
         | 
| 80 80 | 
             
                  @feed_store.stub(:get_events) { |since| since == @id ? [] : [
         | 
| 81 81 | 
             
                    EventDataObject.new('_id' => @id, '_type' => DummyEvent.name, 'name' => random_string) 
         | 
| @@ -24,10 +24,10 @@ describe MongoEntityStore do | |
| 24 24 | 
             
                  }
         | 
| 25 25 | 
             
                  @entity = MongoEntityStoreSpec::DummyEntity.new
         | 
| 26 26 | 
             
                  MongoEntityStoreSpec::DummyEntity.stub(:new) { @entity }
         | 
| 27 | 
            -
                  @entities_collection =  | 
| 27 | 
            +
                  @entities_collection = double('MongoCollection', :find_one => @attrs)
         | 
| 28 28 | 
             
                  @store.stub(:entities) { @entities_collection }
         | 
| 29 29 | 
             
                  @events = [
         | 
| 30 | 
            -
                     | 
| 30 | 
            +
                    double('Event', :apply => true, :entity_version => random_integer), double('Event', :apply => true, :entity_version => random_integer)
         | 
| 31 31 | 
             
                  ]
         | 
| 32 32 | 
             
                  @store.stub(:get_events) { @events }
         | 
| 33 33 | 
             
                end
         | 
| @@ -12,7 +12,7 @@ describe Store do | |
| 12 12 | 
             
                before(:each) do
         | 
| 13 13 | 
             
                  @new_id = random_string
         | 
| 14 14 | 
             
                  @entity = DummyEntityForStore.new(:name => random_string)
         | 
| 15 | 
            -
                  @storage_client =  | 
| 15 | 
            +
                  @storage_client = double("StorageClient", :add_entity => @new_id)
         | 
| 16 16 | 
             
                  @store = Store.new
         | 
| 17 17 | 
             
                  @store.stub(:add_events)
         | 
| 18 18 | 
             
                  @store.stub(:storage_client) { @storage_client }
         | 
| @@ -38,12 +38,12 @@ describe Store do | |
| 38 38 | 
             
                  @entity = DummyEntityForStore.new(:name => random_string)
         | 
| 39 39 | 
             
                  @entity.id = random_string
         | 
| 40 40 | 
             
                  @entity.version = random_integer
         | 
| 41 | 
            -
                  @entity.pending_events <<  | 
| 42 | 
            -
                  @entity.pending_events <<  | 
| 43 | 
            -
                  @storage_client =  | 
| 41 | 
            +
                  @entity.pending_events << double(Event, :entity_id= => true, :entity_version= => true)
         | 
| 42 | 
            +
                  @entity.pending_events << double(Event, :entity_id= => true, :entity_version= => true)
         | 
| 43 | 
            +
                  @storage_client = double("StorageClient", :add_event => true)
         | 
| 44 44 | 
             
                  @store = Store.new
         | 
| 45 45 | 
             
                  @store.stub(:storage_client) { @storage_client }
         | 
| 46 | 
            -
                  @event_bus =  | 
| 46 | 
            +
                  @event_bus = double(EventBus, :publish => true)
         | 
| 47 47 | 
             
                  @store.stub(:event_bus) { @event_bus}
         | 
| 48 48 | 
             
                end
         | 
| 49 49 |  | 
| @@ -82,7 +82,7 @@ describe Store do | |
| 82 82 | 
             
                    @entity = DummyEntityForStore.new(:id => random_string)
         | 
| 83 83 | 
             
                    @entity.version = random_integer * EntityStore::Config.snapshot_threshold + 1
         | 
| 84 84 | 
             
                    @store = Store.new
         | 
| 85 | 
            -
                    @related_entity =  | 
| 85 | 
            +
                    @related_entity = double('Entity')
         | 
| 86 86 | 
             
                    @entity.stub(:loaded_related_entities) { [ @related_entity ] }
         | 
| 87 87 | 
             
                    @store.stub(:do_save)
         | 
| 88 88 | 
             
                  end
         | 
| @@ -105,11 +105,11 @@ describe Store do | |
| 105 105 | 
             
                  @new_id = random_string
         | 
| 106 106 | 
             
                  @entity = DummyEntityForStore.new(:id => random_string)
         | 
| 107 107 | 
             
                  @entity.version = random_integer * EntityStore::Config.snapshot_threshold
         | 
| 108 | 
            -
                  @storage_client =  | 
| 108 | 
            +
                  @storage_client = double("StorageClient", :save_entity => true)
         | 
| 109 109 | 
             
                  @store = Store.new
         | 
| 110 110 | 
             
                  @store.stub(:add_events)
         | 
| 111 111 | 
             
                  @store.stub(:storage_client) { @storage_client }
         | 
| 112 | 
            -
                  @entity.stub(:pending_events) { [  | 
| 112 | 
            +
                  @entity.stub(:pending_events) { [ double('Event') ] }
         | 
| 113 113 | 
             
                end
         | 
| 114 114 |  | 
| 115 115 | 
             
                subject { @store.do_save(@entity) }
         | 
| @@ -178,11 +178,11 @@ describe Store do | |
| 178 178 | 
             
                  @entity = DummyEntityForStore.new(id: random_string, version: random_integer)
         | 
| 179 179 | 
             
                  DummyEntityForStore.stub(:new).and_return(@entity)
         | 
| 180 180 | 
             
                  @events = [
         | 
| 181 | 
            -
                     | 
| 182 | 
            -
                     | 
| 181 | 
            +
                    double("Event", apply: true, entity_version: @entity.version + 1), 
         | 
| 182 | 
            +
                    double("Event", apply: true, entity_version: @entity.version + 2)
         | 
| 183 183 | 
             
                  ]
         | 
| 184 184 |  | 
| 185 | 
            -
                  @storage_client =  | 
| 185 | 
            +
                  @storage_client = double("StorageClient", :get_entity => @entity, :get_events => @events)
         | 
| 186 186 | 
             
                  @store = Store.new
         | 
| 187 187 | 
             
                  @store.stub(:storage_client) { @storage_client }
         | 
| 188 188 | 
             
                end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: entity_store
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.6
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Adam Bird
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2013-11- | 
| 11 | 
            +
            date: 2013-11-10 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: mongo
         |