Sha256: c9ce7644deb1a31a7a0eab2ef9ac4c93e249f978a7f8655ce4f507a9fef4e321

Contents?: true

Size: 1.7 KB

Versions: 22

Compression:

Stored size: 1.7 KB

Contents

require File.join(File.dirname(__FILE__),'..','api_helper')

describe "RhoconnectApiSetRefreshTime" do
  it_should_behave_like "ApiHelper" do
    it "should set refresh time to 100s from 'now'" do
      before = Time.now.to_i
      post "/api/source/set_refresh_time", :api_token => @api_token, 
        :source_name => @s_fields[:name], :user_name => @u_fields[:login], :refresh_time => 100
      after = Time.now.to_i
      last_response.should be_ok
      @s = Source.load(@s.id,@s_params)
      @s.read_state.refresh_time.should >= before + 100
      @s.read_state.refresh_time.should <= after + 100
    end

    it "should set refresh time to 'now' if no refresh_time provided" do
      before = Time.now.to_i
      post "/api/source/set_refresh_time", :api_token => @api_token, 
        :source_name => @s_fields[:name], :user_name => @u_fields[:login]
      after = Time.now.to_i
      last_response.should be_ok
      @s = Source.load(@s.id,@s_params)
      @s.read_state.refresh_time.should >= before
      @s.read_state.refresh_time.should <= after
    end

    it "should set poll interval" do
      post "/api/source/set_refresh_time", :api_token => @api_token, 
        :source_name => @s_fields[:name], :user_name => @u_fields[:login], :poll_interval => 100
      last_response.should be_ok
      @s = Source.load(@s.id,@s_params)
      @s.poll_interval.should == 100
    end

    it "should should not set nil poll interval" do
      post "/api/source/set_refresh_time", :api_token => @api_token, 
        :source_name => @s_fields[:name], :user_name => @u_fields[:login], :poll_interval => nil
      last_response.should be_ok
      @s = Source.load(@s.id,@s_params)
      @s.poll_interval.should == 300
    end
  end  
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rhoconnect-3.2.1 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.2.0 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.2.0.beta5 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.2.0.beta4 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.2.0.beta3 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.2.0.beta2 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.2.0.beta1 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.1.2 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.1.1 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.1.0 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.1.0.beta2 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.1.0.beta1 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.0.6 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.0.5 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.0.4 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.0.3 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.0.2 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.0.1 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.0.0 spec/api/source/set_refresh_time_spec.rb
rhoconnect-3.0.0.rc1 spec/api/source/set_refresh_time_spec.rb