Create FindsBin spec (#18992)

This commit is contained in:
Mac Siri 2023-01-26 10:46:18 -05:00 committed by GitHub
parent d4d7d8f409
commit ec3971a387
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,18 @@
require "rails_helper"
require "cypress-rails/finds_bin"
RSpec.describe CypressRails::FindsBin do
describe ".call" do
it "finds the bin file" do
allow(ENV).to receive(:[]).with("KNAPSACK_PRO_CI_NODE_TOTAL").and_return(nil)
allow(ENV).to receive(:[]).with("KNAPSACK_PRO_CI_NODE_INDEX").and_return(nil)
expect(described_class.new.call).to eq("node_modules/.bin/cypress")
end
it "finds the bin file when the bin is not in the default location" do
allow(ENV).to receive(:[]).with("KNAPSACK_PRO_CI_NODE_TOTAL").and_return("1")
allow(ENV).to receive(:[]).with("KNAPSACK_PRO_CI_NODE_INDEX").and_return("1")
expect(described_class.new.call).to eq("node_modules/.bin/knapsack-pro-cypress")
end
end
end