selenium_shots 0.2.1 → 0.2.2

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.
@@ -1,52 +1,52 @@
1
1
  module SeleniumShots
2
- module Command
3
- class InvalidCommand < RuntimeError; end
4
- class CommandFailed < RuntimeError; end
2
+ module Command
3
+ class InvalidCommand < RuntimeError; end
4
+ class CommandFailed < RuntimeError; end
5
5
 
6
- class << self
7
- def run(command, args)
8
- run_internal(command, args)
9
- rescue InvalidCommand
10
- display "Unknown command. Run 'selenium_shots help' for usage information."
11
- rescue RestClient::Unauthorized
12
- display "Authentication failure. For more information you can go to http://www.seleniumshots.com"
13
- end
6
+ class << self
7
+ def run(command, args)
8
+ run_internal(command, args)
9
+ rescue InvalidCommand
10
+ display "Unknown command. Run 'selenium_shots help' for usage information."
11
+ rescue RestClient::Unauthorized
12
+ display "Authentication failure. For more information you can go to http://www.seleniumshots.com"
13
+ end
14
14
 
15
- def run_internal(command, args)
16
- namespace, command = parse(command)
17
- require "#{namespace}"
18
- klass = SeleniumShots::Command.const_get(namespace.capitalize).new(args)
19
- raise InvalidCommand unless klass.respond_to?(command)
20
- klass.send(command)
21
- end
15
+ def run_internal(command, args)
16
+ namespace, command = parse(command)
17
+ require "#{namespace}"
18
+ klass = SeleniumShots::Command.const_get(namespace.capitalize).new(args)
19
+ raise InvalidCommand unless klass.respond_to?(command)
20
+ klass.send(command)
21
+ end
22
22
 
23
- def display(msg)
24
- puts(msg)
25
- end
23
+ def display(msg)
24
+ puts(msg)
25
+ end
26
26
 
27
- def parse(command)
28
- parts = command.split(':')
29
- case parts.size
30
- when 1
31
- if namespaces.include? command
32
- return command, 'index'
33
- else
34
- return 'app', command
35
- end
36
- when 2
37
- raise InvalidCommand unless namespaces.include? parts[0]
38
- return parts
39
- else
40
- raise InvalidCommand
41
- end
42
- end
27
+ def parse(command)
28
+ parts = command.split(':')
29
+ case parts.size
30
+ when 1
31
+ if namespaces.include? command
32
+ return command, 'index'
33
+ else
34
+ return 'app', command
35
+ end
36
+ when 2
37
+ raise InvalidCommand unless namespaces.include? parts[0]
38
+ return parts
39
+ else
40
+ raise InvalidCommand
41
+ end
42
+ end
43
43
 
44
- def namespaces
45
- @@namespaces ||= Dir["#{File.dirname(__FILE__)}/commands/*"].map do |namespace|
46
- namespace.gsub(/.*\//, '').gsub(/\.rb/, '')
47
- end
48
- end
49
- end
50
- end
44
+ def namespaces
45
+ @@namespaces ||= Dir["#{File.dirname(__FILE__)}/commands/*"].map do |namespace|
46
+ namespace.gsub(/.*\//, '').gsub(/\.rb/, '')
47
+ end
48
+ end
49
+ end
50
+ end
51
51
  end
52
52
 
@@ -1,16 +1,16 @@
1
1
  module SeleniumShots::Command
2
- class App < Base
2
+ class App < Base
3
3
  def create
4
- name = args.shift.downcase.strip rescue nil
4
+ name = args.shift.downcase.strip rescue nil
5
5
  if name
6
6
  selenium_shots_api_key
7
7
  if make_config_file(name, @api_key) == "y"
8
- display "Created #{name}\nYou can configurate selenium shots on config/selenium_shots.yml"
8
+ display "Created #{name}\nYou can configurate selenium shots on config/selenium_shots.yml"
9
9
  end
10
10
  else
11
11
  display "You need specify a name for your app. Run 'selenium_shots help' for usage information"
12
12
  end
13
13
  end
14
- end
14
+ end
15
15
  end
16
16
 
@@ -1,127 +1,127 @@
1
1
  module SeleniumShots::Command
2
- class Auth < Base
3
- attr_accessor :api_key_hash
2
+ class Auth < Base
3
+ attr_accessor :api_key_hash
4
4
 
5
- def client
6
- @client ||= init_selenium_shots
7
- end
5
+ def client
6
+ @client ||= init_selenium_shots
7
+ end
8
8
 
9
- def init_selenium_shots
10
- SeleniumShots::Client.new(api_key)
11
- end
9
+ def init_selenium_shots
10
+ SeleniumShots::Client.new(api_key)
11
+ end
12
12
 
13
- def api_key
13
+ def api_key
14
14
  get_api_key
15
- end
15
+ end
16
16
 
17
17
  def get_api_key_from_host
18
18
  RestClient.post 'http://seleniumshots.com/selenium_tests/get_api_key', :user_session => { :email => @api_key_hash[0],
19
19
  :password => @api_key_hash[1]}
20
20
  end
21
21
 
22
- def api_key_file
23
- "#{home_directory}/.selenium_shots/api_key"
24
- end
25
-
26
- def get_api_key
27
- return if @api_key_hash
28
- unless @api_key_hash = read_api_key
29
- @api_key_hash = ask_for_api_key
30
- save_api_key
31
- end
32
- @api_key_hash
33
- end
34
-
35
- def read_api_key
36
- if File.exists? api_key_file
37
- return File.read(api_key_file).split("\n")
38
- end
39
- end
40
-
41
- def echo_off
42
- system "stty -echo"
43
- end
44
-
45
- def echo_on
46
- system "stty echo"
47
- end
48
-
49
- def ask_for_api_key
50
- puts "Enter your SeleniumShots Account"
51
-
52
- print "Email: "
53
- user = ask
54
-
55
- print "Password: "
56
- password = running_on_windows? ? ask_for_password_on_windows : ask_for_password
57
-
58
- [ user, password ]
59
- end
60
-
61
- def ask_for_password_on_windows
62
- require "Win32API"
63
- char = nil
64
- password = ''
65
-
66
- while char = Win32API.new("crtdll", "_getch", [ ], "L").Call do
67
- break if char == 10 || char == 13 # received carriage return or newline
68
- if char == 127 || char == 8 # backspace and delete
69
- password.slice!(-1, 1)
70
- else
71
- password << char.chr
72
- end
73
- end
74
- puts
75
- return password
76
- end
77
-
78
- def ask_for_password
79
- echo_off
80
- password = ask
81
- puts
82
- echo_on
83
- return password
84
- end
85
-
86
- def save_api_key
87
- begin
22
+ def api_key_file
23
+ "#{home_directory}/.selenium_shots/api_key"
24
+ end
25
+
26
+ def get_api_key
27
+ return if @api_key_hash
28
+ unless @api_key_hash = read_api_key
29
+ @api_key_hash = ask_for_api_key
30
+ save_api_key
31
+ end
32
+ @api_key_hash
33
+ end
34
+
35
+ def read_api_key
36
+ if File.exists? api_key_file
37
+ return File.read(api_key_file).split("\n")
38
+ end
39
+ end
40
+
41
+ def echo_off
42
+ system "stty -echo"
43
+ end
44
+
45
+ def echo_on
46
+ system "stty echo"
47
+ end
48
+
49
+ def ask_for_api_key
50
+ puts "Enter your SeleniumShots Account"
51
+
52
+ print "Email: "
53
+ user = ask
54
+
55
+ print "Password: "
56
+ password = running_on_windows? ? ask_for_password_on_windows : ask_for_password
57
+
58
+ [ user, password ]
59
+ end
60
+
61
+ def ask_for_password_on_windows
62
+ require "Win32API"
63
+ char = nil
64
+ password = ''
65
+
66
+ while char = Win32API.new("crtdll", "_getch", [ ], "L").Call do
67
+ break if char == 10 || char == 13 # received carriage return or newline
68
+ if char == 127 || char == 8 # backspace and delete
69
+ password.slice!(-1, 1)
70
+ else
71
+ password << char.chr
72
+ end
73
+ end
74
+ puts
75
+ return password
76
+ end
77
+
78
+ def ask_for_password
79
+ echo_off
80
+ password = ask
81
+ puts
82
+ echo_on
83
+ return password
84
+ end
85
+
86
+ def save_api_key
87
+ begin
88
88
  @api_key_hash = get_api_key_from_host
89
- write_api_key
90
- rescue RestClient::Unauthorized => e
91
- delete_api_key
92
- raise e unless retry_login?
93
- display "\nAuthentication failed"
94
- @api_key_hash = ask_for_api_key
95
- @client = init_selenium_shots
96
- retry
97
- rescue Exception => e
98
- delete_api_key
99
- raise e
100
- end
101
- end
102
-
103
- def retry_login?
104
- @login_attempts ||= 0
105
- @login_attempts += 1
106
- @login_attempts < 3
107
- end
108
-
109
- def write_api_key
110
- FileUtils.mkdir_p(File.dirname(api_key_file))
111
- File.open(api_key_file, 'w') do |f|
112
- f.puts self.api_key_hash
113
- end
114
- set_api_key_permissions
115
- end
116
-
117
- def set_api_key_permissions
118
- FileUtils.chmod 0700, File.dirname(api_key_file)
119
- FileUtils.chmod 0600, api_key_file
120
- end
121
-
122
- def delete_api_key
123
- FileUtils.rm_f(api_key_file)
124
- end
125
- end
89
+ write_api_key
90
+ rescue RestClient::Unauthorized => e
91
+ delete_api_key
92
+ raise e unless retry_login?
93
+ display "\nAuthentication failed"
94
+ @api_key_hash = ask_for_api_key
95
+ @client = init_selenium_shots
96
+ retry
97
+ rescue Exception => e
98
+ delete_api_key
99
+ raise e
100
+ end
101
+ end
102
+
103
+ def retry_login?
104
+ @login_attempts ||= 0
105
+ @login_attempts += 1
106
+ @login_attempts < 3
107
+ end
108
+
109
+ def write_api_key
110
+ FileUtils.mkdir_p(File.dirname(api_key_file))
111
+ File.open(api_key_file, 'w') do |f|
112
+ f.puts self.api_key_hash
113
+ end
114
+ set_api_key_permissions
115
+ end
116
+
117
+ def set_api_key_permissions
118
+ FileUtils.chmod 0700, File.dirname(api_key_file)
119
+ FileUtils.chmod 0600, api_key_file
120
+ end
121
+
122
+ def delete_api_key
123
+ FileUtils.rm_f(api_key_file)
124
+ end
125
+ end
126
126
  end
127
127
 
@@ -1,39 +1,39 @@
1
1
  require 'fileutils'
2
2
 
3
3
  module SeleniumShots::Command
4
- class Base
5
- attr_accessor :args
6
- def initialize(args)
7
- @args = args
8
- end
4
+ class Base
5
+ attr_accessor :args
6
+ def initialize(args)
7
+ @args = args
8
+ end
9
9
 
10
- def selenium_shots
11
- @selenium_shots ||= SeleniumShots::Command.run_internal('auth:client', args)
12
- end
10
+ def selenium_shots
11
+ @selenium_shots ||= SeleniumShots::Command.run_internal('auth:client', args)
12
+ end
13
13
 
14
14
  def selenium_shots_api_key
15
15
  @api_key ||= SeleniumShots::Command.run_internal('auth:api_key', args)
16
16
  end
17
17
 
18
- def display(msg, newline=true)
19
- newline ? puts(msg) : print(msg)
20
- end
18
+ def display(msg, newline=true)
19
+ newline ? puts(msg) : print(msg)
20
+ end
21
21
 
22
- def ask
23
- gets.strip
24
- end
22
+ def ask
23
+ gets.strip
24
+ end
25
25
 
26
- def shell(cmd)
27
- `#{cmd}`
28
- end
26
+ def shell(cmd)
27
+ `#{cmd}`
28
+ end
29
29
 
30
- def home_directory
31
- running_on_windows? ? ENV['USERPROFILE'] : ENV['HOME']
32
- end
30
+ def home_directory
31
+ running_on_windows? ? ENV['USERPROFILE'] : ENV['HOME']
32
+ end
33
33
 
34
- def running_on_windows?
35
- RUBY_PLATFORM =~ /mswin32/
36
- end
34
+ def running_on_windows?
35
+ RUBY_PLATFORM =~ /mswin32/
36
+ end
37
37
 
38
38
  def config_file
39
39
  'config/selenium_shots.yml'
@@ -42,8 +42,8 @@ module SeleniumShots::Command
42
42
 
43
43
  def ask_for_config_file
44
44
  if File.exists?(config_file)
45
- print "The file config/selenium_shots.yml exists, do you want overwrite this? (y/n): "
46
- ask
45
+ print "The file config/selenium_shots.yml exists, do you want overwrite this? (y/n): "
46
+ ask
47
47
  else
48
48
  "y"
49
49
  end
@@ -62,14 +62,14 @@ browsers:
62
62
  - IE8 on XP
63
63
  - Firefox3.6 on XP
64
64
  EOFILE
65
- File.open(config_file, 'w') do |f|
66
- f.puts config_file_hash
67
- end
65
+ File.open(config_file, 'w') do |f|
66
+ f.puts config_file_hash
67
+ end
68
68
  end
69
69
  overwrite_or_create_file
70
70
  end
71
71
 
72
- end
72
+ end
73
73
 
74
74
  end
75
75
 
@@ -1,11 +1,11 @@
1
1
  module SeleniumShots::Command
2
- class Help < Base
3
- def index
4
- display usage
5
- end
2
+ class Help < Base
3
+ def index
4
+ display usage
5
+ end
6
6
 
7
- def usage
8
- usage = <<EOTXT
7
+ def usage
8
+ usage = <<EOTXT
9
9
  === General Commands
10
10
 
11
11
  help # show this usage
@@ -18,7 +18,7 @@ module SeleniumShots::Command
18
18
  (...make edits...)
19
19
  selenium_shots create example_one
20
20
  EOTXT
21
- end
22
- end
21
+ end
22
+ end
23
23
  end
24
24
 
@@ -96,6 +96,7 @@ class SeleniumShots < ActionController::IntegrationTest
96
96
  run_browser(browser_spec, block)
97
97
  @error = nil
98
98
  rescue => error
99
+ @browser.close_current_browser_session if @browser
99
100
  @error = error.message
100
101
  if @error.match(/Failed to start new browser session/) && SeleniumConfig.mode == "local"
101
102
  @tmp_browsers ||= local_browsers
@@ -107,8 +108,8 @@ class SeleniumShots < ActionController::IntegrationTest
107
108
  end
108
109
  end
109
110
  end
110
- assert @error.nil?, "Expected zero failures or errors, but got #{@error}\n"
111
111
  end
112
+ assert @error.nil?, "Expected zero failures or errors, but got #{@error}\n"
112
113
  end
113
114
 
114
115
  def run_browser(browser_spec, block)
@@ -1,26 +1,26 @@
1
1
  require File.dirname(__FILE__) + '/../base'
2
2
 
3
3
  module SeleniumShots::Command
4
- describe App do
5
- before do
6
- @cli = prepare_command(App)
7
- @auth = prepare_command(Auth)
8
- end
4
+ describe App do
5
+ before do
6
+ @cli = prepare_command(App)
7
+ @auth = prepare_command(Auth)
8
+ end
9
9
 
10
- it "creates with a name" do
11
- @cli.stub!(:args).and_return([ 'myapp' ])
10
+ it "creates with a name" do
11
+ @cli.stub!(:args).and_return([ 'myapp' ])
12
12
  @cli.stub!(:selenium_shots_api_key).and_return("api_key")
13
13
  @cli.should_receive(:make_config_file)
14
- @cli.create
15
- end
14
+ @cli.create
15
+ end
16
16
 
17
- it "cant creates app without a name" do
18
- @cli.stub!(:args).and_return([ nil ])
17
+ it "cant creates app without a name" do
18
+ @cli.stub!(:args).and_return([ nil ])
19
19
  @cli.stub!(:selenium_shots_api_key)
20
20
  @cli.should_not_receive(:make_config_file)
21
- @cli.create
22
- end
21
+ @cli.create
22
+ end
23
23
 
24
- end
24
+ end
25
25
  end
26
26
 
@@ -1,83 +1,83 @@
1
1
  require File.dirname(__FILE__) + '/../base'
2
2
 
3
3
  module SeleniumShots::Command
4
- describe Auth do
5
- before do
6
- @cli = prepare_command(Auth)
7
- end
4
+ describe Auth do
5
+ before do
6
+ @cli = prepare_command(Auth)
7
+ end
8
8
 
9
- it "reads api key from the api keys file" do
10
- sandbox = "/tmp/cli_spec_#{Process.pid}"
11
- File.open(sandbox, "w") { |f| f.write "api_key" }
12
- @cli.stub!(:api_key_file).and_return(sandbox)
13
- @cli.read_api_key.should == %w(api_key)
14
- end
9
+ it "reads api key from the api keys file" do
10
+ sandbox = "/tmp/cli_spec_#{Process.pid}"
11
+ File.open(sandbox, "w") { |f| f.write "api_key" }
12
+ @cli.stub!(:api_key_file).and_return(sandbox)
13
+ @cli.read_api_key.should == %w(api_key)
14
+ end
15
15
 
16
- it "takes the apikey from the file" do
17
- @cli.stub!(:read_api_key).and_return(%w(api_key))
18
- @cli.api_key.should == %w(api_key)
19
- end
16
+ it "takes the apikey from the file" do
17
+ @cli.stub!(:read_api_key).and_return(%w(api_key))
18
+ @cli.api_key.should == %w(api_key)
19
+ end
20
20
 
21
- it "asks for api_key when the file doesn't exist" do
22
- sandbox = "/tmp/cli_spec_#{Process.pid}"
23
- FileUtils.rm_rf(sandbox)
24
- @cli.stub!(:api_key_file).and_return(sandbox)
25
- @cli.should_receive(:ask_for_api_key).and_return(['u', 'p'])
26
- @cli.should_receive(:save_api_key)
27
- @cli.get_api_key.should == [ 'u', 'p' ]
28
- end
21
+ it "asks for api_key when the file doesn't exist" do
22
+ sandbox = "/tmp/cli_spec_#{Process.pid}"
23
+ FileUtils.rm_rf(sandbox)
24
+ @cli.stub!(:api_key_file).and_return(sandbox)
25
+ @cli.should_receive(:ask_for_api_key).and_return(['u', 'p'])
26
+ @cli.should_receive(:save_api_key)
27
+ @cli.get_api_key.should == [ 'u', 'p' ]
28
+ end
29
29
 
30
- it "writes the api_key to a file" do
31
- sandbox = "/tmp/cli_spec_#{Process.pid}"
32
- FileUtils.rm_rf(sandbox)
33
- @cli.stub!(:api_key_file).and_return(sandbox)
34
- @cli.stub!(:api_key_hash).and_return(['api_key'])
35
- @cli.should_receive(:set_api_key_permissions)
36
- @cli.write_api_key
37
- File.read(sandbox).should == "api_key\n"
38
- end
30
+ it "writes the api_key to a file" do
31
+ sandbox = "/tmp/cli_spec_#{Process.pid}"
32
+ FileUtils.rm_rf(sandbox)
33
+ @cli.stub!(:api_key_file).and_return(sandbox)
34
+ @cli.stub!(:api_key_hash).and_return(['api_key'])
35
+ @cli.should_receive(:set_api_key_permissions)
36
+ @cli.write_api_key
37
+ File.read(sandbox).should == "api_key\n"
38
+ end
39
39
 
40
- it "sets ~/.selenium_shots/api_key to be readable only by the user" do
41
- sandbox = "/tmp/cli_spec_#{Process.pid}"
42
- FileUtils.rm_rf(sandbox)
43
- FileUtils.mkdir_p(sandbox)
44
- fname = "#{sandbox}/file"
45
- system "touch #{fname}"
46
- @cli.stub!(:api_key_file).and_return(fname)
47
- @cli.set_api_key_permissions
48
- File.stat(sandbox).mode.should == 040700
49
- File.stat(fname).mode.should == 0100600
50
- end
40
+ it "sets ~/.selenium_shots/api_key to be readable only by the user" do
41
+ sandbox = "/tmp/cli_spec_#{Process.pid}"
42
+ FileUtils.rm_rf(sandbox)
43
+ FileUtils.mkdir_p(sandbox)
44
+ fname = "#{sandbox}/file"
45
+ system "touch #{fname}"
46
+ @cli.stub!(:api_key_file).and_return(fname)
47
+ @cli.set_api_key_permissions
48
+ File.stat(sandbox).mode.should == 040700
49
+ File.stat(fname).mode.should == 0100600
50
+ end
51
51
 
52
- it "writes api_key when the account is ok" do
53
- @cli.stub!(:api_key)
54
- @cli.should_receive(:write_api_key)
55
- @cli.should_receive(:get_api_key_from_host).and_return("api_key")
56
- @cli.save_api_key
57
- end
52
+ it "writes api_key when the account is ok" do
53
+ @cli.stub!(:api_key)
54
+ @cli.should_receive(:write_api_key)
55
+ @cli.should_receive(:get_api_key_from_host).and_return("api_key")
56
+ @cli.save_api_key
57
+ end
58
58
 
59
- it "save_api_key deletes the api_key when the resquest api_key is unauthorized" do
60
- @cli.stub!(:write_api_key)
61
- @cli.stub!(:retry_login?).and_return(false)
62
- @cli.should_receive(:get_api_key_from_host).and_raise(RestClient::Unauthorized)
63
- @cli.should_receive(:delete_api_key)
64
- lambda { @cli.save_api_key }.should raise_error(RestClient::Unauthorized)
65
- end
59
+ it "save_api_key deletes the api_key when the resquest api_key is unauthorized" do
60
+ @cli.stub!(:write_api_key)
61
+ @cli.stub!(:retry_login?).and_return(false)
62
+ @cli.should_receive(:get_api_key_from_host).and_raise(RestClient::Unauthorized)
63
+ @cli.should_receive(:delete_api_key)
64
+ lambda { @cli.save_api_key }.should raise_error(RestClient::Unauthorized)
65
+ end
66
66
 
67
67
 
68
- it "asks for login again when not authorized, for three times" do
69
- @cli.stub!(:read_api_key)
70
- @cli.stub!(:write_api_key)
71
- @cli.stub!(:delete_api_key)
72
- @cli.should_receive(:get_api_key_from_host).exactly(3).times.and_raise(RestClient::Unauthorized)
73
- @cli.should_receive(:ask_for_api_key).exactly(4).times
74
- lambda { @cli.save_api_key }.should raise_error(RestClient::Unauthorized)
75
- end
68
+ it "asks for login again when not authorized, for three times" do
69
+ @cli.stub!(:read_api_key)
70
+ @cli.stub!(:write_api_key)
71
+ @cli.stub!(:delete_api_key)
72
+ @cli.should_receive(:get_api_key_from_host).exactly(3).times.and_raise(RestClient::Unauthorized)
73
+ @cli.should_receive(:ask_for_api_key).exactly(4).times
74
+ lambda { @cli.save_api_key }.should raise_error(RestClient::Unauthorized)
75
+ end
76
76
 
77
- it "deletes the api_key file" do
78
- FileUtils.should_receive(:rm_f).with(@cli.api_key_file)
79
- @cli.delete_api_key
80
- end
81
- end
77
+ it "deletes the api_key file" do
78
+ FileUtils.should_receive(:rm_f).with(@cli.api_key_file)
79
+ @cli.delete_api_key
80
+ end
81
+ end
82
82
  end
83
83
 
@@ -1,29 +1,29 @@
1
1
  require File.dirname(__FILE__) + '/../base'
2
2
 
3
3
  module SeleniumShots::Command
4
- describe Base do
5
- before do
6
- @args = [1, 2]
7
- @base = Base.new(@args)
8
- @base.stub!(:display)
9
- end
4
+ describe Base do
5
+ before do
6
+ @args = [1, 2]
7
+ @base = Base.new(@args)
8
+ @base.stub!(:display)
9
+ end
10
10
 
11
- it "initializes the selenium_shots client with the Auth command" do
12
- SeleniumShots::Command.should_receive(:run_internal).with('auth:client', @args)
13
- @base.selenium_shots
14
- end
11
+ it "initializes the selenium_shots client with the Auth command" do
12
+ SeleniumShots::Command.should_receive(:run_internal).with('auth:client', @args)
13
+ @base.selenium_shots
14
+ end
15
15
 
16
16
  it "creates or overwrite the selenium_shots yml file" do
17
- sandbox = "/tmp/cli_spec_selenium_shots"
18
- @base.stub!(:config_file).and_return(sandbox)
17
+ sandbox = "/tmp/cli_spec_selenium_shots"
18
+ @base.stub!(:config_file).and_return(sandbox)
19
19
  @base.should_receive(:ask_for_config_file).and_return("y")
20
20
  @base.make_config_file("myapp", "api_key")
21
21
  File.exists?(sandbox) == true
22
22
  end
23
23
 
24
24
  it "not overwrite the selenium_shots yml file" do
25
- sandbox = "/tmp/cli_spec_selenium_shots"
26
- @base.stub!(:config_file).and_return(sandbox)
25
+ sandbox = "/tmp/cli_spec_selenium_shots"
26
+ @base.stub!(:config_file).and_return(sandbox)
27
27
  @base.should_receive(:ask_for_config_file).and_return("n")
28
28
  @base.make_config_file("myapp", "api_key")
29
29
  File.exists?(sandbox) == false
@@ -33,6 +33,6 @@ module SeleniumShots::Command
33
33
  @base.config_file.should == 'config/selenium_shots.yml'
34
34
  end
35
35
 
36
- end
36
+ end
37
37
  end
38
38
 
@@ -1,22 +1,22 @@
1
1
  require File.dirname(__FILE__) + '/../base'
2
2
 
3
3
  module SeleniumShots::Command
4
- describe Server do
5
- before do
6
- @cli = prepare_command(Server)
7
- end
4
+ describe Server do
5
+ before do
6
+ @cli = prepare_command(Server)
7
+ end
8
8
 
9
- it "run local instance of selenium server" do
10
- @cli.start
9
+ it "run local instance of selenium server" do
10
+ @cli.start
11
11
  File.exists?("/tmp/selenium_shots.pid") == true
12
- end
12
+ end
13
13
 
14
- it "stop local instance of selenium server" do
15
- @cli.stop
14
+ it "stop local instance of selenium server" do
15
+ @cli.stop
16
16
  File.exists?("/tmp/selenium_shots.pid") == false
17
- end
17
+ end
18
18
 
19
19
 
20
- end
20
+ end
21
21
  end
22
22
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kyle J. Ginavan
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-04-23 00:00:00 -05:00
18
+ date: 2010-06-08 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency