Sha256: fe6fecea133094a52e37ebf3f0f43dfde77eb3bd9b6c5fae33319b283423081e

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Eotb::Report do
  
  describe "shoud format objects" do
    before(:each) do
      @response = "200"
      Eotb.configure("test_api_key")
      @@counter = 100
      Net::HTTP.stub(:new) { Net::HTTP } 
      Net::HTTP.stub(:start) { Net::HTTP } 
      Net::HTTP.stub(:request) { "200" }
      Eotb::Report.stub(:send) { [] }
      JSON.stub(:parse) { [{:name => "Example"}] }
    end
    
    it "should format with correct type " do
      Eotb::Report.hash_format('2010-10-05', :created_on).should == {"find[created_on]" => "2010-10-05"}
    end
    
    it "find should return OpenStruct objects in an  array" do
      Eotb::Report.find({:name => "Example name"}).should == [OpenStruct.new({:name => "Example"})]
    end
    
    it "latest should return OpenStruct objects in an array" do
      Eotb::Report.latest.should == [OpenStruct.new({:name => "Example"})]
    end
    
    it "latest_daily should return OpenStruct objects in an array" do
      Eotb::Report.latest_daily.should == [OpenStruct.new({:name => "Example"})]
    end
    
    it "latest_weekly should return OpenStruct objects in an array" do
      Eotb::Report.latest_weekly.should == [OpenStruct.new({:name => "Example"})]
    end
    
  end
  
end  

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eotb-0.5.18 spec/report_spec.rb