From be7f66784772ac5cf9a5c72eaeef0840f87bb7da Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Tue, 18 Oct 2016 15:21:35 +0300 Subject: [PATCH 1/4] Improve isRunning In Ruby snake case is preferred to camel case. Also, using `?` for booleans. The `!!` will always return `false` instead of some empty value when it is not running. It also allows be_running (or something like that) on rspec. --- lib/browserstack/local.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/browserstack/local.rb b/lib/browserstack/local.rb index 32bc89c..d0ff852 100644 --- a/lib/browserstack/local.rb +++ b/lib/browserstack/local.rb @@ -101,8 +101,8 @@ def start(options = {}) end end - def isRunning - return true if (!@pid.nil? && Process.kill(0, @pid)) rescue false + def running? + !! (!@pid.nil? && Process.kill(0, @pid)) rescue false end def stop From 898bf711177b71854767197e7cea9ed996bd35d4 Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Tue, 18 Oct 2016 18:02:05 +0300 Subject: [PATCH 2/4] Fix test --- test/browserstack-local-test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/browserstack-local-test.rb b/test/browserstack-local-test.rb index 00efef8..96e803c 100644 --- a/test/browserstack-local-test.rb +++ b/test/browserstack-local-test.rb @@ -15,7 +15,7 @@ def test_check_pid def test_is_running @bs_local.start - assert_equal true, @bs_local.isRunning + assert_equal true, @bs_local.is_running end def test_multiple_binary From 39de954d45ef72da6512f8ef2c63d1d1495f93c9 Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Tue, 18 Oct 2016 18:02:42 +0300 Subject: [PATCH 3/4] Rename running? to is_running? --- lib/browserstack/local.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/browserstack/local.rb b/lib/browserstack/local.rb index d0ff852..ff27f1a 100644 --- a/lib/browserstack/local.rb +++ b/lib/browserstack/local.rb @@ -101,7 +101,7 @@ def start(options = {}) end end - def running? + def is_running? !! (!@pid.nil? && Process.kill(0, @pid)) rescue false end From 262fbe5d69564437a1b0e2849f7a016d09ede97f Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Tue, 18 Oct 2016 18:03:41 +0300 Subject: [PATCH 4/4] Forgot an ? in the test --- test/browserstack-local-test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/browserstack-local-test.rb b/test/browserstack-local-test.rb index 96e803c..1d38c5d 100644 --- a/test/browserstack-local-test.rb +++ b/test/browserstack-local-test.rb @@ -15,7 +15,7 @@ def test_check_pid def test_is_running @bs_local.start - assert_equal true, @bs_local.is_running + assert_equal true, @bs_local.is_running? end def test_multiple_binary