Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit a67cce9

Browse files
liamnicholsm-ruhl
authored andcommitted
Add a test to ensure that xcodegen is installed if it doesn't exist (existing behaviour)
1 parent d0fb8b8 commit a67cce9

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

spec/xcodegen_action_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,23 @@
5858

5959
expect(result).to eq("xcodegen")
6060
end
61+
it "attempts to install `xcodegen` using BrewAction if it doesn't exist" do
62+
# Expect that `which xcodegen` will fail
63+
expect(Fastlane::Actions).to receive(:sh).with("which xcodegen", hash_including(error_callback: anything)) { |command, params|
64+
error_callback = params[:error_callback]
65+
error_callback.call('xcodegen not found')
66+
}
67+
68+
# Expect that the BrewAction is invoked as expected
69+
expect(Fastlane::Actions::BrewAction).to receive(:run).twice
70+
71+
# And that the original command is then run as expected
72+
expect(Fastlane::Actions).to receive(:sh).with("xcodegen")
73+
74+
Fastlane::FastFile.new.parse("lane :test do
75+
xcodegen
76+
end").runner.execute(:test)
77+
end
6178
end
6279
end
6380
end

0 commit comments

Comments
 (0)