spassky 0.1.35 → 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -28,22 +28,22 @@ Check what devices are connected to the server:
28
28
  spassky devices http://localhost:9191
29
29
  ```
30
30
 
31
- Run a test:
31
+ Run a single html file (the second parameter is the test name):
32
32
 
33
33
  ```
34
- spassky run html_test.html http://localhost:9191
34
+ spassky run html_test.html html_test.html http://localhost:9191
35
35
  ```
36
36
 
37
37
  Run a test with colour:
38
38
 
39
39
  ```
40
- spassky run html_test.html http://localhost:9191 --colour
40
+ spassky run html_test.html html_test.html http://localhost:9191 --colour
41
41
  ```
42
42
 
43
- Run a directory that contains a test (the first .html file will be used as the test)
43
+ Run a directory that contains a test
44
44
 
45
45
  ```
46
- spassky run test_directory http://localhost:9191
46
+ spassky run test_directory html_test.html http://localhost:9191
47
47
  ```
48
48
 
49
49
  Why?
@@ -21,7 +21,7 @@ Feature: Device Timeout
21
21
  Scenario: One device times out
22
22
  Given a connected mobile device "ipad"
23
23
  When the device disconnects
24
- And I run "spassky run timed-out.html <host>" with the server host
24
+ And I run "spassky run timed-out.html timed-out.html <host>" with the server host
25
25
  Then the output should contain:
26
26
  """
27
27
  TIMED OUT timed-out.html on ipad
@@ -34,7 +34,7 @@ Feature: Run HTML Tests
34
34
 
35
35
  Scenario: No connected devices
36
36
  Given I have no connected devices
37
- When I run "spassky run passing.html <host>" with the server host
37
+ When I run "spassky run passing.html passing.html <host>" with the server host
38
38
  Then the output should contain:
39
39
  """
40
40
  There are no connected devices
@@ -43,7 +43,7 @@ Feature: Run HTML Tests
43
43
 
44
44
  Scenario: One device with a user agent that exists in WURFL
45
45
  Given a connected mobile device "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3"
46
- When I run "spassky run passing.html <host>" with the server host
46
+ When I run "spassky run passing.html passing.html <host>" with the server host
47
47
  Then the output should contain:
48
48
  """
49
49
  PASS passing.html on iPhone (id = apple_iphone_ver1_suba543, mobile_browser = Safari, device_os_version = 1.0)
@@ -52,7 +52,7 @@ Feature: Run HTML Tests
52
52
 
53
53
  Scenario: One passing test on one device
54
54
  Given a connected mobile device "blackberry"
55
- When I run "spassky run passing.html <host>" with the server host
55
+ When I run "spassky run passing.html passing.html <host>" with the server host
56
56
  Then the output should contain:
57
57
  """
58
58
  PASS passing.html on blackberry
@@ -62,7 +62,7 @@ Feature: Run HTML Tests
62
62
  Scenario: One passing test on two devices
63
63
  Given a connected mobile device "blackberry"
64
64
  And a connected mobile device "iphone"
65
- When I run "spassky run passing.html <host>" with the server host
65
+ When I run "spassky run passing.html passing.html <host>" with the server host
66
66
  Then the output should contain:
67
67
  """
68
68
  PASS passing.html on blackberry
@@ -75,7 +75,7 @@ Feature: Run HTML Tests
75
75
 
76
76
  Scenario: Failing test
77
77
  Given a connected mobile device "blackberry"
78
- When I run "spassky run failing.html <host>" with the server host
78
+ When I run "spassky run failing.html failing.html <host>" with the server host
79
79
  Then the output should contain:
80
80
  """
81
81
  FAIL failing.html on blackberry
@@ -84,7 +84,7 @@ Feature: Run HTML Tests
84
84
 
85
85
  Scenario: Failing Test with Message
86
86
  Given a connected mobile device "blackberry"
87
- When I run "spassky run failing.html <host>" with the server host
87
+ When I run "spassky run failing.html failing.html <host>" with the server host
88
88
  Then the output should contain:
89
89
  """
90
90
  FAIL failing.html on blackberry
@@ -20,7 +20,7 @@ Feature: Run QUnit Tests
20
20
  });
21
21
  """
22
22
  And a file named "qunit_passing/qunit_test/qunit.js" with qunit.js in it
23
- And a file named "qunit_passing/qunit_test/suite.html" with:
23
+ And a file named "qunit_passing/qunit_test/test_suite.html" with:
24
24
  """
25
25
  <html>
26
26
  <head></head>
@@ -32,10 +32,10 @@ Feature: Run QUnit Tests
32
32
  </html>
33
33
  """
34
34
  And a connected mobile device "blackberry"
35
- When I run "spassky run qunit_passing/qunit_test <host>" with the server host
35
+ When I run "spassky run qunit_passing/qunit_test test_suite.html <host>" with the server host
36
36
  Then the output should contain:
37
37
  """
38
- PASS qunit_test on blackberry
38
+ PASS test_suite.html on blackberry
39
39
  """
40
40
  And the exit status should be 0
41
41
 
@@ -55,7 +55,7 @@ Feature: Run QUnit Tests
55
55
  });
56
56
  """
57
57
  And a file named "qunit_failing/qunit_test/qunit.js" with qunit.js in it
58
- And a file named "qunit_failing/qunit_test/suite.html" with:
58
+ And a file named "qunit_failing/qunit_test/test_suite.html" with:
59
59
  """
60
60
  <html>
61
61
  <head></head>
@@ -67,10 +67,10 @@ Feature: Run QUnit Tests
67
67
  </html>
68
68
  """
69
69
  And a connected mobile device "blackberry"
70
- When I run "spassky run qunit_failing/qunit_test <host>" with the server host
70
+ When I run "spassky run qunit_failing/qunit_test test_suite.html <host>" with the server host
71
71
  Then the output should contain:
72
72
  """
73
- FAIL qunit_test on blackberry
73
+ FAIL test_suite.html on blackberry
74
74
  """
75
75
  And the exit status should be 1
76
76
 
@@ -90,7 +90,7 @@ Feature: Run QUnit Tests
90
90
  });
91
91
  """
92
92
  And a file named "qunit_passing/qunit_test/another_directory/qunit.js" with qunit.js in it
93
- And a file named "qunit_passing/qunit_test/suite.html" with:
93
+ And a file named "qunit_passing/qunit_test/test_suite.html" with:
94
94
  """
95
95
  <html>
96
96
  <head></head>
@@ -102,9 +102,9 @@ Feature: Run QUnit Tests
102
102
  </html>
103
103
  """
104
104
  And a connected mobile device "blackberry"
105
- When I run "spassky run qunit_passing/qunit_test <host>" with the server host
105
+ When I run "spassky run qunit_passing/qunit_test test_suite.html <host>" with the server host
106
106
  Then the output should contain:
107
107
  """
108
- PASS qunit_test on blackberry
108
+ PASS test_suite.html on blackberry
109
109
  """
110
110
  And the exit status should be 0
@@ -29,9 +29,5 @@ Feature: Summary
29
29
 
30
30
  Scenario: One test passing on all devices
31
31
  Given I have two connected devices
32
- When I run "spassky run passing.html <host>" with the server host
32
+ When I run "spassky run passing.html passing.html <host>" with the server host
33
33
  Then the output should contain "2 passed"
34
-
35
- #2 passed
36
- #2 passed, 1 failed
37
- #3 passed, 1 failed, 1 timed out
@@ -15,11 +15,11 @@ module Spassky::Client
15
15
  DEFAULT_SERVER = "http://localhost:#{DEFAULT_PORT}"
16
16
 
17
17
  command "run a test"
18
- def run(test, server = DEFAULT_SERVER, colour = false)
18
+ def run(pattern, test, server = DEFAULT_SERVER, colour = false)
19
19
  writer = colour ? ColouredWriter : DefaultWriter
20
20
  pusher = Pusher.new(server)
21
- test_runner = TestRunner.new(pusher, writer.new(STDOUT), DirectoryReader.new(test))
22
- test_runner.run_tests(test)
21
+ test_runner = TestRunner.new(pusher, writer.new(STDOUT), DirectoryReader.new(pattern))
22
+ test_runner.run_tests(pattern, test)
23
23
  end
24
24
 
25
25
  command "list devices"
@@ -8,8 +8,7 @@ module Spassky::Client
8
8
  @directory_reader = directory_reader
9
9
  end
10
10
 
11
- def run_tests(pattern)
12
- test_name = File.basename(pattern)
11
+ def run_tests(pattern, test_name)
13
12
  begin
14
13
  @pusher.push(:name => test_name, :contents => @directory_reader.read_files.to_json) do |result|
15
14
  handle_test_result(result)
@@ -8,19 +8,11 @@ module Spassky::Server
8
8
 
9
9
  def get_file(name)
10
10
  file_contents = @contents[name]
11
- if file_contents.nil?
12
- file_contents = get_test_file_contents
13
- end
14
11
  add_helpers_to_html file_contents
15
12
  end
16
13
 
17
14
  private
18
15
 
19
- def get_test_file_contents
20
- html_file = @contents.keys.find {|key| key.end_with?(".html")}
21
- file_contents = @contents[html_file]
22
- end
23
-
24
16
  def add_helpers_to_html html
25
17
  html.gsub('</head>', assert_js_script + meta_refresh_tag + '</head>')
26
18
  end
@@ -1,3 +1,3 @@
1
1
  module Spassky
2
- VERSION = '0.1.35'
2
+ VERSION = '0.1.36'
3
3
  end
@@ -17,15 +17,17 @@ module Spassky::Client
17
17
  end
18
18
 
19
19
  describe "spassky run" do
20
- it "creates a pusher with the server url as the first argument" do
21
- Pusher.should_receive(:new).with("server_name").and_return(pusher)
22
- TestRunner.should_receive(:new).with(pusher, anything(), anything()).and_return(runner)
23
- Cli.new.run "test_name", "server_name"
20
+ context "with a server url" do
21
+ it "creates a pusher" do
22
+ Pusher.should_receive(:new).with("server_name").and_return(pusher)
23
+ TestRunner.should_receive(:new).with(pusher, anything(), anything()).and_return(runner)
24
+ Cli.new.run "test_pattern", "test_name", "server_name"
25
+ end
24
26
  end
25
27
 
26
- it "runs a single test with the name as the second argument" do
27
- runner.should_receive(:run_tests).with("test_name")
28
- Cli.new.run "test_name", "server_name"
28
+ it "runs a test" do
29
+ runner.should_receive(:run_tests).with("test_pattern", "test_name")
30
+ Cli.new.run "test_pattern", "test_name", "server_name"
29
31
  end
30
32
 
31
33
  context "without colour output option" do
@@ -33,7 +35,7 @@ module Spassky::Client
33
35
  default_writer = mock :default_writer
34
36
  DefaultWriter.should_receive(:new).with(STDOUT).and_return(default_writer)
35
37
  TestRunner.should_receive(:new).with(anything(), default_writer, anything())
36
- Cli.new.run "test_name", "server_name"
38
+ Cli.new.run "test_pattern", "test_name", "server_name"
37
39
  end
38
40
  end
39
41
 
@@ -42,7 +44,7 @@ module Spassky::Client
42
44
  coloured_writer = mock :coloured_writer
43
45
  ColouredWriter.should_receive(:new).with(STDOUT).and_return(coloured_writer)
44
46
  TestRunner.should_receive(:new).with(anything(), coloured_writer, anything())
45
- Cli.new.run "test_name", "server_name", "--colour"
47
+ Cli.new.run "test_pattern", "test_name", "server_name", "--colour"
46
48
  end
47
49
  end
48
50
  end
@@ -41,19 +41,19 @@ module Spassky::Client
41
41
  it "reads a test" do
42
42
  @test_pusher.stub!(:push)
43
43
  @directory_reader.should_receive(:read_files).and_return(:file_body)
44
- @test_runner.run_tests("foo_test")
44
+ @test_runner.run_tests("foo_test", "test name")
45
45
  end
46
46
 
47
- it "gets the test name from the base name of the pattern and pushes the test" do
47
+ it "pushes the test" do
48
48
  @test_pusher.should_receive(:push).with({:name => 'foo_test', :contents => { "test.html" => "contents" }.to_json })
49
- @test_runner.run_tests("path/to/foo_test")
49
+ @test_runner.run_tests("path/to/test", "foo_test")
50
50
  end
51
51
 
52
52
  context "timeout" do
53
53
  it 'returns a exit status of 2' do
54
54
  @test_pusher.stub!(:push).and_yield(new_timeout_test_result)
55
55
  Kernel.should_receive(:exit).with(2)
56
- @test_runner.run_tests("foo_test")
56
+ @test_runner.run_tests("foo_test", "test name")
57
57
  end
58
58
  end
59
59
 
@@ -64,12 +64,12 @@ module Spassky::Client
64
64
 
65
65
  it "only writes once" do
66
66
  @writer.should_receive(:write_failing).once
67
- @test_runner.run_tests("foo_test")
67
+ @test_runner.run_tests("foo_test", "test name")
68
68
  end
69
69
 
70
70
  it "writes out an error code" do
71
71
  Kernel.should_receive(:exit).with(1)
72
- @test_runner.run_tests("foo_test")
72
+ @test_runner.run_tests("foo_test", "test name")
73
73
  end
74
74
  end
75
75
 
@@ -77,7 +77,7 @@ module Spassky::Client
77
77
  it "writes passing output" do
78
78
  @test_pusher.stub!(:push).and_yield(new_passed_test_result)
79
79
  @writer.should_receive(:write_passing).with("pass summary")
80
- @test_runner.run_tests("foo_test")
80
+ @test_runner.run_tests("foo_test", "test name")
81
81
  end
82
82
  end
83
83
 
@@ -88,12 +88,12 @@ module Spassky::Client
88
88
 
89
89
  it "writes out the error" do
90
90
  @writer.should_receive(:write_failing).with("hell")
91
- @test_runner.run_tests("foo_test")
91
+ @test_runner.run_tests("foo_test", "test name")
92
92
  end
93
93
 
94
94
  it "exits with an error code" do
95
95
  Kernel.should_receive(:exit).with(1)
96
- @test_runner.run_tests("foo_test")
96
+ @test_runner.run_tests("foo_test", "test name")
97
97
  end
98
98
  end
99
99
 
@@ -103,7 +103,7 @@ module Spassky::Client
103
103
  @writer = mock(:writer)
104
104
  @writer.should_not_receive(:write_passing)
105
105
  @writer.should_not_receive(:write_failing)
106
- TestRunner.new(@test_pusher, @writer, @directory_reader).run_tests("foo_test")
106
+ TestRunner.new(@test_pusher, @writer, @directory_reader).run_tests("foo_test", "test name")
107
107
  end
108
108
  end
109
109
 
@@ -113,7 +113,7 @@ module Spassky::Client
113
113
  pass_test_result = new_passed_test_result
114
114
  @test_pusher.stub!(:push).and_yield(in_progress_test_result).and_yield(pass_test_result)
115
115
  @writer.should_receive(:write_passing).with("pass summary").once
116
- @test_runner.run_tests("foo_test")
116
+ @test_runner.run_tests("foo_test", "test name")
117
117
  end
118
118
  end
119
119
 
@@ -131,7 +131,7 @@ module Spassky::Client
131
131
  @writer.should_receive(:write_passing).with("PASS foo on ipad").once
132
132
  @writer.should_receive(:write_failing).with("FAIL bar on iphone").once
133
133
 
134
- @test_runner.run_tests("foo bar")
134
+ @test_runner.run_tests("foo bar", "test name")
135
135
  end
136
136
  end
137
137
 
@@ -147,7 +147,7 @@ module Spassky::Client
147
147
 
148
148
  @writer.should_receive(:write_failing).with("test result message").once
149
149
 
150
- @test_runner.run_tests("foo bar")
150
+ @test_runner.run_tests("foo bar", "test name")
151
151
  end
152
152
  end
153
153
  end
@@ -111,15 +111,6 @@ module Spassky::Server
111
111
  end
112
112
  end
113
113
 
114
- context "file name is not a file" do
115
- it "returns the first file that ends with .html" do
116
- test = mock(:test, :name => "directory/test_name.html", :contents => @test_contents)
117
- TestRun.stub!(:find).with('123').and_return(test)
118
- get "/test_runs/123/run/random/not_a_file"
119
- last_response.body.should include("actual test!")
120
- end
121
- end
122
-
123
114
  context "with a file that is in a subdirectory" do
124
115
  it "returns the file" do
125
116
  test = mock(:test, :name => "test_name", :contents => @test_contents)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spassky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.35
4
+ version: 0.1.36
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,7 +15,7 @@ date: 2011-09-09 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client
18
- requirement: &70126581990920 !ruby/object:Gem::Requirement
18
+ requirement: &70322539873180 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70126581990920
26
+ version_requirements: *70322539873180
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
- requirement: &70126581989580 !ruby/object:Gem::Requirement
29
+ requirement: &70322539872120 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '0'
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *70126581989580
37
+ version_requirements: *70322539872120
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: sinatra
40
- requirement: &70126581988300 !ruby/object:Gem::Requirement
40
+ requirement: &70322539870440 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *70126581988300
48
+ version_requirements: *70322539870440
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rainbow
51
- requirement: &70126581986260 !ruby/object:Gem::Requirement
51
+ requirement: &70322539868280 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: '0'
57
57
  type: :runtime
58
58
  prerelease: false
59
- version_requirements: *70126581986260
59
+ version_requirements: *70322539868280
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: wurfl-lite
62
- requirement: &70126581984940 !ruby/object:Gem::Requirement
62
+ requirement: &70322539867280 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: '0'
68
68
  type: :runtime
69
69
  prerelease: false
70
- version_requirements: *70126581984940
70
+ version_requirements: *70322539867280
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: commandable
73
- requirement: &70126581983900 !ruby/object:Gem::Requirement
73
+ requirement: &70322539866380 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ! '>='
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: '0'
79
79
  type: :runtime
80
80
  prerelease: false
81
- version_requirements: *70126581983900
81
+ version_requirements: *70322539866380
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: rake
84
- requirement: &70126581982900 !ruby/object:Gem::Requirement
84
+ requirement: &70322539865040 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ! '>='
@@ -89,10 +89,10 @@ dependencies:
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
- version_requirements: *70126581982900
92
+ version_requirements: *70322539865040
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: rspec
95
- requirement: &70126581981960 !ruby/object:Gem::Requirement
95
+ requirement: &70322539863940 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - ! '>='
@@ -100,10 +100,10 @@ dependencies:
100
100
  version: '0'
101
101
  type: :development
102
102
  prerelease: false
103
- version_requirements: *70126581981960
103
+ version_requirements: *70322539863940
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: cucumber
106
- requirement: &70126581980780 !ruby/object:Gem::Requirement
106
+ requirement: &70322539863140 !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
109
109
  - - ! '>='
@@ -111,10 +111,10 @@ dependencies:
111
111
  version: '0'
112
112
  type: :development
113
113
  prerelease: false
114
- version_requirements: *70126581980780
114
+ version_requirements: *70322539863140
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: capybara
117
- requirement: &70126581979720 !ruby/object:Gem::Requirement
117
+ requirement: &70322539861800 !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements:
120
120
  - - ! '>='
@@ -122,10 +122,10 @@ dependencies:
122
122
  version: '0'
123
123
  type: :development
124
124
  prerelease: false
125
- version_requirements: *70126581979720
125
+ version_requirements: *70322539861800
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: aruba
128
- requirement: &70126581978220 !ruby/object:Gem::Requirement
128
+ requirement: &70322539860960 !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
131
  - - ! '>='
@@ -133,10 +133,10 @@ dependencies:
133
133
  version: '0'
134
134
  type: :development
135
135
  prerelease: false
136
- version_requirements: *70126581978220
136
+ version_requirements: *70322539860960
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: fakefs
139
- requirement: &70126581977420 !ruby/object:Gem::Requirement
139
+ requirement: &70322539859900 !ruby/object:Gem::Requirement
140
140
  none: false
141
141
  requirements:
142
142
  - - ! '>='
@@ -144,10 +144,10 @@ dependencies:
144
144
  version: '0'
145
145
  type: :development
146
146
  prerelease: false
147
- version_requirements: *70126581977420
147
+ version_requirements: *70322539859900
148
148
  - !ruby/object:Gem::Dependency
149
149
  name: ruby-debug19
150
- requirement: &70126581976620 !ruby/object:Gem::Requirement
150
+ requirement: &70322539858760 !ruby/object:Gem::Requirement
151
151
  none: false
152
152
  requirements:
153
153
  - - ! '>='
@@ -155,10 +155,10 @@ dependencies:
155
155
  version: '0'
156
156
  type: :development
157
157
  prerelease: false
158
- version_requirements: *70126581976620
158
+ version_requirements: *70322539858760
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: factory_girl
161
- requirement: &70126581975680 !ruby/object:Gem::Requirement
161
+ requirement: &70322539857760 !ruby/object:Gem::Requirement
162
162
  none: false
163
163
  requirements:
164
164
  - - ! '>='
@@ -166,7 +166,7 @@ dependencies:
166
166
  version: '0'
167
167
  type: :development
168
168
  prerelease: false
169
- version_requirements: *70126581975680
169
+ version_requirements: *70322539857760
170
170
  description: ''
171
171
  email:
172
172
  - andrew.vos@gmail.com