spec/stasis/server_spec.rb in stasis-0.1.4 vs spec/stasis/server_spec.rb in stasis-0.1.5
- old
+ new
@@ -24,6 +24,31 @@
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