Skip to content

Commit f12fa92

Browse files
Merge pull request #42 from browserstack/chore/green-unit-tests
build: verify gem integrity at install time + green the unit-test baseline
2 parents 6a67875 + 524db87 commit f12fa92

4 files changed

Lines changed: 37 additions & 8 deletions

File tree

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
dist/*
22
*.log
33
browserstack.err
4+
5+
# Local Bundler state. .bundle/config can carry settings that weaken install-time
6+
# integrity checks (e.g. disable_checksum_validation), so it must never be committed.
7+
.bundle/
8+
vendor/bundle/

‎Gemfile‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
source "http://rubygems.org"
1+
source "https://rubygems.org"
22
gem "minitest"
33
gem "rake"
4-
gem "json"
4+
# "json" is intentionally NOT listed: lib/ uses the `json` default gem that ships
5+
# with Ruby, and the gemspec declares no dependency on it, so a third-party json
6+
# build is a redundant build-time dependency (and a native extension) to pull in.

‎Gemfile.lock‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
GEM
2-
remote: http://rubygems.org/
2+
remote: https://rubygems.org/
33
specs:
4-
json (1.8.3)
5-
minitest (5.8.4)
6-
rake (12.3.3)
4+
drb (2.2.3)
5+
minitest (6.0.6)
6+
drb (~> 2.0)
7+
prism (~> 1.5)
8+
prism (1.9.0)
9+
rake (13.4.2)
710

811
PLATFORMS
12+
aarch64-linux
13+
arm64-darwin-24
914
ruby
15+
x86_64-linux
1016

1117
DEPENDENCIES
12-
json
1318
minitest
1419
rake
1520

21+
CHECKSUMS
22+
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
23+
minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
24+
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
25+
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
26+
1627
BUNDLED WITH
17-
1.11.2
28+
2.7.1

‎test/browserstack-local-test.rb‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,28 @@ def setup
88
@bs_local = BrowserStack::Local.new
99
end
1010

11+
# The tests below actually start the BrowserStackLocal binary and open a
12+
# tunnel, so they need a valid BROWSERSTACK_ACCESS_KEY and network access.
13+
# Skip them (instead of erroring) when no key is available so the rest of
14+
# the suite stays green in credential-less environments such as CI.
15+
def skip_without_credentials
16+
skip 'requires BROWSERSTACK_ACCESS_KEY (live integration test)' if ENV['BROWSERSTACK_ACCESS_KEY'].to_s.empty?
17+
end
18+
1119
def test_check_pid
20+
skip_without_credentials
1221
@bs_local.start
1322
refute_nil @bs_local.pid, 0
1423
end
1524

1625
def test_is_running
26+
skip_without_credentials
1727
@bs_local.start
1828
assert_equal true, @bs_local.isRunning
1929
end
2030

2131
def test_multiple_binary
32+
skip_without_credentials
2233
@bs_local.start
2334
bs_local_2 = BrowserStack::Local.new
2435
second_log_file = File.join(Dir.pwd, 'local2.log')

0 commit comments

Comments
 (0)