Sha256: 1e384e67544aeafda407485180c1b3560bb40c45fb660fad9c0f5dfa1384765a
Contents?: true
Size: 1.36 KB
Versions: 3
Compression:
Stored size: 1.36 KB
Contents
# This Spec requires a running AMQP server. # Configure your AMQP server first and enter access information below before running this spec. require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require 'tmpdir' describe "HistoryCommander" do before(:all) do @watch_files = [] 2.times do |x| @watch_files << File.join(Dir.tmpdir, "#{x}unique-history_commander_spec_candelete") end @watch_files.each {|w| `rm #{w}; touch #{w}`} end it "runs multiple history commanders and checks for all files to contain all history" do EM.run do AMQP.start(:host => "ec2-184-72-19-157.us-west-1.compute.amazonaws.com") do EM.next_tick do @watch_files.each do |w| HistWatch.start(w) end end EM.add_timer(2) do @first_value = "first_command: #{rand(10000000)}" File.open(@watch_files.first, "a") {|f| f.puts @first_value } end EM.add_timer(3) do @second_value = "second_command: #{rand(10000000)}" File.open(@watch_files.last, "a") {|f| f.puts @second_value } end EM.add_timer(10) do @watch_files.each do |w| IO.read(w).should =~ /^#{@first_value}/ IO.read(w).should =~ /^#{@second_value}/ end end EM.add_timer(12) do EM.stop end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
history_commander-0.0.3 | spec/history_commander_spec.rb |
history_commander-0.0.2 | spec/history_commander_spec.rb |
history_commander-0.0.1 | spec/history_commander_spec.rb |