Sha256: 6530a0a606042cd1f7035664dddec72b01aadf027c93af5d167e70669fc3cdc4

Contents?: true

Size: 1.59 KB

Versions: 48

Compression:

Stored size: 1.59 KB

Contents

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

describe "RhosyncApiSetRefreshTime" do
  it_should_behave_like "ApiHelper"
  
  it "should set refresh time to 100s from 'now'" do
    before = Time.now.to_i
    post "/api/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/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/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/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

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
rhosync-2.1.18.beta2 spec/api/set_refresh_time_spec.rb
rhosync-2.1.18.beta1 spec/api/set_refresh_time_spec.rb
rhosync-2.1.17 spec/api/set_refresh_time_spec.rb
rhosync-2.1.17.beta7 spec/api/set_refresh_time_spec.rb
rhosync-2.1.17.beta6 spec/api/set_refresh_time_spec.rb
rhosync-2.1.17.beta5 spec/api/set_refresh_time_spec.rb
rhosync-2.1.17.beta4 spec/api/set_refresh_time_spec.rb
rhosync-2.1.17.beta3 spec/api/set_refresh_time_spec.rb
rhosync-2.1.17.beta2 spec/api/set_refresh_time_spec.rb
rhosync-2.1.17.beta1 spec/api/set_refresh_time_spec.rb
rhosync-2.1.16 spec/api/set_refresh_time_spec.rb
rhosync-2.1.15 spec/api/set_refresh_time_spec.rb
rhosync-2.1.14 spec/api/set_refresh_time_spec.rb
rhosync-2.1.13 spec/api/set_refresh_time_spec.rb
rhosync-2.1.12 spec/api/set_refresh_time_spec.rb
rhosync-2.1.11 spec/api/set_refresh_time_spec.rb
rhosync-2.1.10 spec/api/set_refresh_time_spec.rb
rhosync-2.1.7 spec/api/set_refresh_time_spec.rb
rhosync-2.1.6 spec/api/set_refresh_time_spec.rb
rhosync-2.1.3 spec/api/set_refresh_time_spec.rb