Sha256: f9d1388434839241222c7ed3e2da5db95acda399854f9b927f43bb0afaf1b889

Contents?: true

Size: 1.4 KB

Versions: 5

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe Stasis::Server do

  before(:all) do
    generate
    @thread = Thread.new do
      Stasis::Server.new($fixture, :server => 'localhost:6379/0')
    end
  end

  after(:all) do
    @thread.kill
  end
  
  it "should change time.html" do
    time = $files['time.html'].split("time")[1].strip
    new_time = Stasis::Server.push(
      :paths => [ 'time.html.haml' ],
      :redis => 'localhost:6379/0',
      :return => true
    )['time.html.haml'].split("time")[1].strip
    time.should_not == new_time
    generate_files
    new_time_from_file = $files['time.html'].split("time")[1].strip
    new_time_from_file.should == new_time
    new_time_from_file.should_not == time
  end

  it "should expire after ttl" do
    time = Stasis::Server.push(
      :paths => [ 'time.html.haml' ],
      :redis => 'localhost:6379/0',
      :return => true,
      :ttl => 1,
      :write => false
    )['time.html.haml'].split("time")[1].strip
    time2 = Stasis::Server.push(
      :paths => [ 'time.html.haml' ],
      :redis => 'localhost:6379/0',
      :return => true,
      :write => false
    )['time.html.haml'].split("time")[1].strip
    time.should == time2
    sleep 2
    time3 = Stasis::Server.push(
      :paths => [ 'time.html.haml' ],
      :redis => 'localhost:6379/0',
      :return => true,
      :write => false
    )['time.html.haml'].split("time")[1].strip
    time2.should_not == time3
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stasis-0.1.9 spec/stasis/server_spec.rb
stasis-0.1.8 spec/stasis/server_spec.rb
stasis-0.1.7 spec/stasis/server_spec.rb
stasis-0.1.6 spec/stasis/server_spec.rb
stasis-0.1.5 spec/stasis/server_spec.rb