Sha256: ea16f0c4ea628458fc1de7997d16b1c1481f68aeaacca1f0e3d920f883807b7b

Contents?: true

Size: 1.22 KB

Versions: 44

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

module Appstats
  describe ContextKey do

    before(:each) do
      Appstats::Context.delete_all
      Appstats::ContextKey.delete_all
      @context_key = Appstats::ContextKey.new
    end
    
    describe "#initialize" do

      it "should set name to nil" do
        @context_key.name.should == nil
      end

      it "should set status to nil" do
        @context_key.status.should == nil
      end
      
      it "should set on constructor" do
        context_key = Appstats::ContextKey.new(:name => 'a', :status => 'c')
        context_key.name.should == 'a'
        context_key.status.should == 'c'
      end
    
    end
    
    describe "#update_context_keys" do
      
      it "should do nothing if no events" do
        Appstats::ContextKey.update_context_keys.should == 0
        Appstats::ContextKey.count.should == 0
      end
      
      it "should add entry context_key names" do
        Appstats::Context.create(:context_key => 'a')
        Appstats::ContextKey.update_context_keys.should == 1
        Appstats::ContextKey.count.should == 1
        
        context_key = Appstats::ContextKey.last
        context_key.name = 'a'
        context_key.status = 'derived'
      end
      
    end
    

  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
appstats-0.20.2 spec/context_key_spec.rb
appstats-0.20.1 spec/context_key_spec.rb
appstats-0.20.0 spec/context_key_spec.rb
appstats-0.19.7 spec/context_key_spec.rb
appstats-0.19.6 spec/context_key_spec.rb
appstats-0.19.2 spec/context_key_spec.rb
appstats-0.19.1 spec/context_key_spec.rb
appstats-0.19.0 spec/context_key_spec.rb
appstats-0.18.0 spec/context_key_spec.rb
appstats-0.17.5 spec/context_key_spec.rb
appstats-0.17.4 spec/context_key_spec.rb
appstats-0.17.3 spec/context_key_spec.rb
appstats-0.17.2 spec/context_key_spec.rb
appstats-0.17.1 spec/context_key_spec.rb
appstats-0.17.0 spec/context_key_spec.rb
appstats-0.16.7 spec/context_key_spec.rb
appstats-0.16.6 spec/context_key_spec.rb
appstats-0.16.5 spec/context_key_spec.rb
appstats-0.16.4 spec/context_key_spec.rb
appstats-0.16.3 spec/context_key_spec.rb