cukeforker 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,16 +6,17 @@ module CukeForker
6
6
  # where 'features' is an Array of file:line
7
7
  # and 'opts' is a Hash of options:
8
8
  #
9
- # :max => Fixnum number of workers (default: 2)
10
- # :vnc => true/false children are launched with DISPLAY set from a VNC server pool,
11
- # where the size of the pool is equal to :max
12
- # :record => true/false whether to record a video of failed tests (requires ffmpeg)
13
- # this will be ignored if if :vnc is not true
14
- # :notify => object (or array of objects) implementing the AbstractListener API
15
- # :out => path directory to dump output to (default: current working dir)
16
- # :log => true/false wether or not to log to stdout (default: true)
17
- # :format => Symbol format passed to `cucumber --format` (default: html)
18
- # :extra_args => Array extra arguments passed to cucumber
9
+ # :max => Fixnum number of workers (default: 2)
10
+ # :vnc => true/false children are launched with DISPLAY set from a VNC server pool,
11
+ # where the size of the pool is equal to :max
12
+ # :record => true/false,Hash whether to record a video of failed tests (requires ffmpeg)
13
+ # this will be ignored if if :vnc is not true. If passed a Hash,
14
+ # these will be passed as options to RecordingVncListener
15
+ # :notify => object (or array of objects) implementing the AbstractListener API
16
+ # :out => path directory to dump output to (default: current working dir)
17
+ # :log => true/false wether or not to log to stdout (default: true)
18
+ # :format => Symbol format passed to `cucumber --format` (default: html)
19
+ # :extra_args => Array extra arguments passed to cucumber
19
20
  #
20
21
 
21
22
  class Runner
@@ -24,7 +25,8 @@ module CukeForker
24
25
  DEFAULT_OPTIONS = {
25
26
  :max => 2,
26
27
  :vnc => false,
27
- :notify => [],
28
+ :record => false,
29
+ :notify => nil,
28
30
  :out => Dir.pwd,
29
31
  :log => true,
30
32
  :format => :html
@@ -51,8 +53,12 @@ module CukeForker
51
53
  vnc_pool = VncTools::ServerPool.new(max)
52
54
  listener = VncListener.new(vnc_pool)
53
55
 
54
- if opts[:record]
55
- listeners << RecordingVncListener.new(listener)
56
+ if record = opts[:record]
57
+ if record.kind_of?(Hash)
58
+ listeners << RecordingVncListener.new(listener, record)
59
+ else
60
+ listeners << RecordingVncListener.new(listener)
61
+ end
56
62
  end
57
63
  end
58
64
 
@@ -1,3 +1,3 @@
1
1
  module CukeForker
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -75,5 +75,12 @@ module CukeForker
75
75
  listener.on_run_interrupted
76
76
  end
77
77
 
78
+ it "passes along options to each recorder" do
79
+ listener = RecordingVncListener.new vnc_listener, :codec => "flv"
80
+ VncTools::Recorder.should_receive(:new).with(":2", "./foo.flv", :codec => "flv").and_return(recorder)
81
+
82
+ listener.on_worker_starting worker
83
+ end
84
+
78
85
  end # RecordingVncListener
79
86
  end # CukeForker
@@ -55,6 +55,17 @@ module CukeForker
55
55
  Runner.create([], :max => 2, :vnc => true, :record => true)
56
56
  end
57
57
 
58
+ it "sets up VNC recording if :record => Hash" do
59
+ mock_pool = mock(VncTools::ServerPool, :add_observer => nil)
60
+ VncTools::ServerPool.should_receive(:new).with(2).and_return mock_pool
61
+
62
+ mock_vnc_listener = mock(:update => nil)
63
+ VncListener.should_receive(:new).with(mock_pool).and_return(mock_vnc_listener)
64
+ RecordingVncListener.should_receive(:new).with(mock_vnc_listener, :codec => "flv").and_return(mock(:update => nil))
65
+
66
+ Runner.create([], :max => 2, :vnc => true, :record => {:codec => "flv"})
67
+ end
68
+
58
69
  it "creates and runs a new runner" do
59
70
  r = mock(Runner)
60
71
  Runner.should_receive(:create).with(%w[a b], {}).and_return(r)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cukeforker
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.2
5
+ version: 0.1.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jari Bakken
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-11 00:00:00 +01:00
13
+ date: 2011-02-14 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  requirements: []
116
116
 
117
117
  rubyforge_project: cukeforker
118
- rubygems_version: 1.5.0
118
+ rubygems_version: 1.5.2
119
119
  signing_key:
120
120
  specification_version: 3
121
121
  summary: Library to maintain a forking queue of Cucumber processes