repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/plugins_specs/plugin_update_manager_spec.rb
fastlane/spec/plugins_specs/plugin_update_manager_spec.rb
describe Fastlane::PluginUpdateManager do describe "#show_update_status" do before(:each) do ENV.delete("FASTLANE_SKIP_UPDATE_CHECK") end it "does nothing if no updates are available" do Fastlane::PluginUpdateManager.show_update_status end it "prints out a table if updates are available" do plugin_name = 'something' Fastlane::PluginUpdateManager.server_results[plugin_name] = Gem::Version.new('1.1.0') allow(Fastlane::PluginUpdateManager).to receive(:plugin_references).and_return({ plugin_name => { version_number: "0.1.1" } }) rows = [["something", "0.1.1".red, "1.1.0".green]] headings = ["Plugin", "Your Version", "Latest Version"] expect(Terminal::Table).to receive(:new).with({ title: "Plugin updates available".yellow, headings: headings, rows: rows }) Fastlane::PluginUpdateManager.show_update_status end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/plugins_specs/plugin_fetcher_spec.rb
fastlane/spec/plugins_specs/plugin_fetcher_spec.rb
describe Fastlane do describe Fastlane::PluginFetcher do describe "#fetch_gems" do before do current_gem = "yolo" # We have to stub both a specific search, and the general listing stub_request(:get, "https://rubygems.org/api/v1/search.json?page=1&query=fastlane-plugin-#{current_gem}"). to_return(status: 200, body: File.read("./fastlane/spec/fixtures/requests/rubygems_plugin_query.json"), headers: {}) stub_request(:get, "https://rubygems.org/api/v1/search.json?page=2&query=fastlane-plugin-#{current_gem}"). to_return(status: 200, body: [].to_json, headers: {}) stub_request(:get, "https://rubygems.org/api/v1/search.json?page=1&query=fastlane-plugin-"). to_return(status: 200, body: File.read("./fastlane/spec/fixtures/requests/rubygems_plugin_query.json"), headers: {}) stub_request(:get, "https://rubygems.org/api/v1/search.json?page=2&query=fastlane-plugin-"). to_return(status: 200, body: [].to_json, headers: {}) end it "returns all available plugins if no search query is given" do plugins = Fastlane::PluginFetcher.fetch_gems expect(plugins.count).to eq(2) plugin1 = plugins.first expect(plugin1.full_name).to eq("fastlane-plugin-apprepo") expect(plugin1.name).to eq("apprepo") expect(plugin1.homepage).to eq("https://github.com/suculent/fastlane-plugin-apprepo") expect(plugin1.downloads).to eq(113) expect(plugin1.info).to eq("experimental fastlane plugin") end it "returns a filtered set of plugins when a search query is passed" do plugins = Fastlane::PluginFetcher.fetch_gems(search_query: "yolo") expect(plugins.count).to eq(1) expect(plugins.last.name).to eq("yolokit") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/plugins_specs/plugin_info_collector_spec.rb
fastlane/spec/plugins_specs/plugin_info_collector_spec.rb
describe Fastlane::PluginInfoCollector do let(:test_ui) do ui = Fastlane::PluginGeneratorUI.new allow(ui).to receive(:message) allow(ui).to receive(:input).and_raise(":input call was not mocked!") allow(ui).to receive(:confirm).and_raise(":confirm call was not mocked!") ui end before do ["my plugin", "test_name", "my_", "fastlane-whatever", "whatever"].each do |current| stub_plugin_exists_on_rubygems(current, false) end end let(:collector) { Fastlane::PluginInfoCollector.new(test_ui) } describe "#collect_plugin_name" do describe "with no initial input" do it "accepts a valid plugin name" do expect(test_ui).to receive(:input).and_return('test_name') expect(collector.collect_plugin_name).to eq('test_name') end it "offers a correction" do expect(test_ui).to receive(:input).and_return('TEST_NAME') expect(test_ui).to receive(:confirm).and_return(true) expect(collector.collect_plugin_name).to eq('test_name') end it "offers and prompts again if declined" do expect(test_ui).to receive(:input).and_return('TEST NAME') expect(test_ui).to receive(:confirm).and_return(false) expect(test_ui).to receive(:message).with(/can only contain/) expect(test_ui).to receive(:input).and_return('test_name') expect(collector.collect_plugin_name).to eq('test_name') end end describe "with invalid initial input" do it "offers a correction and uses it if accepted" do expect(test_ui).to receive(:confirm).and_return(true) expect(collector.collect_plugin_name('fastlane-whatever')).to eq('whatever') end it "offers and prompts again if declined" do expect(test_ui).to receive(:confirm).and_return(false) expect(test_ui).to receive(:message).with(/can only contain/) expect(test_ui).to receive(:input).and_return('test_name') expect(collector.collect_plugin_name('my plugin')).to eq('test_name') end end describe "with valid initial input" do it "accepts a valid plugin name" do expect(test_ui).not_to(receive(:input)) expect(collector.collect_plugin_name('test_name')).to eq('test_name') end end end describe '#plugin_name_valid?' do it "handles valid plugin name" do expect(collector.plugin_name_valid?('test_name')).to be_truthy end it "handles plugin name with all caps" do expect(collector.plugin_name_valid?('TEST_NAME')).to be_falsey end it "handles plugin name with spaces" do expect(collector.plugin_name_valid?('test name')).to be_falsey end it "handles plugin name with dashes" do expect(collector.plugin_name_valid?('test-name')).to be_falsey end it "handles plugin name containing 'fastlane'" do expect(collector.plugin_name_valid?('test_fastlane_name')).to be_falsey end it "handles plugin name containing 'plugin'" do expect(collector.plugin_name_valid?('test_plugin_name')).to be_falsey end it "handles plugin name starting with 'Fastlane '" do expect(collector.plugin_name_valid?('Fastlane test_name')).to be_falsey end it "handles plugin name starting with '#{Fastlane::PluginManager::FASTLANE_PLUGIN_PREFIX}'" do expect(collector.plugin_name_valid?("#{Fastlane::PluginManager::FASTLANE_PLUGIN_PREFIX}test_name")).to be_falsey end it "handles plugin name with characters we don't want" do expect(collector.plugin_name_valid?('T!EST-na$me ple&ase')).to be_falsey end it "detects if the plugin is already taken on RubyGems.org" do stub_plugin_exists_on_rubygems('already_taken', true) expect(collector.plugin_name_valid?('already_taken')).to be_falsey end end describe '#fix_plugin_name' do it "handles valid plugin name" do expect(collector.fix_plugin_name('test_name')).to eq('test_name') end it "handles plugin name with all caps" do expect(collector.fix_plugin_name('TEST_NAME')).to eq('test_name') end it "handles plugin name with spaces" do expect(collector.fix_plugin_name('test name')).to eq('test_name') end it "handles plugin name with dashes" do expect(collector.fix_plugin_name('test-name')).to eq('test_name') end it "handles plugin name containing 'fastlane'" do expect(collector.fix_plugin_name('test_fastlane_name')).to eq('test_name') end it "handles plugin name containing 'plugin'" do expect(collector.fix_plugin_name('test_plugin_name')).to eq('test_name') end it "handles plugin name starting with 'Fastlane '" do expect(collector.fix_plugin_name('Fastlane test_name')).to eq('test_name') end it "handles plugin name starting with '#{Fastlane::PluginManager::FASTLANE_PLUGIN_PREFIX}'" do expect(collector.fix_plugin_name("#{Fastlane::PluginManager::FASTLANE_PLUGIN_PREFIX}test_name")).to eq('test_name') end it "handles plugin name with characters we don't want" do expect(collector.fix_plugin_name('T!EST-na$me ple&ase')).to eq('test_name_please') end end describe "author collection" do it "accepts a valid author name" do expect(test_ui).to receive(:input).and_return('Fabricio Devtoolio') expect(collector.collect_author).to eq('Fabricio Devtoolio') end it "accepts a valid author name after rejecting an invalid author name" do expect(test_ui).to receive(:input).and_return('') expect(test_ui).to receive(:input).and_return('Fabricio Devtoolio') expect(collector.collect_author).to eq('Fabricio Devtoolio') end it "has an author name from git config" do expect(test_ui).not_to(receive(:input)) expect(collector.collect_author('Fabricio Devtoolio')).to eq('Fabricio Devtoolio') end end describe "author detection" do it "has an email from git config" do expect(FastlaneCore::Helper).to receive(:backticks).with('git config --get user.name', print: FastlaneCore::Globals.verbose?).and_return('Fabricio Devtoolio') expect(collector.detect_author).to eq('Fabricio Devtoolio') end it "does not have an email from git config" do expect(FastlaneCore::Helper).to receive(:backticks).with('git config --get user.name', print: FastlaneCore::Globals.verbose?).and_return('') expect(collector.detect_author).to be(nil) end end describe '#author_valid?' do it "handles valid author" do expect(collector.author_valid?('Fabricio Devtoolio')).to be_truthy end it "handles empty author" do expect(collector.author_valid?('')).to be_falsey end it "handles all-spaces author" do expect(collector.author_valid?(' ')).to be_falsey end end describe "email collection" do it "accepts a provided email" do expect(test_ui).to receive(:input).and_return('fabric.devtools@gmail.com') expect(collector.collect_email).to eq('fabric.devtools@gmail.com') end it "accepts a blank email" do expect(test_ui).to receive(:input).and_return('') expect(collector.collect_email).to eq('') end it "has an email from git config" do expect(test_ui).not_to(receive(:input)) expect(collector.collect_email('fabric.devtools@gmail.com')).to eq('fabric.devtools@gmail.com') end end describe "email detection" do it "has an email from git config" do expect(FastlaneCore::Helper).to receive(:backticks).with('git config --get user.email', print: FastlaneCore::Globals.verbose?).and_return('fabric.devtools@gmail.com') expect(collector.detect_email).to eq('fabric.devtools@gmail.com') end it "does not have email in git config" do expect(FastlaneCore::Helper).to receive(:backticks).with('git config --get user.email', print: FastlaneCore::Globals.verbose?).and_return('') expect(collector.detect_email).to be(nil) end end describe "summary collection" do it "accepts a valid summary" do expect(test_ui).to receive(:input).and_return('summary') expect(collector.collect_summary).to eq('summary') end it "accepts a valid summary after rejecting an invalid summary" do expect(test_ui).to receive(:input).and_return('') expect(test_ui).to receive(:input).and_return('summary') expect(collector.collect_summary).to eq('summary') end end describe "#summary_valid?" do it "handles valid summary" do expect(collector.summary_valid?('summary')).to be_truthy end it "handles an empty summary" do expect(collector.summary_valid?('')).to be_falsey end it "handles all-spaces summary" do expect(collector.summary_valid?(' ')).to be_falsey end end describe "details collection" do it "accepts a valid details" do expect(test_ui).to receive(:input).and_return('details') expect(collector.collect_details).to eq('details') end end describe '#collect_info' do it "returns a PluginInfo summarizing the user input" do expect(test_ui).to receive(:input).and_return('test_name') expect(test_ui).to receive(:input).and_return('Fabricio Devtoolio') expect(test_ui).to receive(:input).and_return('fabric.devtools@gmail.com') expect(test_ui).to receive(:input).and_return('summary') expect(test_ui).to receive(:input).and_return('details') expect(FastlaneCore::Helper).to receive(:backticks).with('git config --get user.email', print: FastlaneCore::Globals.verbose?).and_return('') expect(FastlaneCore::Helper).to receive(:backticks).with('git config --get user.name', print: FastlaneCore::Globals.verbose?).and_return('') info = Fastlane::PluginInfo.new('test_name', 'Fabricio Devtoolio', 'fabric.devtools@gmail.com', 'summary', 'details') expect(collector.collect_info).to eq(info) end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/plugins_specs/plugin_generator_spec.rb
fastlane/spec/plugins_specs/plugin_generator_spec.rb
require 'rubygems' initialized = false test_ui = nil generator = nil tmp_dir = nil oldwd = nil describe Fastlane::PluginGenerator do describe '#generate' do let(:plugin_info) { Fastlane::PluginInfo.new('tester_thing', 'Fabricio Devtoolio', 'fabric.devtools@gmail.com', 'summary', 'details') } let(:plugin_name) { plugin_info.plugin_name } let(:gem_name) { plugin_info.gem_name } let(:require_path) { plugin_info.require_path } let(:author) { plugin_info.author } let(:email) { plugin_info.email } let(:summary) { plugin_info.summary } let(:details) { plugin_info.details } before(:each) do stub_plugin_exists_on_rubygems(plugin_name, false) unless initialized test_ui = Fastlane::PluginGeneratorUI.new allow(test_ui).to receive(:message) allow(test_ui).to receive(:success) allow(test_ui).to receive(:input).and_raise(":input call was not mocked!") allow(test_ui).to receive(:confirm).and_raise(":confirm call was not mocked!") tmp_dir = Dir.mktmpdir oldwd = Dir.pwd Dir.chdir(tmp_dir) generator = Fastlane::PluginGenerator.new(ui: test_ui, dest_root: tmp_dir) expect(FastlaneCore::Helper).to receive(:backticks).with('git config --get user.email', print: FastlaneCore::Globals.verbose?).and_return('') expect(FastlaneCore::Helper).to receive(:backticks).with('git config --get user.name', print: FastlaneCore::Globals.verbose?).and_return('') expect(test_ui).to receive(:input).and_return(plugin_name) expect(test_ui).to receive(:input).and_return(author) expect(test_ui).to receive(:input).and_return(email) expect(test_ui).to receive(:input).and_return(summary) expect(test_ui).to receive(:input).and_return(details) generator.generate initialized = true end end after(:all) do Dir.chdir(oldwd) if oldwd FileUtils.remove_entry(tmp_dir) if tmp_dir test_ui = nil generator = nil tmp_dir = nil oldwd = nil initialized = false end it "creates gem root directory" do expect(File.directory?(File.join(tmp_dir, gem_name))).to be(true) end it "creates a .rspec file" do dot_rspec_file = File.join(tmp_dir, gem_name, '.rspec') expect(File.exist?(dot_rspec_file)).to be(true) dot_rspec_lines = File.read(dot_rspec_file).lines [ "--require spec_helper\n", "--color\n", "--format d\n" ].each do |option| expect(dot_rspec_lines).to include(option) end end it "creates a .gitignore file" do dot_gitignore_file = File.join(tmp_dir, gem_name, '.gitignore') expect(File.exist?(dot_gitignore_file)).to be(true) dot_gitignore_lines = File.read(dot_gitignore_file).lines [ "*.gem\n", "Gemfile.lock\n", "/.yardoc/\n", "/_yardoc/\n", "/doc/\n", "/rdoc/\n" ].each do |item| expect(dot_gitignore_lines).to include(item) end end it "creates a Gemfile" do gemfile = File.join(tmp_dir, gem_name, 'Gemfile') expect(File.exist?(gemfile)).to be(true) gemfile_lines = File.read(gemfile).lines [ "source('https://rubygems.org')", "gem 'bundler'", "gem 'fastlane', '>= #{Fastlane::VERSION}'", "gem 'pry'", "gem 'rake'", "gem 'rspec'", "gem 'rspec_junit_formatter'", "gem 'rubocop', '#{Fastlane::RUBOCOP_REQUIREMENT}'", "gem 'rubocop-performance'", "gem 'rubocop-require_tools'", "gem 'simplecov'", "gemspec" ].each do |line| # Expect them to match approximately, e.g. using regex expect(gemfile_lines).to include("#{line}\n") end end it "creates a plugin.rb file for the plugin" do relative_path = File.join('lib', 'fastlane', 'plugin', "#{plugin_name}.rb") plugin_rb_file = File.join(tmp_dir, gem_name, relative_path) expect(File.exist?(plugin_rb_file)).to be(true) plugin_rb_contents = File.read(plugin_rb_file) Dir.chdir(gem_name) do # Ensure that the require statements inside the plugin.rb contents will resolve correctly lib = File.expand_path('lib') $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) # rubocop:disable Security/Eval # Starting with Ruby 3.3, we must pass the __FILE__ of the actual file location for the all_class method implementation to work. # Also, we expand the relative_path within Dir.chdir, as Dir.chdir on macOS will make it so tmp paths will always be under /private, # while expand_path called from outside of Dir.chdir will not be prefixed by /private eval(plugin_rb_contents, binding, File.expand_path(relative_path), __LINE__) # rubocop:enable Security/Eval # If we evaluate the contents of the generated plugin.rb file, # we'll get the all_classes helper method defined. This ensures # that the syntax is valid, and lets us interrogate the class for # the behavior! action_class = Object.const_get("Fastlane::#{plugin_name.fastlane_class}") all_classes = action_class.all_classes expect(all_classes).to contain_exactly( File.expand_path("lib/#{plugin_info.actions_path}/#{plugin_name}_action.rb"), File.expand_path("lib/#{plugin_info.helper_path}/#{plugin_name}_helper.rb") ) # Get the relative paths to require, check that they have already been required. require_paths = all_classes.map { |c| c.gsub(lib + '/', '').gsub('.rb', '') } require_paths.each { |path| expect(require(path)).to be(false) } end end it "creates a README that contains the gem name" do readme_file = File.join(tmp_dir, gem_name, 'README.md') expect(File.exist?(readme_file)).to be(true) readme_contents = File.read(readme_file) expect(readme_contents).to include(gem_name) expect(readme_contents.length).to be > 100 end it "creates a module for the VERSION" do # We'll be asserting that this file is valid Ruby when we check # the value of the version as evaluated by the gemspec! expect(File.exist?(File.join(tmp_dir, gem_name, 'lib', require_path, 'version.rb'))).to be(true) end it "creates a LICENSE" do readme_file = File.join(tmp_dir, gem_name, 'LICENSE') expect(File.exist?(readme_file)).to be(true) readme_contents = File.read(readme_file) expect(readme_contents).to include(author) expect(readme_contents).to include(email) expect(readme_contents.length).to be > 100 end it "creates a Action class" do action_file = File.join(tmp_dir, gem_name, 'lib', plugin_info.actions_path, "#{plugin_name}_action.rb") expect(File.exist?(action_file)).to be(true) action_contents = File.read(action_file) # rubocop:disable Security/Eval eval(action_contents, nil, action_file) # rubocop:enable Security/Eval # If we evaluate the contents of the generated action file, # we'll get the Action class defined. This ensures that the # syntax is valid, and lets us interrogate the class for its # behavior! action_class = Object.const_get("Fastlane::Actions::#{plugin_name.fastlane_class}Action") # Check that the default `run` method behavior calls UI.message expect(UI).to receive(:message).with(/#{plugin_name}/) action_class.run(nil) # Check the default behavior of the rest of the methods expect(action_class.description).to eq(summary) expect(action_class.details).to eq(details) expect(action_class.authors).to eq([author]) expect(action_class.available_options).to eq([]) expect(action_class.is_supported?(:ios)).to be(true) end it "creates a complete, valid gemspec" do gemspec_file = File.join(tmp_dir, gem_name, "#{gem_name}.gemspec") expect(File.exist?(gemspec_file)).to be(true) # Because the gemspec expects to be evaluated from the same directory # it lives in, we need to jump in there while we examine it. Dir.chdir(gem_name) do # If we evaluate the contents of the generated gemspec file, # we'll get the Gem Specification object back out, which # ensures that the syntax is valid, and lets us interrogate # the values! # # rubocop:disable Security/Eval gemspec = eval(File.read(gemspec_file)) # rubocop:enable Security/Eval expect(gemspec.name).to eq(gem_name) expect(gemspec.author).to eq(author) expect(gemspec.version).to eq(Gem::Version.new('0.1.0')) expect(gemspec.email).to eq(email) expect(gemspec.summary).to eq(summary) expect(gemspec.development_dependencies).to eq([]) end end it "creates a valid helper class" do helper_file = File.join(tmp_dir, gem_name, 'lib', plugin_info.helper_path, "#{plugin_info.plugin_name}_helper.rb") expect(File.exist?(helper_file)).to be(true) helper_contents = File.read(helper_file) # rubocop:disable Security/Eval eval(helper_contents) # rubocop:enable Security/Eval # If we evaluate the contents of the generated helper file, # we'll get the helper class defined. This ensures that the # syntax is valid, and lets us interrogate the class for its # behavior! helper_class = Object.const_get("Fastlane::Helper::#{plugin_name.fastlane_class}Helper") # Check that the class was successfully defined expect(UI).to receive(:message).with(/#{plugin_name}/) helper_class.show_message end it "creates a spec_helper.rb file" do spec_helper_file = File.join(tmp_dir, gem_name, 'spec', 'spec_helper.rb') expect(File.exist?(spec_helper_file)).to be(true) spec_helper_module = Object.const_get("SpecHelper") expect(spec_helper_module).not_to(be(nil)) end it "creates a action_spec.rb file" do action_spec_file = File.join(tmp_dir, gem_name, 'spec', "#{plugin_name}_action_spec.rb") expect(File.exist?(action_spec_file)).to be(true) end it "creates a Rakefile" do rakefile = File.join(tmp_dir, gem_name, 'Rakefile') expect(File.exist?(rakefile)).to be(true) rakefile_contents = File.read(rakefile) expect(rakefile_contents).to eq("require 'bundler/gem_tasks'\n\nrequire 'rspec/core/rake_task'\nRSpec::Core::RakeTask.new\n\nrequire 'rubocop/rake_task'\nRuboCop::RakeTask.new(:rubocop)\n\ntask(default: [:spec, :rubocop])\n") end describe "All tests and style validation of the new plugin are passing" do before (:all) do # let(:gem_name) is not available in before(:all), so pass the directory # in explicitly once instead of making this a before(:each) plugin_sh('bundle install', 'fastlane-plugin-tester_thing') end it "rspec tests are passing" do # Actually run our generated spec as part of this spec #yodawg plugin_sh('bundle exec rspec') expect($?.exitstatus).to eq(0) end it "rubocop validations are passing" do # Actually run our generated spec as part of this spec #yodawg plugin_sh('bundle exec rubocop') expect($?.exitstatus).to eq(0) end it "`rake` runs both rspec and rubocop" do # Actually run our generated spec as part of this spec #yodawg result = plugin_sh('bundle exec rake') expect($?.exitstatus).to eq(0) expect(result).to include("no offenses detected") # rubocop expect(result).to include("example, 0 failures") # rspec end end end private def plugin_sh(command, plugin_path = gem_name) Dir.chdir(plugin_path) { |path| `#{command}` } end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/plugins_specs/plugin_info_spec.rb
fastlane/spec/plugins_specs/plugin_info_spec.rb
describe Fastlane::PluginInfo do describe 'object equality' do it "detects equal PluginInfo objects" do object_a = Fastlane::PluginInfo.new('name', 'Me', 'me@you.com', 'summary', 'details') object_b = Fastlane::PluginInfo.new('name', 'Me', 'me@you.com', 'summary', 'details') expect(object_a).to eq(object_b) end it "detects differing PluginInfo objects" do object_a = Fastlane::PluginInfo.new('name', 'Me', 'me@you.com', 'summary', 'details') object_b = Fastlane::PluginInfo.new('name2', 'Me2', 'me2@you.com', 'summary2', 'details') expect(object_a).not_to(eq(object_b)) end end describe '#gem_name' do it "is equal to the plugin name prepended with ''" do expect(Fastlane::PluginInfo.new('name', 'Me', 'me@you.com', 'summary', 'details').gem_name).to eq("#{Fastlane::PluginManager::FASTLANE_PLUGIN_PREFIX}name") end end describe '#require_path' do it "is equal to the gem name with dashes becoming slashes" do expect(Fastlane::PluginInfo.new('name', 'Me', 'me@you.com', 'summary', 'details').require_path).to eq("fastlane/plugin/name") end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/plugins_specs/plugin_manager_spec.rb
fastlane/spec/plugins_specs/plugin_manager_spec.rb
describe Fastlane do describe Fastlane::PluginManager do let(:plugin_manager) { Fastlane::PluginManager.new } describe "#gemfile_path" do it "returns an absolute path if Gemfile available" do expect(plugin_manager.gemfile_path).to eq(File.expand_path("./Gemfile")) end it "returns nil if no Gemfile available" do expect(Bundler::SharedHelpers).to receive(:default_gemfile).and_raise(Bundler::GemfileNotFound) expect(plugin_manager.gemfile_path).to eq(nil) end end describe "#plugin_prefix" do it "returns the correct value" do expect(Fastlane::PluginManager.plugin_prefix).to eq("fastlane-plugin-") end end describe "#available_gems" do it "returns [] if no Gemfile is available" do allow(Bundler::SharedHelpers).to receive(:default_gemfile).and_raise(Bundler::GemfileNotFound) expect(plugin_manager.available_gems).to eq([]) end it "returns all fastlane plugins with no fastlane_core" do allow(Bundler::SharedHelpers).to receive(:default_gemfile).and_return("./fastlane/spec/fixtures/plugins/Pluginfile1") expect(plugin_manager.available_gems).to eq(["fastlane-plugin-xcversion", "fastlane_core", "hemal"]) end end describe "#available_plugins" do it "returns [] if no Gemfile is available" do allow(Bundler::SharedHelpers).to receive(:default_gemfile).and_raise(Bundler::GemfileNotFound) expect(plugin_manager.available_plugins).to eq([]) end it "returns all fastlane plugins with no fastlane_core" do allow(Bundler::SharedHelpers).to receive(:default_gemfile).and_return("./fastlane/spec/fixtures/plugins/Pluginfile1") expect(plugin_manager.available_plugins).to eq(["fastlane-plugin-xcversion"]) end end describe "#plugin_is_added_as_dependency?" do before do allow(Bundler::SharedHelpers).to receive(:default_gemfile).and_return("./fastlane/spec/fixtures/plugins/Pluginfile1") end it "returns true if a plugin is available" do expect(plugin_manager.plugin_is_added_as_dependency?('fastlane-plugin-xcversion')).to eq(true) end it "returns false if a plugin is available" do expect(plugin_manager.plugin_is_added_as_dependency?('fastlane-plugin-hemal')).to eq(false) end it "raises an error if parameter doesn't start with fastlane plugin prefix" do expect do plugin_manager.plugin_is_added_as_dependency?('hemal') end.to raise_error("fastlane plugins must start with 'fastlane-plugin-' string") end end describe "#plugins_attached?" do it "returns true if plugins are attached" do allow(Bundler::SharedHelpers).to receive(:default_gemfile).and_return("./fastlane/spec/fixtures/plugins/GemfileWithAttached") expect(plugin_manager.plugins_attached?).to eq(true) end it "returns false if plugins are not attached" do allow(Bundler::SharedHelpers).to receive(:default_gemfile).and_return("./fastlane/spec/fixtures/plugins/GemfileWithoutAttached") expect(plugin_manager.plugins_attached?).to eq(false) end end describe "#install_dependencies!" do it "execs out the correct command" do expect(plugin_manager).to receive(:ensure_plugins_attached!) expect(plugin_manager).to receive(:exec).with("bundle install --quiet && echo 'Successfully installed plugins'") plugin_manager.install_dependencies! end end describe "#update_dependencies!" do before do allow(Bundler::SharedHelpers).to receive(:default_gemfile).and_return("./fastlane/spec/fixtures/plugins/Pluginfile1") end it "execs out the correct command" do expect(plugin_manager).to receive(:ensure_plugins_attached!) expect(plugin_manager).to receive(:exec).with("bundle update fastlane-plugin-xcversion --quiet && echo 'Successfully updated plugins'") plugin_manager.update_dependencies! end end describe "#gem_dependency_suffix" do it "default to RubyGems if gem is available" do expect(Fastlane::PluginManager).to receive(:fetch_gem_info_from_rubygems).and_return({ anything: :really }) expect(plugin_manager.gem_dependency_suffix("fastlane")).to eq("") end describe "Gem is not available on RubyGems.org" do before do expect(Fastlane::PluginManager).to receive(:fetch_gem_info_from_rubygems).and_return(nil) end it "supports specifying a custom local path" do expect(FastlaneCore::UI.ui_object).to receive(:select).and_return("Local Path") expect(FastlaneCore::UI.ui_object).to receive(:input).and_return("../yoo") expect(plugin_manager.gem_dependency_suffix("fastlane")).to eq(", path: '../yoo'") end it "supports specifying a custom git URL" do expect(FastlaneCore::UI.ui_object).to receive(:select).and_return("Git URL") expect(FastlaneCore::UI.ui_object).to receive(:input).and_return("https://github.com/fastlane/fastlane") expect(plugin_manager.gem_dependency_suffix("fastlane")).to eq(", git: 'https://github.com/fastlane/fastlane'") end it "supports falling back to RubyGems" do expect(FastlaneCore::UI.ui_object).to receive(:select).and_return("RubyGems.org ('fastlane' seems to not be available there)") expect(plugin_manager.gem_dependency_suffix("fastlane")).to eq("") end it "supports specifying a custom source" do expect(FastlaneCore::UI.ui_object).to receive(:select).and_return("Other Gem Server") expect(FastlaneCore::UI.ui_object).to receive(:input).and_return("https://gems.mycompany.com") expect(plugin_manager.gem_dependency_suffix("fastlane")).to eq(", source: 'https://gems.mycompany.com'") end end end describe "Previously bundled action" do it "#formerly_bundled_actions returns an array of string" do expect(Fastlane::Actions.formerly_bundled_actions).to be_kind_of(Array) Fastlane::Actions.formerly_bundled_actions.each do |current| expect(current).to be_kind_of(String) end end it "shows how to install a plugin if you want to use a previously bundled action" do deprecated_action = "deprecated" expect(Fastlane::Actions).to receive(:formerly_bundled_actions).and_return([deprecated_action]) expect do result = Fastlane::FastFile.new.parse("lane :test do #{deprecated_action} end").runner.execute(:test) end.to raise_exception("The action '#{deprecated_action}' is no longer bundled with fastlane. You can install it using `fastlane add_plugin deprecated`") end end describe "#add_dependency" do it "shows an error if a dash is used" do pm = Fastlane::PluginManager.new expect(pm).to receive(:pluginfile_path).and_return(".") expect do pm.add_dependency("ya-tu_sabes") end.to raise_error("Plugin name must not contain a '-', did you mean '_'?") end it "works with valid parameters" do pm = Fastlane::PluginManager.new expect(pm).to receive(:pluginfile_path).and_return(".") expect(pm).to receive(:plugin_is_added_as_dependency?).with("fastlane-plugin-tunes").and_return(true) expect(pm).to receive(:ensure_plugins_attached!) pm.add_dependency("tunes") end end describe "Overwriting plugins" do it "shows a warning if a plugin overwrites an existing action" do module Fastlane::SpaceshipStats end pm = Fastlane::PluginManager.new plugin_name = "spaceship_stats" expect(pm).to receive(:available_plugins).and_return([plugin_name]) expect(Fastlane::FastlaneRequire).to receive(:install_gem_if_needed).with(gem_name: plugin_name, require_gem: true) expect(Fastlane::SpaceshipStats).to receive(:all_classes).and_return(["/actions/#{plugin_name}.rb"]) expect(UI).to receive(:important).with("Plugin 'SpaceshipStats' overwrites already loaded action '#{plugin_name}'") expect do pm.load_plugins end.to_not(output(/No actions were found while loading one or more plugins/).to_stdout) end end describe "Plugins not loaded" do it "shows a warning if a plugin isn't loaded" do module Fastlane::Crashlytics end pm = Fastlane::PluginManager.new plugin_name = "crashlytics" expect(pm).to receive(:available_plugins).and_return([plugin_name]) expect(Fastlane::FastlaneRequire).to receive(:install_gem_if_needed).with(gem_name: plugin_name, require_gem: true) expect(pm).to receive(:store_plugin_reference).and_raise(StandardError.new) expect do pm.load_plugins end.to output(/No actions were found while loading one or more plugins/).to_stdout end end describe "Error handling of invalid plugins" do it "shows an appropriate error message when an action is not available, even though a plugin was added" do expect do expect_any_instance_of(Fastlane::PluginManager).to receive(:available_plugins).and_return(["fastlane-plugin-my_custom_plugin"]) result = Fastlane::FastFile.new.parse("lane :test do my_custom_plugin end").runner.execute(:test) end.to raise_exception("Plugin 'my_custom_plugin' was not properly loaded, make sure to follow the plugin docs for troubleshooting: https://docs.fastlane.tools/plugins/plugins-troubleshooting/") end it "shows an appropriate error message when an action is not available, which is not a plugin" do expect do expect_any_instance_of(Fastlane::PluginManager).to receive(:available_plugins).and_return([]) result = Fastlane::FastFile.new.parse("lane :test do my_custom_plugin end").runner.execute(:test) end.to raise_exception("Could not find action, lane or variable 'my_custom_plugin'. Check out the documentation for more details: https://docs.fastlane.tools/actions") end it "shows an appropriate error message when a plugin is really broken" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) ex = ScriptError.new pm = Fastlane::PluginManager.new plugin_name = "broken" expect(pm).to receive(:available_plugins).and_return([plugin_name]) expect(Fastlane::FastlaneRequire).to receive(:install_gem_if_needed).with(gem_name: plugin_name, require_gem: true).and_raise(ex) expect(UI).to receive(:error).with("Error loading plugin '#{plugin_name}': #{ex}") pm.load_plugins expect(pm.plugin_references[plugin_name]).not_to(be_nil) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/broken_files/broken_file.rb
fastlane/spec/fixtures/broken_files/broken_file.rb
module Fastlane module Actions class BrokenAction def run(params) # Missing comma puts { a: 123 b: 345 } end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/fastfiles/import1/actions/hello.rb
fastlane/spec/fixtures/fastfiles/import1/actions/hello.rb
module Fastlane module Actions class HelloAction < Action def self.run(params) UI.message("Param1: #{params[:param1]}") end def self.available_options [ FastlaneCore::ConfigItem.new(key: :param1, optional: false, type: String, default_value: "", description: "Param1") ] end def self.output [ ] end def self.return_value end def self.authors ["lacostej"] end def self.is_supported?(platform) true end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/actions/action_from_action.rb
fastlane/spec/fixtures/actions/action_from_action.rb
module Fastlane module Actions class ActionFromActionAction < Action def self.run(params) return { rocket: other_action.rocket, pwd: other_action.pwd } end def self.is_supported?(platform) true end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/actions/alias_test_no_param.rb
fastlane/spec/fixtures/actions/alias_test_no_param.rb
module Fastlane module Actions class AliasTestNoParamAction < Action attr_accessor :global_test def self.run(params) UI.important(@global_test) end def self.alias_used(action_alias, params) @global_test = "modified" end def self.aliases ["somealias_no_param"] end def self.is_supported?(platform) true end def self.available_options end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/actions/action_from_action_invalid.rb
fastlane/spec/fixtures/actions/action_from_action_invalid.rb
module Fastlane module Actions class ActionFromActionInvalidAction < Action def self.run(params) return rocket # no `other_action` will fail end def self.is_supported?(platform) true end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/actions/alias_no_used_handler.rb
fastlane/spec/fixtures/actions/alias_no_used_handler.rb
module Fastlane module Actions class AliasNoUsedHandlerAction < Action def self.run(params) UI.important("run") end def self.aliases ["alias_no_used_handler_sample_alias"] end def self.is_supported?(platform) true end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/actions/step_text_none_no_params.rb
fastlane/spec/fixtures/actions/step_text_none_no_params.rb
module Fastlane module Actions class StepTextNoneNoParamsAction < Action def self.run(params) UI.important("run") end def self.is_supported?(platform) true end def self.step_text nil end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/actions/step_text_custom_no_params.rb
fastlane/spec/fixtures/actions/step_text_custom_no_params.rb
module Fastlane module Actions class StepTextCustomNoParamsAction < Action def self.run(params) UI.important("run") end def self.is_supported?(platform) true end def self.step_text "Custom Step Text" end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/actions/alias_test.rb
fastlane/spec/fixtures/actions/alias_test.rb
module Fastlane module Actions class AliasTestAction < Action def self.run(params) UI.important(params[:example]) end def self.alias_used(action_alias, params) params[:example] = "modified" end def self.aliases ["somealias"] end def self.is_supported?(platform) true end def self.available_options [ FastlaneCore::ConfigItem.new(key: :example, short_option: "-e", description: "Example Param", optional: true, default_value: "Test String"), FastlaneCore::ConfigItem.new(key: :example_two, short_option: "-t", description: "Example Param", optional: true, default_value: "Test String") ] end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/actions/pwd.rb
fastlane/spec/fixtures/actions/pwd.rb
module Fastlane module Actions class PwdAction < Action def self.run(params) return Dir.pwd end def self.is_supported?(platform) true end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/actions/alias_short_test.rb
fastlane/spec/fixtures/actions/alias_short_test.rb
module Fastlane module Actions class AliasShortTestAction < Action def self.run(params) UI.important(params.join(",")) end def self.alias_used(action_alias, params) params.replace("modified") end def self.aliases ["someshortalias"] end def self.is_supported?(platform) true end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/actions/example_action.rb
fastlane/spec/fixtures/actions/example_action.rb
module Fastlane module Actions class ExampleActionAction < Action def self.run(params) tmp = Dir.mktmpdir tmp_path = File.join(tmp, "example_action.txt") File.write(tmp_path, Time.now.to_i) end def self.is_supported?(platform) true end def self.available_options end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/actions/step_text_custom_with_params.rb
fastlane/spec/fixtures/actions/step_text_custom_with_params.rb
module Fastlane module Actions class StepTextCustomWithParamsAction < Action def self.run(params) UI.important("run") end def self.available_options [ FastlaneCore::ConfigItem.new(key: :task, description: "Task to be printed out") ] end def self.is_supported?(platform) true end def self.step_text(params) "Doing #{params[:task]}" end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/actions/example_action_second.rb
fastlane/spec/fixtures/actions/example_action_second.rb
module Fastlane module Actions class ExampleActionSecondAction def self.run(params) puts('running') end def self.is_supported?(platform) true end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/actions/archive.rb
fastlane/spec/fixtures/actions/archive.rb
module Fastlane module Actions class ArchiveAction < Action def self.run(params) puts('yes') end def self.is_supported?(platform) true end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/plugins/multi_line_description_action.rb
fastlane/spec/fixtures/plugins/multi_line_description_action.rb
require 'fastlane/action' module Fastlane module Actions class MultiLineDescriptionAction < Action def self.run(params) # Do nothing end def self.description 'This is ' \ 'multi line description.' end def self.available_options [ FastlaneCore::ConfigItem.new( key: :hello, description: 'A hello value', optional: true ) ] end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/plugins/single_line_description_action.rb
fastlane/spec/fixtures/plugins/single_line_description_action.rb
require 'fastlane/action' module Fastlane module Actions class SingleLineDescriptionAction < Action def self.run(params) # Do nothing end def self.description "This is single line description." end def self.available_options [ FastlaneCore::ConfigItem.new( key: :hello, description: 'A hello value', optional: true ) ] end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/broken_actions/broken_action.rb
fastlane/spec/fixtures/broken_actions/broken_action.rb
module Fastlane module Actions class BrokenAction # Missing method def self.is_supported?(platform) true end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/fixtures/deprecated_actions/deprecated_action.rb
fastlane/spec/fixtures/deprecated_actions/deprecated_action.rb
module Fastlane module Actions class DeprecatedActionAction < Action def self.run(params) end def self.is_supported?(platform) true end def self.category :deprecated end def self.deprecated_notes "This action is deprecated so do something else instead" end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/notification/slack_spec.rb
fastlane/spec/notification/slack_spec.rb
describe Fastlane::Notification::Slack do describe Fastlane::Notification::Slack::LinkConverter do it 'should convert HTML anchor tag to Slack link format' do { %|Hello <a href="https://fastlane.tools">fastlane</a>| => 'Hello <https://fastlane.tools|fastlane>', %|Hello <a href='https://fastlane.tools'>fastlane</a>| => 'Hello <https://fastlane.tools|fastlane>', %|Hello <a id="foo" href="https://fastlane.tools">fastlane</a>| => 'Hello <https://fastlane.tools|fastlane>', %|Hello <a href="https://fastlane.tools">fastlane</a> <a href="https://github.com/fastlane">GitHub</a>| => 'Hello <https://fastlane.tools|fastlane> <https://github.com/fastlane|GitHub>' }.each do |input, output| expect(described_class.convert(input)).to eq(output) end end it 'should convert Markdown link to Slack link format' do { %|Hello [fastlane](https://fastlane.tools)| => 'Hello <https://fastlane.tools|fastlane>', %|Hello [fastlane](mailto:fastlane@fastlane.tools)| => 'Hello <mailto:fastlane@fastlane.tools|fastlane>', %|Hello [fastlane](https://fastlane.tools) [GitHub](https://github.com/fastlane)| => 'Hello <https://fastlane.tools|fastlane> <https://github.com/fastlane|GitHub>', %|Hello [[fastlane](https://fastlane.tools) in brackets]| => 'Hello [<https://fastlane.tools|fastlane> in brackets]', %|Hello [](https://fastlane.tools)| => 'Hello <https://fastlane.tools>', %|Hello ([fastlane](https://fastlane.tools) in parens)| => 'Hello (<https://fastlane.tools|fastlane> in parens)', %|Hello ([fastlane(:rocket:)](https://fastlane.tools) in parens)| => 'Hello (<https://fastlane.tools|fastlane(:rocket:)> in parens)' }.each do |input, output| expect(described_class.convert(input)).to eq(output) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/modify_services_spec.rb
fastlane/spec/actions_specs/modify_services_spec.rb
require 'produce/service' describe Fastlane do describe Fastlane::FastFile do describe "modify_services" do it 'sends enable and disable with strings, symbols, and booleans' do allow(Produce).to receive(:config) expect(Produce::Service).to receive(:enable) do |options, args| expect(options.push_notification).to eq('on') expect(options.wallet).to eq('on') expect(options.hotspot).to eq('on') expect(options.data_protection).to eq('complete') expect(options.associated_domains).to be_nil expect(options.apple_pay).to be_nil expect(options.multipath).to be_nil end expect(Produce::Service).to receive(:disable) do |options, args| expect(options.associated_domains).to eq('off') expect(options.apple_pay).to eq('off') expect(options.multipath).to eq('off') expect(options.push_notification).to be_nil expect(options.wallet).to be_nil expect(options.hotspot).to be_nil expect(options.data_protection).to be_nil end Fastlane::FastFile.new.parse("lane :test do modify_services( username: 'test.account@gmail.com', app_identifier: 'com.someorg.app', services: { push_notification: 'on', associated_domains: 'off', wallet: :on, apple_pay: :off, data_protection: 'complete', hotspot: true, multipath: false }) end").runner.execute(:test) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/make_changelog_from_jenkins_spec.rb
fastlane/spec/actions_specs/make_changelog_from_jenkins_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "make_jenkins_changelog" do before do ENV['BUILD_URL'] = "https://jenkinsurl.com/JOB/" end after do ENV['BUILD_URL'] = nil end it "returns the fallback if it wasn't able to communicate with the server" do stub_request(:get, "https://jenkinsurl.com/JOB/api/json\?wrapper\=changes\&xpath\=//changeSet//comment"). with(headers: { 'Host' => 'jenkinsurl.com' }). to_timeout result = Fastlane::FastFile.new.parse("lane :test do make_changelog_from_jenkins(fallback_changelog: 'FOOBAR') end").runner.execute(:test) expect(result).to eq("FOOBAR") end it "correctly parses the data if it was able to retrieve it and does not include the commit body" do stub_request(:get, "https://jenkinsurl.com/JOB/api/json\?wrapper\=changes\&xpath\=//changeSet//comment"). with(headers: { 'Host' => 'jenkinsurl.com' }). to_return(status: 200, body: File.read("./fastlane/spec/fixtures/requests/make_jenkins_changelog.json"), headers: {}) result = Fastlane::FastFile.new.parse("lane :test do make_changelog_from_jenkins(fallback_changelog: 'FOOBAR', include_commit_body: false) end").runner.execute(:test) expect(result).to eq("Disable changelog generation from Jenkins until we sort it out\n") end it "correctly parses the data if it was able to retrieve it and include commit body" do stub_request(:get, "https://jenkinsurl.com/JOB/api/json\?wrapper\=changes\&xpath\=//changeSet//comment"). with(headers: { 'Host' => 'jenkinsurl.com' }). to_return(status: 200, body: File.read("./fastlane/spec/fixtures/requests/make_jenkins_changelog.json"), headers: {}) result = Fastlane::FastFile.new.parse("lane :test do make_changelog_from_jenkins(fallback_changelog: 'FOOBAR') end").runner.execute(:test) expect(result).to eq("Disable changelog generation from Jenkins until we sort it out\nThis commit has a body\n") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/s3_spec.rb
fastlane/spec/actions_specs/s3_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "S3 Integration" do it "raise an error to use S3 plugin" do expect do Fastlane::FastFile.new.parse("lane :test do s3({}) end").runner.execute(:test) end.to raise_error("Please use the `aws_s3` plugin instead. Install using `fastlane add_plugin aws_s3`.") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/pem_spec.rb
fastlane/spec/actions_specs/pem_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "PEM Integration" do it "works with no parameters" do result = Fastlane::FastFile.new.parse("lane :test do pem end").runner.execute(:test) end it "support a success callback block" do temp_path = "/tmp/fastlane_callback.txt" File.delete(temp_path) if File.exist?(temp_path) expect(File.exist?(temp_path)).to eq(false) result = Fastlane::FastFile.new.parse("lane :test do pem( new_profile: proc do |value| File.write('#{temp_path}', '1') end ) end").runner.execute(:test) expect(File.exist?(temp_path)).to eq(true) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/last_git_tag_spec.rb
fastlane/spec/actions_specs/last_git_tag_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "last_git_tag" do it "Returns the last git tag" do result = Fastlane::FastFile.new.parse("lane :test do last_git_tag end").runner.execute(:test) tag_name = %w(git rev-list --tags --max-count=1).shelljoin describe = %W(git describe --tags #{tag_name}).shelljoin expect(result).to eq(describe) end it "Returns nothing for jibberish tag pattern match" do tag_pattern = "jibberish" result = Fastlane::FastFile.new.parse("lane :test do last_git_tag(pattern: \"#{tag_pattern}\") end").runner.execute(:test) tag_name = %W(git rev-list --tags=#{tag_pattern} --max-count=1).shelljoin describe = %W(git describe --tags #{tag_name} --match #{tag_pattern}).shelljoin expect(result).to eq(describe) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/supply_spec.rb
fastlane/spec/actions_specs/supply_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "supply" do let(:apk_path) { "app/my.apk" } let(:apk_paths) { ["app/my1.apk", "app/my2.apk"] } let(:wrong_apk_paths) { ['wrong.apk', 'nope.apk'] } let(:aab_path) { "app/bundle.aab" } let(:aab_paths_unique) { ["app/bundle1.aab"] } let(:aab_paths_multiple) { ["app/bundle1.aab", "app/bundle2.aab"] } before :each do allow(File).to receive(:exist?).and_call_original expect(Supply::Uploader).to receive_message_chain(:new, :perform_upload) end describe "single APK path handling" do before :each do allow(File).to receive(:exist?).with(apk_path).and_return(true) end it "uses a provided APK path" do Fastlane::FastFile.new.parse("lane :test do supply(apk: '#{apk_path}') end").runner.execute(:test) expect(Supply.config[:apk]).to eq(apk_path) expect(Supply.config[:apk_paths]).to be_nil expect(Supply.config[:aab]).to be_nil end it "uses the lane context APK path if no other APK info is present" do FastlaneSpec::Env.with_action_context_values(Fastlane::Actions::SharedValues::GRADLE_APK_OUTPUT_PATH => apk_path) do Fastlane::FastFile.new.parse("lane :test do supply end").runner.execute(:test) end expect(Supply.config[:apk]).to eq(apk_path) expect(Supply.config[:apk_paths]).to be_nil expect(Supply.config[:aab]).to be_nil end it "ignores the lane context APK path if the APK param is present" do FastlaneSpec::Env.with_action_context_values(Fastlane::Actions::SharedValues::GRADLE_APK_OUTPUT_PATH => 'app/wrong.apk') do Fastlane::FastFile.new.parse("lane :test do supply(apk: '#{apk_path}') end").runner.execute(:test) end expect(Supply.config[:apk]).to eq(apk_path) expect(Supply.config[:apk_paths]).to be_nil expect(Supply.config[:aab]).to be_nil end it "ignores the lane context APK paths if the APK param is present" do wrong_apk_paths.each do |path| allow(File).to receive(:exist?).with(path).and_return(true) end FastlaneSpec::Env.with_action_context_values(Fastlane::Actions::SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS => wrong_apk_paths) do Fastlane::FastFile.new.parse("lane :test do supply(apk: '#{apk_path}') end").runner.execute(:test) end expect(Supply.config[:apk]).to eq(apk_path) expect(Supply.config[:apk_paths]).to be_nil expect(Supply.config[:aab]).to be_nil end end describe "multiple APK path handling" do before :each do apk_paths.each do |path| allow(File).to receive(:exist?).with(path).and_return(true) end end it "uses the provided APK paths" do Fastlane::FastFile.new.parse("lane :test do supply(apk_paths: #{apk_paths}) end").runner.execute(:test) expect(Supply.config[:apk]).to be_nil expect(Supply.config[:apk_paths]).to eq(apk_paths) expect(Supply.config[:aab]).to be_nil end it "uses the lane context APK paths if no other APK info is present" do FastlaneSpec::Env.with_action_context_values(Fastlane::Actions::SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS => apk_paths) do Fastlane::FastFile.new.parse("lane :test do supply end").runner.execute(:test) end expect(Supply.config[:apk]).to be_nil expect(Supply.config[:apk_paths]).to eq(apk_paths) expect(Supply.config[:aab]).to be_nil end it "ignores the lane context APK paths if the APK paths param is present" do FastlaneSpec::Env.with_action_context_values(Fastlane::Actions::SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS => ['wrong.apk', 'nope.apk']) do Fastlane::FastFile.new.parse("lane :test do supply(apk_paths: #{apk_paths}) end").runner.execute(:test) end expect(Supply.config[:apk]).to be_nil expect(Supply.config[:apk_paths]).to eq(apk_paths) expect(Supply.config[:aab]).to be_nil end it "ignores the lane context APK path if the APK paths param is present" do allow(File).to receive(:exist?).with('wrong.apk').and_return(true) FastlaneSpec::Env.with_action_context_values(Fastlane::Actions::SharedValues::GRADLE_APK_OUTPUT_PATH => 'wrong.apk') do Fastlane::FastFile.new.parse("lane :test do supply(apk_paths: #{apk_paths}) end").runner.execute(:test) end expect(Supply.config[:apk]).to be_nil expect(Supply.config[:apk_paths]).to eq(apk_paths) expect(Supply.config[:aab]).to be_nil end end describe "single AAB path handling" do before :each do allow(File).to receive(:exist?).with(aab_path).and_return(true) end it "uses a provided AAB path" do Fastlane::FastFile.new.parse("lane :test do supply(aab: '#{aab_path}') end").runner.execute(:test) expect(Supply.config[:apk]).to be_nil expect(Supply.config[:apk_paths]).to be_nil expect(Supply.config[:aab]).to eq(aab_path) end it "uses the lane context AAB path if no other AAB info is present" do FastlaneSpec::Env.with_action_context_values(Fastlane::Actions::SharedValues::GRADLE_AAB_OUTPUT_PATH => aab_path) do Fastlane::FastFile.new.parse("lane :test do supply end").runner.execute(:test) end expect(Supply.config[:apk]).to be_nil expect(Supply.config[:apk_paths]).to be_nil expect(Supply.config[:aab]).to eq(aab_path) end it "ignores the lane context AAB path if the AAB param is present" do FastlaneSpec::Env.with_action_context_values(Fastlane::Actions::SharedValues::GRADLE_AAB_OUTPUT_PATH => 'app/wrong.aab') do Fastlane::FastFile.new.parse("lane :test do supply(aab: '#{aab_path}') end").runner.execute(:test) end expect(Supply.config[:apk]).to be_nil expect(Supply.config[:apk_paths]).to be_nil expect(Supply.config[:aab]).to eq(aab_path) end end describe "multiple AAB path handling" do before :each do allow(File).to receive(:exist?).with(aab_path).and_return(true) allow(File).to receive(:exist?).with(aab_paths_unique).and_return(true) aab_paths_multiple.each do |path| allow(File).to receive(:exist?).with(path).and_return(true) end end it "uses the lane context AAB paths if no other AAB info is present" do FastlaneSpec::Env.with_action_context_values(Fastlane::Actions::SharedValues::GRADLE_ALL_AAB_OUTPUT_PATHS => aab_paths_unique) do Fastlane::FastFile.new.parse("lane :test do supply end").runner.execute(:test) end expect(Supply.config[:apk]).to be_nil expect(Supply.config[:apk_paths]).to be_nil expect(Supply.config[:aab]).to eq(aab_paths_unique.first) end it "ignores the lane context AAB paths if the AAB path param is present" do FastlaneSpec::Env.with_action_context_values(Fastlane::Actions::SharedValues::GRADLE_ALL_AAB_OUTPUT_PATHS => aab_paths_unique) do Fastlane::FastFile.new.parse("lane :test do supply(aab: '#{aab_path}') end").runner.execute(:test) end expect(Supply.config[:apk]).to be_nil expect(Supply.config[:apk_paths]).to be_nil expect(Supply.config[:aab]).to eq(aab_path) end it "use the lane context AAB unique path if the AAB paths has multiple values" do FastlaneSpec::Env.with_action_context_values( Fastlane::Actions::SharedValues::GRADLE_ALL_AAB_OUTPUT_PATHS => aab_paths_multiple, Fastlane::Actions::SharedValues::GRADLE_AAB_OUTPUT_PATH => aab_path ) do Fastlane::FastFile.new.parse("lane :test do supply end").runner.execute(:test) end expect(Supply.config[:apk]).to be_nil expect(Supply.config[:apk_paths]).to be_nil expect(Supply.config[:aab]).to eq(aab_path) end it "use the lane context AAB paths first value if both unique and multiple contexts are set" do FastlaneSpec::Env.with_action_context_values( Fastlane::Actions::SharedValues::GRADLE_ALL_AAB_OUTPUT_PATHS => aab_paths_unique, Fastlane::Actions::SharedValues::GRADLE_AAB_OUTPUT_PATH => aab_path ) do Fastlane::FastFile.new.parse("lane :test do supply end").runner.execute(:test) end expect(Supply.config[:apk]).to be_nil expect(Supply.config[:apk_paths]).to be_nil expect(Supply.config[:aab]).to eq(aab_paths_unique.first) end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/set_build_number_repository_spec.rb
fastlane/spec/actions_specs/set_build_number_repository_spec.rb
describe Fastlane do describe Fastlane::FastFile do context "set build number repository" do before do allow(Fastlane::Actions::IncrementBuildNumberAction).to receive(:system).with(/agvtool/).and_return(true) expect(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:run).and_return("asd123") end it "set build number without xcodeproj" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool new[-]version [-]all asd123 && cd [-]/) .and_return("") result = Fastlane::FastFile.new.parse("lane :test do set_build_number_repository end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER]).to eq('asd123') end it "set build number with use_hg_revision_number" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool new[-]version [-]all asd123 && cd [-]/) .and_return("") result = Fastlane::FastFile.new.parse("lane :test do set_build_number_repository( use_hg_revision_number: true ) end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER]).to eq('asd123') end it "set build number with explicit xcodeproj" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool new[-]version [-]all asd123 && cd [-]/) .and_return("") result = Fastlane::FastFile.new.parse("lane :test do set_build_number_repository( xcodeproj: 'asd123/project.xcodeproj' ) end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER]).to eq('asd123') end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/testfairy_spec.rb
fastlane/spec/actions_specs/testfairy_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "TestFairy Integration" do it "raises an error if no parameters were given" do expect do Fastlane::FastFile.new.parse("lane :test do testfairy() end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError) end it "raises an error if no api key was given" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) expect do Fastlane::FastFile.new.parse("lane :test do testfairy({ ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', }) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError, /No API key/) end it "raises an error if no ipa or apk path was given" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) expect do Fastlane::FastFile.new.parse("lane :test do testfairy({ api_key: 'thisistest', }) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError, /No ipa or apk were given/) end it "raises an error if the given ipa path was not found" do expect do Fastlane::FastFile.new.parse("lane :test do testfairy({ api_key: 'thisistest', ipa: './fastlane/nonexistent' }) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError, "Couldn't find ipa file at path './fastlane/nonexistent'") end it "raises an error if the given apk path was not found" do expect do Fastlane::FastFile.new.parse("lane :test do testfairy({ api_key: 'thisistest', apk: './fastlane/nonexistent' }) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError, "Couldn't find apk file at path './fastlane/nonexistent'") end it "raises an error if unknown option given" do expect do Fastlane::FastFile.new.parse("lane :test do testfairy({ api_key: 'thisistest', ipa_path: './fastlane/nonexistent' }) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError, /Could not find option 'ipa_path'/) end it "raises an error if conflicting ipa and apk parameters" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) expect do Fastlane::FastFile.new.parse("lane :test do testfairy({ api_key: 'thisistest', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', apk: './fastlane/spec/fixtures/fastfiles/Fastfile1' }) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError, "Unresolved conflict between options: 'ipa' and 'apk'") end it "works with valid required parameters with ipa" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) expect do Fastlane::FastFile.new.parse("lane :test do testfairy({ ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', api_key: 'thisistest', }) end").runner.execute(:test) end.not_to(raise_error) end it "works with valid required parameters with apk" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) expect do Fastlane::FastFile.new.parse("lane :test do testfairy({ apk: './fastlane/spec/fixtures/fastfiles/Fastfile1', api_key: 'thisistest', }) end").runner.execute(:test) end.not_to(raise_error) end it "works with valid optional parameters" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) expect do Fastlane::FastFile.new.parse("lane :test do testfairy({ ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', api_key: 'thisistest', upload_url: 'https://your-subdomain.testfairy.com', comment: 'Test Comment!', testers_groups: ['group1', 'group2'], custom: 'custom argument', tags: ['tag1', 'tag2', 'tag3'] }) end").runner.execute(:test) end.not_to(raise_error) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/version_bump_podspec_spec.rb
fastlane/spec/actions_specs/version_bump_podspec_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "version_podspec_file" do before do @version_podspec_file = Fastlane::Helper::PodspecHelper.new end it "raises an exception when an incorrect path is given" do expect do Fastlane::Helper::PodspecHelper.new('invalid_podspec') end.to raise_error("Could not find podspec file at path 'invalid_podspec'") end it "raises an exception when there is no version in podspec" do expect do Fastlane::Helper::PodspecHelper.new.parse("") end.to raise_error("Could not find version in podspec content ''") end it "raises an exception when the version is commented-out in podspec" do test_content = '# s.version = "1.3.2"' expect do Fastlane::Helper::PodspecHelper.new.parse(test_content) end.to raise_error("Could not find version in podspec content '#{test_content}'") end context "when semantic version" do it "returns the current version once parsed" do test_content = 'spec.version = "1.3.2"' result = @version_podspec_file.parse(test_content) expect(result).to eq('1.3.2') expect(@version_podspec_file.version_value).to eq('1.3.2') end it "works with CocoaPods 1.4.0 with the new `swift_version` parameter" do test_content = "spec.version = '1.3.2'\nspec.swift_version = '4.0'" result = @version_podspec_file.parse(test_content) expect(result).to eq('1.3.2') expect(@version_podspec_file.version_value).to eq('1.3.2') end it "bumps the patch version when passing 'patch'" do test_content = 'spec.version = "1.3.2"' @version_podspec_file.parse(test_content) result = @version_podspec_file.bump_version('patch') expect(result).to eq('1.3.3') expect(@version_podspec_file.version_value).to eq('1.3.3') end it "bumps the minor version when passing 'minor'" do test_content = 'spec.version = "1.3.2"' @version_podspec_file.parse(test_content) result = @version_podspec_file.bump_version('minor') expect(result).to eq('1.4.0') expect(@version_podspec_file.version_value).to eq('1.4.0') end it "bumps the major version when passing 'major'" do test_content = 'something.version = "1.3.2"' @version_podspec_file.parse(test_content) result = @version_podspec_file.bump_version('major') expect(result).to eq('2.0.0') expect(@version_podspec_file.version_value).to eq('2.0.0') end it "appears to do nothing if reinjecting the same version number" do test_content = 'Pod::Spec.new do |s| s.version = "1.3.2" end' @version_podspec_file.parse(test_content) expect(@version_podspec_file.update_podspec).to eq('Pod::Spec.new do |s| s.version = "1.3.2" end') end it "allows to set a specific appendix" do test_content = 'Pod::Spec.new do |s| s.version = "1.3.2" end' @version_podspec_file.parse(test_content) result = @version_podspec_file.update_version_appendix('5.10') expect(result).to eq('1.3.2.5.10') expect(@version_podspec_file.version_value).to eq('1.3.2.5.10') end it "allows to set a specific version" do test_content = 'Pod::Spec.new do |s| s.version = "1.3.2" end' @version_podspec_file.parse(test_content) expect(@version_podspec_file.update_podspec('2.0.0')).to eq('Pod::Spec.new do |s| s.version = "2.0.0" end') end it "updates only the version when updating podspec" do test_content = 'Pod::Spec.new do |s| s.version = "1.3.2" end' @version_podspec_file.parse(test_content) result = @version_podspec_file.bump_version('major') expect(result).to eq('2.0.0') expect(@version_podspec_file.version_value).to eq('2.0.0') expect(@version_podspec_file.update_podspec).to eq('Pod::Spec.new do |s| s.version = "2.0.0" end') end end context "when not semantic version" do it "returns the current version once parsed" do test_content = 's.version = "1.3.2.5"' result = @version_podspec_file.parse(test_content) expect(result).to eq('1.3.2.5') expect(@version_podspec_file.version_value).to eq('1.3.2.5') end it "bumps the patch version when passing 'patch'" do test_content = 's.version = "1.3.2.5"' @version_podspec_file.parse(test_content) result = @version_podspec_file.bump_version('patch') expect(result).to eq('1.3.3') expect(@version_podspec_file.version_value).to eq('1.3.3') end it "bumps the minor version when passing 'minor'" do test_content = 's.version = "1.3.2.1"' @version_podspec_file.parse(test_content) result = @version_podspec_file.bump_version('minor') expect(result).to eq('1.4.0') expect(@version_podspec_file.version_value).to eq('1.4.0') end it "bumps the major version when passing 'major'" do test_content = 's.version = "1.3.2.3"' @version_podspec_file.parse(test_content) result = @version_podspec_file.bump_version('major') expect(result).to eq('2.0.0') expect(@version_podspec_file.version_value).to eq('2.0.0') end it "appears to do nothing if reinjecting the same version number" do test_content = 'Pod::Spec.new do |s| s.version = "1.3.2.1" end' @version_podspec_file.parse(test_content) expect(@version_podspec_file.update_podspec).to eq('Pod::Spec.new do |s| s.version = "1.3.2.1" end') end it "allows to set a specific appendix" do test_content = 'Pod::Spec.new do |s| s.version = "1.3.2.1" end' @version_podspec_file.parse(test_content) result = @version_podspec_file.update_version_appendix('11.10') expect(result).to eq('1.3.2.11.10') expect(@version_podspec_file.version_value).to eq('1.3.2.11.10') end it "allows to set a specific version" do test_content = 'Pod::Spec.new do |s| s.version = "1.3.2.1" end' @version_podspec_file.parse(test_content) expect(@version_podspec_file.update_podspec('2.0.0.6')).to eq('Pod::Spec.new do |s| s.version = "2.0.0.6" end') end it "updates only the version when updating podspec" do test_content = 'Pod::Spec.new do |s| s.version = "1.3.2" end' @version_podspec_file.parse(test_content) result = @version_podspec_file.bump_version('major') expect(result).to eq('2.0.0') expect(@version_podspec_file.version_value).to eq('2.0.0') expect(@version_podspec_file.update_podspec).to eq('Pod::Spec.new do |s| s.version = "2.0.0" end') end end end describe "version_get_podspec" do it "raises an exception when no path is given" do expect do Fastlane::FastFile.new.parse("lane :test do version_get_podspec end").runner.execute(:test) end.to raise_error("Please pass a path to the `version_get_podspec` action") end it "gets semantic the version from a podspec file" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) result = Fastlane::FastFile.new.parse("lane :test do version_get_podspec(path: './fastlane/spec/fixtures/podspecs/test.podspec') end").runner.execute(:test) expect(result).to eq('1.5.1') end it "gets not semantic the version from a podspec file" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) result = Fastlane::FastFile.new.parse("lane :test do version_get_podspec(path: './fastlane/spec/fixtures/podspecs/test_not_semantic.podspec') end").runner.execute(:test) expect(result).to eq('1.5.1.3') end end describe "version_bump_podspec" do it "raises an exception when no path is given" do expect do Fastlane::FastFile.new.parse("lane :test do version_bump_podspec end").runner.execute(:test) end.to raise_error("Please pass a path to the `version_bump_podspec` action") end context "when semantic version" do before do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) @podspec_path = './fastlane/spec/fixtures/podspecs/test.podspec' end it "bumps patch version when only the path is given" do result = Fastlane::FastFile.new.parse("lane :test do version_bump_podspec(path: '#{@podspec_path}') end").runner.execute(:test) expect(result).to eq('1.5.2') end it "bumps patch version when bump_type is set to patch the path is given" do result = Fastlane::FastFile.new.parse("lane :test do version_bump_podspec(path: '#{@podspec_path}', bump_type: 'patch') end").runner.execute(:test) expect(result).to eq('1.5.2') end it "bumps minor version when bump_type is set to minor the path is given" do result = Fastlane::FastFile.new.parse("lane :test do version_bump_podspec(path: '#{@podspec_path}', bump_type: 'minor') end").runner.execute(:test) expect(result).to eq('1.6.0') end it "bumps major version when bump_type is set to major the path is given" do result = Fastlane::FastFile.new.parse("lane :test do version_bump_podspec(path: '#{@podspec_path}', bump_type: 'major') end").runner.execute(:test) expect(result).to eq('2.0.0') end it "bumps the version when version appendix is given" do result = Fastlane::FastFile.new.parse("lane :test do version_bump_podspec(path: '#{@podspec_path}', version_appendix: '5.1') end").runner.execute(:test) expect(result).to eq('1.5.1.5.1') end end context "when not semantic version" do before do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) @podspec_path = './fastlane/spec/fixtures/podspecs/test_not_semantic.podspec' end it "bumps patch version when only the path is given" do result = Fastlane::FastFile.new.parse("lane :test do version_bump_podspec(path: '#{@podspec_path}') end").runner.execute(:test) expect(result).to eq('1.5.2') end it "bumps patch version when bump_type is set to patch the path is given" do result = Fastlane::FastFile.new.parse("lane :test do version_bump_podspec(path: '#{@podspec_path}', bump_type: 'patch') end").runner.execute(:test) expect(result).to eq('1.5.2') end it "bumps minor version when bump_type is set to minor the path is given" do result = Fastlane::FastFile.new.parse("lane :test do version_bump_podspec(path: '#{@podspec_path}', bump_type: 'minor') end").runner.execute(:test) expect(result).to eq('1.6.0') end it "bumps major version when bump_type is set to major the path is given" do result = Fastlane::FastFile.new.parse("lane :test do version_bump_podspec(path: '#{@podspec_path}', bump_type: 'major') end").runner.execute(:test) expect(result).to eq('2.0.0') end it "bumps the version when version appendix is given" do result = Fastlane::FastFile.new.parse("lane :test do version_bump_podspec(path: '#{@podspec_path}', version_appendix: '5.1') end").runner.execute(:test) expect(result).to eq('1.5.1.5.1') end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/apteligent_spec.rb
fastlane/spec/actions_specs/apteligent_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "apteligent" do it "raises an error if no dsym source has been found" do expect do ENV['DSYM_OUTPUT_PATH'] = nil ENV['DSYM_ZIP_PATH'] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_OUTPUT_PATH] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_ZIP_PATH] = nil Fastlane::Actions::ApteligentAction.dsym_path(params: nil) end.to raise_error(FastlaneCore::Interface::FastlaneError) end it "mandatory options are used correctly" do ENV['DSYM_OUTPUT_PATH'] = nil ENV['DSYM_ZIP_PATH'] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_OUTPUT_PATH] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_ZIP_PATH] = nil dsym_path = File.expand_path('./fastlane/spec/fixtures/dSYM/Themoji.dSYM.zip') result = Fastlane::FastFile.new.parse("lane :test do apteligent(dsym: '#{dsym_path}',app_id: '123',api_key: 'abc') end").runner.execute(:test) expect(result).to include("https://api.crittercism.com/api_beta/dsym/123") expect(result).to include("-F dsym=@#{dsym_path.shellescape}") expect(result).to include("-F key=abc") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/opt_out_usage_spec.rb
fastlane/spec/actions_specs/opt_out_usage_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Opt Out Usage" do it "works as expected" do Fastlane::FastFile.new.parse("lane :test do opt_out_usage end").runner.execute(:test) expect(ENV['FASTLANE_OPT_OUT_USAGE']).to eq("YES") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/import_spec.rb
fastlane/spec/actions_specs/import_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "import" do it "allows the user to import a separate Fastfile" do ff = Fastlane::FastFile.new('./fastlane/spec/fixtures/fastfiles/ImportFastfile') expect(ff.runner.execute(:main_lane)).to eq('such main') # from the original Fastfile expect(ff.runner.execute(:extended, :ios)).to eq('extended') # from the original Fastfile expect(ff.runner.execute(:test)).to eq(1) # from the imported Fastfile # This should not raise an exception end it "overwrites existing lanes" do ff = Fastlane::FastFile.new('./fastlane/spec/fixtures/fastfiles/ImportFastfile') expect(ff.runner.execute(:empty, :ios)).to eq("Overwrite") end it "raises an exception when no path is given" do expect do Fastlane::FastFile.new.parse("lane :test do import end").runner.execute(:test) end.to raise_error("Please pass a path to the `import` action") end it "raises an exception when the given path is invalid (absolute)" do path = "/tmp/asdf#{Time.now.to_i}" expect do Fastlane::FastFile.new.parse("lane :test do import('#{path}') end").runner.execute(:test) end.to raise_error("Could not find Fastfile at path '#{path}'") end it "raises an exception when the given path is invalid (relative)" do expect do Fastlane::FastFile.new.parse("lane :test do import('tmp/asdf') end").runner.execute(:test) end.to raise_error(%r{Could not find Fastfile at path \'([A-Z]\:)?\/.+}) # /home (travis) # /Users (Mac) # C:/path (Windows) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/is_ci_spec.rb
fastlane/spec/actions_specs/is_ci_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "is_ci" do it "returns the correct value" do result = Fastlane::FastFile.new.parse("lane :test do is_ci end").runner.execute(:test) expect(result).to eq(FastlaneCore::Helper.ci?) end it "works with a ? in the end" do result = Fastlane::FastFile.new.parse("lane :test do is_ci? end").runner.execute(:test) expect(result).to eq(FastlaneCore::Helper.ci?) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/git_add_spec.rb
fastlane/spec/actions_specs/git_add_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "git_add" do before do allow(File).to receive(:exist?).with(anything).and_return(true) end context "as string" do let(:path) { "myfile.txt" } it "executes the correct git command" do allow(Fastlane::Actions).to receive(:sh).with("git add #{path}", anything).and_return("") result = Fastlane::FastFile.new.parse("lane :test do git_add(path: '#{path}') end").runner.execute(:test) end end context "as array" do let(:path) { ["myfile.txt", "yourfile.txt"] } it "executes the correct git command" do allow(Fastlane::Actions).to receive(:sh).with("git add #{path[0]} #{path[1]}", anything).and_return("") result = Fastlane::FastFile.new.parse("lane :test do git_add(path: #{path}) end").runner.execute(:test) end end context "as string with spaces in name" do let(:path) { "my file.txt" } it "executes the correct git command" do allow(Fastlane::Actions).to receive(:sh).with("git add #{path.shellescape}", anything).and_return("") result = Fastlane::FastFile.new.parse("lane :test do git_add(path: '#{path}') end").runner.execute(:test) end end context "as array with spaces in name and directory" do let(:path) { ["my file.txt", "some dir/your file.txt"] } it "executes the correct git command" do allow(Fastlane::Actions).to receive(:sh).with("git add #{path[0].shellescape} #{path[1].shellescape}", anything).and_return("") result = Fastlane::FastFile.new.parse("lane :test do git_add(path: #{path}) end").runner.execute(:test) end end context "as string with wildcards" do it "executes the correct git command" do allow(Fastlane::Actions).to receive(:sh).with("git add *.txt", anything).and_return("") result = Fastlane::FastFile.new.parse("lane :test do git_add(path: '*.txt', shell_escape: false) end").runner.execute(:test) end end context "as array with wildcards" do let(:path) { ["*.h", "*.m"] } it "executes the correct git command" do allow(Fastlane::Actions).to receive(:sh).with("git add *.h *.m", anything).and_return("") result = Fastlane::FastFile.new.parse("lane :test do git_add(path: #{path}, shell_escape: false) end").runner.execute(:test) end end context "as string with force option" do let(:path) { "myfile.txt" } it "executes the correct git command" do allow(Fastlane::Actions).to receive(:sh).with("git add --force #{path}", anything).and_return("") result = Fastlane::FastFile.new.parse("lane :test do git_add(path: '#{path}', force: true) end").runner.execute(:test) end end context "without parameters" do it "executes the correct git command" do allow(Fastlane::Actions).to receive(:sh).with("git add .", anything).and_return("") result = Fastlane::FastFile.new.parse("lane :test do git_add end").runner.execute(:test) end end it "logs the command if verbose" do FastlaneSpec::Env.with_verbose(true) do allow(Fastlane::Actions).to receive(:sh).with(anything, { log: true }).and_return("") result = Fastlane::FastFile.new.parse("lane :test do git_add(path: 'foo.bar') end").runner.execute(:test) end end it "passes the deprecated pathspec parameter to path parameter" do FastlaneSpec::Env.with_verbose(true) do allow(Fastlane::Actions).to receive(:sh).with(anything, { log: true }).and_return("") result = Fastlane::FastFile.new.parse("lane :test do git_add(pathspec: 'myfile.txt') end").runner.execute(:test) end end it "cannot have both path and pathspec parameters" do expect do Fastlane::FastFile.new.parse("lane :test do git_add(path: 'myfile.txt', pathspec: '*.txt') end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/gradle_spec.rb
fastlane/spec/actions_specs/gradle_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "gradle" do before :each do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) end describe "output controls" do let(:expected_command) { "#{File.expand_path('README.md').shellescape} tasks -p ." } it "prints the command and the command's output by default" do expect(Fastlane::Actions).to receive(:sh_control_output).with(expected_command, print_command: true, print_command_output: true).and_call_original Fastlane::FastFile.new.parse("lane :build do gradle( task: 'tasks', gradle_path: './README.md' ) end").runner.execute(:build) end it "suppresses the command text and prints the command's output" do expect(Fastlane::Actions).to receive(:sh_control_output).with(expected_command, print_command: false, print_command_output: true).and_call_original Fastlane::FastFile.new.parse("lane :build do gradle( task: 'tasks', gradle_path: './README.md', print_command: false ) end").runner.execute(:build) end it "prints the command text and suppresses the command's output" do expect(Fastlane::Actions).to receive(:sh_control_output).with(expected_command, print_command: true, print_command_output: false).and_call_original Fastlane::FastFile.new.parse("lane :build do gradle( task: 'tasks', gradle_path: './README.md', print_command_output: false ) end").runner.execute(:build) end it "suppresses the command text and suppresses the command's output" do expect(Fastlane::Actions).to receive(:sh_control_output).with(expected_command, print_command: false, print_command_output: false).and_call_original Fastlane::FastFile.new.parse("lane :build do gradle( task: 'tasks', gradle_path: './README.md', print_command: false, print_command_output: false ) end").runner.execute(:build) end end it "generates a valid command" do result = Fastlane::FastFile.new.parse("lane :build do gradle(task: 'assemble', flavor: 'WorldDomination', build_type: 'Release', properties: { 'versionCode' => 200}, gradle_path: './README.md') end").runner.execute(:build) expect(result).to eq("#{File.expand_path('README.md').shellescape} assembleWorldDominationRelease -p . -PversionCode=200") end it "correctly escapes the gradle path" do tmp_path = Dir.mktmpdir gradle_path = "#{tmp_path}/fake gradle/path" # this value is interesting because it contains a space in the path allow(File).to receive(:exist?).and_call_original allow(File).to receive(:exist?).with(gradle_path).and_return(true) result = Fastlane::FastFile.new.parse("lane :build do gradle( task: 'assemble', flavor: 'WorldDomination', build_type: 'Release', properties: {'versionCode' => 200}, serial: 'abc123', gradle_path: '#{gradle_path}' ) end").runner.execute(:build) expect(result).to eq("ANDROID_SERIAL=abc123 #{gradle_path.shellescape} assembleWorldDominationRelease -p . -PversionCode=200") end it "correctly escapes multiple properties and types" do notes_key = 'Release Notes' # this value is interesting because it contains a space in the key notes_result = 'World Domination Achieved!' # this value is interesting because it contains multiple spaces result = Fastlane::FastFile.new.parse("lane :build do gradle(task: 'assemble', flavor: 'WorldDomination', build_type: 'Release', properties: { 'versionCode' => 200, '#{notes_key}' => '#{notes_result}'}, system_properties: { 'org.gradle.daemon' => 'true' } , gradle_path: './README.md') end").runner.execute(:build) expect(result).to eq("#{File.expand_path('README.md').shellescape} assembleWorldDominationRelease -p . -PversionCode=200 -P#{notes_key.shellescape}=#{notes_result.shellescape} -Dorg.gradle.daemon=true") end it "correctly uses the serial" do result = Fastlane::FastFile.new.parse("lane :build do gradle(task: 'assemble', flavor: 'WorldDomination', build_type: 'Release', properties: { 'versionCode' => 200}, serial: 'abc123', gradle_path: './README.md') end").runner.execute(:build) expect(result).to eq("ANDROID_SERIAL=abc123 #{File.expand_path('README.md').shellescape} assembleWorldDominationRelease -p . -PversionCode=200") end it "supports multiple flavors" do result = Fastlane::FastFile.new.parse("lane :build do gradle(task: 'assemble', build_type: 'Release', gradle_path: './README.md') end").runner.execute(:build) expect(result).to eq("#{File.expand_path('README.md').shellescape} assembleRelease -p .") end it "supports multiple build types" do result = Fastlane::FastFile.new.parse("lane :build do gradle(task: 'assemble', flavor: 'WorldDomination', gradle_path: './README.md') end").runner.execute(:build) expect(result).to eq("#{File.expand_path('README.md').shellescape} assembleWorldDomination -p .") end it "supports multiple flavors and build types" do result = Fastlane::FastFile.new.parse("lane :build do gradle(task: 'assemble', gradle_path: './README.md') end").runner.execute(:build) expect(result).to eq("#{File.expand_path('README.md').shellescape} assemble -p .") end it "supports the backwards compatible syntax" do result = Fastlane::FastFile.new.parse("lane :build do gradle(task: 'assembleWorldDominationRelease', gradle_path: './README.md') end").runner.execute(:build) expect(result).to eq("#{File.expand_path('README.md').shellescape} assembleWorldDominationRelease -p .") end it "supports multiple tasks" do result = Fastlane::FastFile.new.parse("lane :build do gradle(tasks: ['assembleDebug', 'bundleDebug'], gradle_path: './README.md') end").runner.execute(:build) expect(result).to eq("#{File.expand_path('README.md').shellescape} assembleDebug bundleDebug -p .") end it "a task or tasks are required" do expect do result = Fastlane::FastFile.new.parse("lane :build do gradle(gradle_path: './README.md') end").runner.execute(:build) end.to( raise_error(FastlaneCore::Interface::FastlaneError) do |error| expect(error.message).to match('Please pass a gradle task or tasks') end ) end describe "the step name displayed in fastlane summary" do it "a gradle task name is displayed" do task_name = 'assembleWorldDominationRelease' Fastlane::FastFile.new.parse("lane :build do gradle(task: '#{task_name}', gradle_path: './README.md') end").runner.execute(:build) last_action = Fastlane::Actions.executed_actions.last expect(last_action[:name]).to eq(task_name) end it "a gradle tasks name is displayed" do task_name_1 = 'assembleWorldDominationRelease' task_name_2 = 'assemblePlanB' task_name = "#{task_name_1} #{task_name_2}" Fastlane::FastFile.new.parse("lane :build do gradle(tasks: ['#{task_name_1}', '#{task_name_2}'], gradle_path: './README.md') end").runner.execute(:build) last_action = Fastlane::Actions.executed_actions.last expect(last_action[:name]).to eq(task_name) end end describe "setting of Actions.lane_context" do after(:each) do Fastlane::Actions.lane_context.delete(Fastlane::Actions::SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS) Fastlane::Actions.lane_context.delete(Fastlane::Actions::SharedValues::GRADLE_ALL_AAB_OUTPUT_PATHS) Fastlane::Actions.lane_context.delete(Fastlane::Actions::SharedValues::GRADLE_ALL_OUTPUT_JSON_OUTPUT_PATHS) Fastlane::Actions.lane_context.delete(Fastlane::Actions::SharedValues::GRADLE_ALL_MAPPING_TXT_OUTPUT_PATHS) end it "sets context when assemble" do result = Fastlane::FastFile.new.parse("lane :build do gradle(tasks: ['assembleRelease', 'assembleReleaseAndroidTest'], gradle_path: './README.md') end").runner.execute(:build) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS]).to eq([]) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::GRADLE_ALL_AAB_OUTPUT_PATHS]).to eq([]) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::GRADLE_ALL_OUTPUT_JSON_OUTPUT_PATHS]).to eq([]) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::GRADLE_ALL_MAPPING_TXT_OUTPUT_PATHS]).to eq([]) end it "sets context when bundle" do result = Fastlane::FastFile.new.parse("lane :build do gradle(tasks: ['bundleRelease'], gradle_path: './README.md') end").runner.execute(:build) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS]).to eq([]) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::GRADLE_ALL_AAB_OUTPUT_PATHS]).to eq([]) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::GRADLE_ALL_OUTPUT_JSON_OUTPUT_PATHS]).to eq([]) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::GRADLE_ALL_MAPPING_TXT_OUTPUT_PATHS]).to eq([]) end it "does not set context if not assemble or bundle" do result = Fastlane::FastFile.new.parse("lane :build do gradle(tasks: ['someOtherThing'], gradle_path: './README.md') end").runner.execute(:build) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS]).to eq(nil) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::GRADLE_ALL_AAB_OUTPUT_PATHS]).to eq(nil) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::GRADLE_ALL_OUTPUT_JSON_OUTPUT_PATHS]).to eq(nil) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::GRADLE_ALL_MAPPING_TXT_OUTPUT_PATHS]).to eq(nil) end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/ensure_no_debug_code_spec.rb
fastlane/spec/actions_specs/ensure_no_debug_code_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "ensure_no_debug_code" do before :each do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) end it "handles extension and extensions parameters correctly" do result = Fastlane::FastFile.new.parse("lane :test do ensure_no_debug_code(text: 'pry', path: '.', extension: 'rb', extensions: ['m', 'h']) end").runner.execute(:test) expect(result).to eq("grep -RE 'pry' '#{File.absolute_path('./')}' --include=\\*.{rb,m,h}") end it "handles the extension parameter correctly" do result = Fastlane::FastFile.new.parse("lane :test do ensure_no_debug_code(text: 'pry', path: '.', extension: 'rb') end").runner.execute(:test) expect(result).to eq("grep -RE 'pry' '#{File.absolute_path('./')}' --include=\\*.rb") end it "handles the extensions parameter with multiple elements correctly" do result = Fastlane::FastFile.new.parse("lane :test do ensure_no_debug_code(text: 'pry', path: '.', extensions: ['m', 'h']) end").runner.execute(:test) expect(result).to eq("grep -RE 'pry' '#{File.absolute_path('./')}' --include=\\*.{m,h}") end it "handles the extensions parameter with a single element correctly" do result = Fastlane::FastFile.new.parse("lane :test do ensure_no_debug_code(text: 'pry', path: '.', extensions: ['m']) end").runner.execute(:test) expect(result).to eq("grep -RE 'pry' '#{File.absolute_path('./')}' --include=\\*.m") end it "handles the extensions parameter with no elements correctly" do result = Fastlane::FastFile.new.parse("lane :test do ensure_no_debug_code(text: 'pry', path: '.', extensions: []) end").runner.execute(:test) expect(result).to eq("grep -RE 'pry' '#{File.absolute_path('./')}'") end it "handles no extension or extensions parameters" do result = Fastlane::FastFile.new.parse("lane :test do ensure_no_debug_code(text: 'pry', path: '.') end").runner.execute(:test) expect(result).to eq("grep -RE 'pry' '#{File.absolute_path('./')}'") end it "handles the exclude_dirs parameter with no elements correctly" do result = Fastlane::FastFile.new.parse("lane :test do ensure_no_debug_code(text: 'pry', path: '.', exclude_dirs: []) end").runner.execute(:test) expect(result).to eq("grep -RE 'pry' '#{File.absolute_path('./')}'") end it "handles the exclude_dirs parameter with a single element correctly" do result = Fastlane::FastFile.new.parse("lane :test do ensure_no_debug_code(text: 'pry', path: '.', exclude_dirs: ['.bundle']) end").runner.execute(:test) expect(result).to eq("grep -RE 'pry' '#{File.absolute_path('./')}' --exclude-dir .bundle") end it "shellescapes the exclude_dirs correctly" do directory = "My Dir" result = Fastlane::FastFile.new.parse("lane :test do ensure_no_debug_code(text: 'pry', path: '.', exclude_dirs: ['#{directory}']) end").runner.execute(:test) expect(result).to eq("grep -RE 'pry' '#{File.absolute_path('./')}' --exclude-dir #{directory.shellescape}") end it "handles the exclude_dirs parameter with multiple elements correctly" do result = Fastlane::FastFile.new.parse("lane :test do ensure_no_debug_code(text: 'pry', path: '.', exclude_dirs: ['.bundle', 'Packages/']) end").runner.execute(:test) expect(result).to eq("grep -RE 'pry' '#{File.absolute_path('./')}' --exclude-dir .bundle --exclude-dir Packages/") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/artifactory_spec.rb
fastlane/spec/actions_specs/artifactory_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "artifactory" do it "Call the artifactory plugin with 'username' and 'password' " do result = Fastlane::FastFile.new.parse("lane :test do artifactory(username:'username', password: 'password', endpoint: 'artifactory.example.com', file: 'file.txt', repo: '/file.txt') end").runner.execute(:test) expect(result).to be true end it "Call the artifactory plugin with 'api_key' " do result = Fastlane::FastFile.new.parse("lane :test do artifactory(api_key:'MY_API_KEY', endpoint: 'artifactory.example.com', file: 'file.txt', repo: '/file.txt') end").runner.execute(:test) expect(result).to be true end it "Require 'username' or 'api_key' parameter" do expect do Fastlane::FastFile.new.parse("lane :test do artifactory(endpoint: 'artifactory.example.com', file: 'file.txt', repo: '/file.txt') end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError) end it "Require 'password' if 'username' is provided" do expect do Fastlane::FastFile.new.parse("lane :test do artifactory(username:'username', endpoint: 'artifactory.example.com', file: 'file.txt', repo: '/file.txt') end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError) end it "Require 'username' if 'password' is provided" do expect do Fastlane::FastFile.new.parse("lane :test do artifactory(username:'username', endpoint: 'artifactory.example.com', file: 'file.txt', repo: '/file.txt') end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/backup_file_spec.rb
fastlane/spec/actions_specs/backup_file_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Backup file Integration" do tmp_path = Dir.mktmpdir let(:test_path) { "#{tmp_path}/tests/fastlane" } let(:file_path) { "file.txt" } let(:backup_path) { "#{file_path}.back" } let(:file_content) { Time.now.to_s } before do FileUtils.mkdir_p(test_path) File.write(File.join(test_path, file_path), file_content) Fastlane::FastFile.new.parse("lane :test do backup_file path: '#{File.join(test_path, file_path)}' end").runner.execute(:test) end it "backup file to `.back` file" do expect( File.read(File.join(test_path, backup_path)) ).to include(file_content) end after do File.delete(File.join(test_path, file_path)) File.delete(File.join(test_path, backup_path)) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/update_app_group_identifiers_spec.rb
fastlane/spec/actions_specs/update_app_group_identifiers_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Update Info Plist Integration" do let(:test_path) { "/tmp/fastlane/tests/fastlane" } let(:entitlements_path) { "com.test.entitlements" } let(:new_app_group) { 'group.com.enterprise.test' } before do # Set up example info.plist FileUtils.mkdir_p(test_path) File.write(File.join(test_path, entitlements_path), '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>com.apple.security.application-groups</key><array><string>group.com.test</string></array></dict></plist>') end it "updates the app group of the entitlements file" do result = Fastlane::FastFile.new.parse("lane :test do update_app_group_identifiers( entitlements_file: '#{File.join(test_path, entitlements_path)}', app_group_identifiers: ['#{new_app_group}'] ) end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::APP_GROUP_IDENTIFIERS]).to match([new_app_group]) end it "throws an error when the entitlements file does not exist" do expect do Fastlane::FastFile.new.parse("lane :test do update_app_group_identifiers( entitlements_file: 'xyz.#{File.join(test_path, entitlements_path)}', app_group_identifiers: ['#{new_app_group}'] ) end").runner.execute(:test) end.to raise_error("Could not find entitlements file at path 'xyz.#{File.join(test_path, entitlements_path)}'") end it "throws an error when the entitlements file is not parsable" do File.write(File.join(test_path, entitlements_path), '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>com.apple.security.application-groups</key><array><string>group.com.</array></dict></plist>') expect do Fastlane::FastFile.new.parse("lane :test do update_app_group_identifiers( entitlements_file: '#{File.join(test_path, entitlements_path)}', app_group_identifiers: ['#{new_app_group}'] ) end").runner.execute(:test) end.to raise_error("Entitlements file at '#{File.join(test_path, entitlements_path)}' cannot be parsed.") end it "throws an error when the entitlements file doesn't contain an app group" do File.write(File.join(test_path, entitlements_path), '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict></dict></plist>') expect do Fastlane::FastFile.new.parse("lane :test do update_app_group_identifiers( entitlements_file: '#{File.join(test_path, entitlements_path)}', app_group_identifiers: ['#{new_app_group}'] ) end").runner.execute(:test) end.to raise_error("No existing App group field specified. Please specify an App Group in the entitlements file.") end after do # Clean up files File.delete(File.join(test_path, entitlements_path)) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/slack_spec.rb
fastlane/spec/actions_specs/slack_spec.rb
require 'slack-notifier' describe Fastlane::Actions do describe Fastlane::Actions::SlackAction do describe Fastlane::Actions::SlackAction::Runner do subject { Fastlane::Actions::SlackAction::Runner.new('https://127.0.0.1') } it "trims long messages to show the bottom of the messages" do long_text = "a" * 10_000 expect(described_class.trim_message(long_text).length).to eq(7000) end it "works so perfect, like Slack does" do channel = "#myChannel" message = "Custom Message" lane_name = "lane_name" Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::LANE_NAME] = lane_name options = FastlaneCore::Configuration.create(Fastlane::Actions::SlackAction.available_options, { slack_url: 'https://127.0.0.1', message: message, success: false, channel: channel, icon_emoji: ':white_check_mark:', payload: { 'Build Date' => Time.new.to_s, 'Built by' => 'Jenkins' }, default_payloads: [:lane, :test_result, :git_branch, :git_author, :last_git_commit_hash] }) expected_args = { channel: channel, username: 'fastlane', attachments: [ hash_including( color: 'danger', pretext: nil, text: message, fields: array_including( { title: 'Built by', value: 'Jenkins', short: false }, { title: 'Lane', value: lane_name, short: true }, { title: 'Result', value: 'Error', short: true } ) ) ], link_names: false, icon_url: 'https://fastlane.tools/assets/img/fastlane_icon.png', icon_emoji: ':white_check_mark:', fail_on_error: true } expect(subject).to receive(:post_message).with(expected_args) subject.run(options) end it "works so perfect, like Slack does with pretext" do channel = "#myChannel" message = "Custom Message" pretext = "This is pretext" lane_name = "lane_name" Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::LANE_NAME] = lane_name options = FastlaneCore::Configuration.create(Fastlane::Actions::SlackAction.available_options, { slack_url: 'https://127.0.0.1', message: message, pretext: pretext, success: false, channel: channel }) expected_args = hash_including( attachments: [ hash_including( color: 'danger', pretext: pretext, text: message ) ] ) expect(subject).to receive(:post_message).with(expected_args) subject.run(options) end it "merges attachment_properties when specified" do channel = "#myChannel" message = "Custom Message" lane_name = "lane_name" Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::LANE_NAME] = lane_name require 'fastlane/actions/slack' options = FastlaneCore::Configuration.create(Fastlane::Actions::SlackAction.available_options, { slack_url: 'https://127.0.0.1', message: message, success: false, channel: channel, default_payloads: [:lane], attachment_properties: { thumb_url: 'https://example.com/path/to/thumb.png', fields: [{ title: 'My Field', value: 'My Value', short: true }] } }) expected_args = hash_including( attachments: [ hash_including( fields: array_including( { title: 'Lane', value: lane_name, short: true }, { title: 'My Field', value: 'My Value', short: true } ) ) ] ) expect(subject).to receive(:post_message).with(expected_args) subject.run(options) end it "parses default_payloads from a comma delimited string" do channel = "#myChannel" message = "Custom Message" lane_name = "lane_name" Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::LANE_NAME] = lane_name options = FastlaneCore::Configuration.create(Fastlane::Actions::SlackAction.available_options, { slack_url: 'https://127.0.0.1', message: message, success: false, channel: channel, default_payloads: "lane,test_result" }) expected_args = hash_including( attachments: [ hash_including( fields: [ { title: 'Lane', value: lane_name, short: true }, { title: 'Result', value: 'Error', short: true } ] ) ] ) expect(subject).to receive(:post_message).with(expected_args) subject.run(options) end # https://github.com/fastlane/fastlane/issues/14234 it "parses default_payloads without adding extra fields for git" do channel = "#myChannel" message = "Custom Message" require 'fastlane/actions/slack' options = FastlaneCore::Configuration.create(Fastlane::Actions::SlackAction.available_options, { slack_url: 'https://127.0.0.1', message: message, success: false, channel: channel, default_payloads: [:git_branch, :last_git_commit_hash] }) expected_args = hash_including( attachments: [ hash_including( fields: [ { title: 'Git Branch', value: anything, short: true }, { title: 'Git Commit Hash', value: anything, short: false } ] ) ] ) expect(subject).to receive(:post_message).with(expected_args) subject.run(options) end it "receives default_payloads as nil and falls back to its default value" do channel = "#myChannel" message = "Custom Message" lane_name = "lane_name" Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::LANE_NAME] = lane_name require 'fastlane/actions/slack' options = FastlaneCore::Configuration.create(Fastlane::Actions::SlackAction.available_options, { slack_url: 'https://127.0.0.1', message: message, success: false, channel: channel, default_payloads: nil }) expected_args = hash_including( attachments: [ hash_including( fields: [ { title: 'Lane', value: lane_name, short: true }, { title: 'Result', value: anything, short: true }, { title: 'Git Branch', value: anything, short: true }, { title: 'Git Author', value: anything, short: true }, { title: 'Git Commit', value: anything, short: false }, { title: 'Git Commit Hash', value: anything, short: false } ] ) ] ) expect(subject).to receive(:post_message).with(expected_args) subject.run(options) end # https://github.com/fastlane/fastlane/issues/14141 it "prints line breaks on message parameter to slack" do channel = "#myChannel" # User is passing input_message through fastlane input parameter input_message = 'Custom Message with\na line break' # We expect the message to be escaped correctly after being processed by action expected_message = "Custom Message with\na line break" lane_name = "lane_name" Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::LANE_NAME] = lane_name options = FastlaneCore::Configuration.create(Fastlane::Actions::SlackAction.available_options, { slack_url: 'https://127.0.0.1', message: input_message, success: false, channel: channel }) expected_args = hash_including( attachments: [ hash_including( color: 'danger', text: expected_message ) ] ) expect(subject).to receive(:post_message).with(expected_args) subject.run(options) end # https://github.com/fastlane/fastlane/issues/14141 it "prints line breaks on pretext parameter to slack" do channel = "#myChannel" # User is passing input_message through fastlane input parameter input_pretext = 'Custom Pretext with\na line break' # We expect the message to be escaped correctly after being processed by action expected_pretext = "Custom Pretext with\na line break" lane_name = "lane_name" Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::LANE_NAME] = lane_name options = FastlaneCore::Configuration.create(Fastlane::Actions::SlackAction.available_options, { slack_url: 'https://127.0.0.1', pretext: input_pretext, success: false, channel: channel }) expected_args = hash_including( attachments: [ hash_including( color: 'danger', pretext: expected_pretext ) ] ) expect(subject).to receive(:post_message).with(expected_args) subject.run(options) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/create_pull_request_spec.rb
fastlane/spec/actions_specs/create_pull_request_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "create_pull_request" do let(:response_body) { File.read("./fastlane/spec/fixtures/requests/github_create_pull_request_response.json") } context 'successful' do before do stub_request(:post, "https://api.github.com/repos/fastlane/fastlane/pulls"). with( body: '{"title":"test PR","head":"git rev-parse --abbrev-ref HEAD","base":"master"}', headers: { 'Authorization' => 'Basic MTIzNDU2Nzg5', 'Host' => 'api.github.com:443', 'User-Agent' => 'fastlane-github_api' } ).to_return(status: 201, body: response_body, headers: {}) stub_request(:post, "https://api.github.com/repos/fastlane/fastlane/pulls"). with( body: '{"title":"test PR","head":"git rev-parse --abbrev-ref HEAD","base":"master","draft":true}', headers: { 'Authorization' => 'Basic MTIzNDU2Nzg5', 'Host' => 'api.github.com:443', 'User-Agent' => 'fastlane-github_api' } ).to_return(status: 201, body: response_body, headers: {}) number = JSON.parse(response_body)["number"] stub_request(:patch, "https://api.github.com/repos/fastlane/fastlane/issues/#{number}"). with( body: '{"labels":["fastlane","is","awesome"]}', headers: { 'Authorization' => 'Basic MTIzNDU2Nzg5', 'Host' => 'api.github.com:443', 'User-Agent' => 'fastlane-github_api' } ).to_return(status: 200, body: "", headers: {}) stub_request(:post, "https://api.github.com/repos/fastlane/fastlane/issues/#{number}/assignees"). with( body: '{"assignees":["octocat","hubot","other_user"]}', headers: { 'Authorization' => 'Basic MTIzNDU2Nzg5', 'Host' => 'api.github.com:443', 'User-Agent' => 'fastlane-github_api' } ).to_return(status: 201, body: "", headers: {}) stub_request(:post, "https://api.github.com/repos/fastlane/fastlane/pulls/#{number}/requested_reviewers"). with( body: '{"reviewers":["octocat","hubot","other_user"]}', headers: { 'Authorization' => 'Basic MTIzNDU2Nzg5', 'Host' => 'api.github.com:443', 'User-Agent' => 'fastlane-github_api' } ).to_return(status: 201, body: "", headers: {}) stub_request(:post, "https://api.github.com/repos/fastlane/fastlane/pulls/#{number}/requested_reviewers"). with( body: '{"team_reviewers":["octocat","hubot","other_team"]}', headers: { 'Authorization' => 'Basic MTIzNDU2Nzg5', 'Host' => 'api.github.com:443', 'User-Agent' => 'fastlane-github_api' } ).to_return(status: 201, body: "", headers: {}) stub_request(:post, "https://api.github.com/repos/fastlane/fastlane/pulls/#{number}/requested_reviewers"). with( body: '{"reviewers":["octocat","hubot","other_user"],"team_reviewers":["octocat","hubot","other_team"]}', headers: { 'Authorization' => 'Basic MTIzNDU2Nzg5', 'Host' => 'api.github.com:443', 'User-Agent' => 'fastlane-github_api' } ).to_return(status: 201, body: "", headers: {}) stub_request(:patch, "https://api.github.com/repos/fastlane/fastlane/issues/#{number}"). with( body: '{"milestone":42}', headers: { 'Authorization' => 'Basic MTIzNDU2Nzg5', 'Host' => 'api.github.com:443', 'User-Agent' => 'fastlane-github_api' } ).to_return(status: 201, body: "", headers: {}) end it 'correctly submits to github' do result = Fastlane::FastFile.new.parse(" lane :test do create_pull_request( api_token: '123456789', title: 'test PR', repo: 'fastlane/fastlane', ) end ").runner.execute(:test) expect(result).to eq('https://github.com/fastlane/fastlane/pull/1347') end it 'correctly submits to github as a draft pull request' do result = Fastlane::FastFile.new.parse(" lane :test do create_pull_request( api_token: '123456789', title: 'test PR', repo: 'fastlane/fastlane', draft: true, ) end ").runner.execute(:test) expect(result).to eq('https://github.com/fastlane/fastlane/pull/1347') end it 'correctly submits to github with labels' do result = Fastlane::FastFile.new.parse(" lane :test do create_pull_request( api_token: '123456789', title: 'test PR', repo: 'fastlane/fastlane', labels: ['fastlane', 'is', 'awesome'] ) end ").runner.execute(:test) expect(result).to eq('https://github.com/fastlane/fastlane/pull/1347') end it 'correctly submits to github with assignees' do result = Fastlane::FastFile.new.parse(" lane :test do create_pull_request( api_token: '123456789', title: 'test PR', repo: 'fastlane/fastlane', assignees: ['octocat','hubot','other_user'] ) end ").runner.execute(:test) expect(result).to eq('https://github.com/fastlane/fastlane/pull/1347') end it 'correctly submits to github with reviewers' do result = Fastlane::FastFile.new.parse(" lane :test do create_pull_request( api_token: '123456789', title: 'test PR', repo: 'fastlane/fastlane', reviewers: ['octocat','hubot','other_user'] ) end ").runner.execute(:test) expect(result).to eq('https://github.com/fastlane/fastlane/pull/1347') end it 'correctly submits to github with team_reviewers' do result = Fastlane::FastFile.new.parse(" lane :test do create_pull_request( api_token: '123456789', title: 'test PR', repo: 'fastlane/fastlane', team_reviewers: ['octocat','hubot','other_team'] ) end ").runner.execute(:test) expect(result).to eq('https://github.com/fastlane/fastlane/pull/1347') end it 'correctly submits to github with reviewers and team_reviewers' do result = Fastlane::FastFile.new.parse(" lane :test do create_pull_request( api_token: '123456789', title: 'test PR', repo: 'fastlane/fastlane', reviewers: ['octocat','hubot','other_user'], team_reviewers: ['octocat','hubot','other_team'] ) end ").runner.execute(:test) expect(result).to eq('https://github.com/fastlane/fastlane/pull/1347') end it 'correctly submits to github with a milestone' do result = Fastlane::FastFile.new.parse(" lane :test do create_pull_request( api_token: '123456789', title: 'test PR', repo: 'fastlane/fastlane', milestone: 42 ) end ").runner.execute(:test) expect(result).to eq('https://github.com/fastlane/fastlane/pull/1347') end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/splunkmint_spec.rb
fastlane/spec/actions_specs/splunkmint_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Splunk MINT integration" do it "verbosity is set correctly" do expect(Fastlane::Actions::SplunkmintAction.verbose(verbose: true)).to eq("--verbose") expect(Fastlane::Actions::SplunkmintAction.verbose(verbose: false)).to eq("") end it "upload url is set correctly" do expect(Fastlane::Actions::SplunkmintAction.upload_url).to eq("https://ios.splkmobile.com/api/v1/dsyms/upload") end it "raises an error if no dsym source has been found" do file_path = File.expand_path('/tmp/wwxfile.dsym.zip') expect do ENV['DSYM_OUTPUT_PATH'] = nil ENV['DSYM_ZIP_PATH'] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_OUTPUT_PATH] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_ZIP_PATH] = nil Fastlane::Actions::SplunkmintAction.dsym_path(params: nil) end.to raise_exception("Couldn't find any dSYM file") end it "raises an error if no dsym source has been found in SharedValues::DSYM_OUTPUT_PATH" do file_path = File.expand_path('/tmp/wwxfile.dsym.zip') Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_OUTPUT_PATH] = file_path ENV['DSYM_ZIP_PATH'] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_ZIP_PATH] = nil expect do Fastlane::Actions::SplunkmintAction.dsym_path(params: nil) end.to raise_exception("Couldn't find file at path '#{file_path}'") end it "raises an error if no dsym source has been found in SharedValues::DSYM_ZIP_PATH" do file_path = File.expand_path('/tmp/wwxfile.dsym.zip') Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_ZIP_PATH] = file_path ENV['DSYM_OUTPUT_PATH'] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_OUTPUT_PATH] = nil expect do Fastlane::Actions::SplunkmintAction.dsym_path(params: nil) end.to raise_exception("Couldn't find file at path '#{file_path}'") end it "raises an error if no dsym source has been found in ENV['DSYM_OUTPUT_PATH']" do file_path = File.expand_path('/tmp/wwxfile.dsym.zip') ENV['DSYM_OUTPUT_PATH'] = file_path ENV['DSYM_ZIP_PATH'] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_OUTPUT_PATH] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_ZIP_PATH] = nil expect do Fastlane::Actions::SplunkmintAction.dsym_path(params: nil) end.to raise_exception("Couldn't find file at path '#{file_path}'") end it "raises an error if no dsym source has been found in ENV['DSYM_ZIP_PATH']" do file_path = File.expand_path('/tmp/wwxfile.dsym.zip') ENV['DSYM_ZIP_PATH'] = file_path ENV['DSYM_OUTPUT_PATH'] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_OUTPUT_PATH] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_ZIP_PATH] = nil expect do Fastlane::Actions::SplunkmintAction.dsym_path(params: nil) end.to raise_exception("Couldn't find file at path '#{file_path}'") end it "proxy options are set correctly" do expect(Fastlane::Actions::SplunkmintAction.proxy_options(proxy_address: "", proxy_port: nil, proxy_username: nil, proxy_password: nil)).to eq([]) expect(Fastlane::Actions::SplunkmintAction.proxy_options(proxy_address: nil, proxy_port: "", proxy_username: nil, proxy_password: nil)).to eq([]) expect(Fastlane::Actions::SplunkmintAction.proxy_options(proxy_address: nil, proxy_port: nil, proxy_username: "", proxy_password: "")).to eq([]) expect(Fastlane::Actions::SplunkmintAction.proxy_options(proxy_address: "http://1", proxy_port: "2", proxy_username: "3", proxy_password: "4")).to eq(["-x http://1:2", "--proxy-user 3:4"]) end it "raises an error if file does not exist" do file_path = File.expand_path('/tmp/wwxfile.dsym.zip') expect do result = Fastlane::FastFile.new.parse("lane :test do splunkmint(dsym: '/tmp/wwxfile.dsym.zip', api_key: '33823d3a', api_token: 'e05ba40754c4869fb7e0b61') end").runner.execute(:test) end.to raise_exception("Couldn't find file at path '#{file_path}'") end it "raises an error if file could not be read from any source" do ENV['DSYM_OUTPUT_PATH'] = nil ENV['DSYM_ZIP_PATH'] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_OUTPUT_PATH] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_ZIP_PATH] = nil expect do result = Fastlane::FastFile.new.parse("lane :test do splunkmint(api_key: '33823d3a', api_token: 'e05ba40754c4869fb7e0b61') end").runner.execute(:test) end.to raise_exception("Couldn't find any dSYM file") end it "mandatory options are used correctly" do ENV['DSYM_OUTPUT_PATH'] = nil ENV['DSYM_ZIP_PATH'] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_OUTPUT_PATH] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_ZIP_PATH] = nil tmp_path = Dir.mktmpdir file_path = "#{tmp_path}/file.dSYM.zip" FileUtils.touch(file_path) result = Fastlane::FastFile.new.parse("lane :test do splunkmint(dsym: '#{file_path}', api_key: '33823d3a', api_token: 'e05ba40754c4869fb7e0b61', verbose: true, proxy_address: 'http://server', proxy_port: '30', proxy_username: 'admin', proxy_password: 'admin') end").runner.execute(:test) expect(result).to include("-F file=@#{file_path}") expect(result).to include('--verbose') expect(result).to include("--header 'X-Splunk-Mint-Auth-Token: e05ba40754c4869fb7e0b61'") expect(result).to include("--header 'X-Splunk-Mint-apikey: 33823d3a'") expect(result).to include('-x http://server:30') expect(result).to include('--proxy-user admin:admin') end it "optional options are used correctly" do ENV['DSYM_OUTPUT_PATH'] = nil ENV['DSYM_ZIP_PATH'] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_OUTPUT_PATH] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_ZIP_PATH] = nil tmp_path = Dir.mktmpdir file_path = "#{tmp_path}/file.dSYM.zip" FileUtils.touch(file_path) result = Fastlane::FastFile.new.parse("lane :test do splunkmint(dsym: '#{file_path}', api_key: '33823d3a', api_token: 'e05ba40754c4869fb7e0b61', verbose: true) end").runner.execute(:test) expect(result).to include("-F file=@#{file_path}") expect(result).to include('--verbose') expect(result).to include("--header 'X-Splunk-Mint-Auth-Token: e05ba40754c4869fb7e0b61'") expect(result).to include("--header 'X-Splunk-Mint-apikey: 33823d3a'") expect(result).not_to(include('-x ')) expect(result).not_to(include('--proxy-user')) end it "show progress bar option is used" do ENV['DSYM_OUTPUT_PATH'] = nil ENV['DSYM_ZIP_PATH'] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_OUTPUT_PATH] = nil Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DSYM_ZIP_PATH] = nil tmp_path = Dir.mktmpdir file_path = "#{tmp_path}/file.dSYM.zip" FileUtils.touch(file_path) result = Fastlane::FastFile.new.parse("lane :test do splunkmint(dsym: '#{file_path}', api_key: '33823d3a', api_token: 'e05ba40754c4869fb7e0b61', verbose: true, upload_progress: true) end").runner.execute(:test) expect(result).to include("-F file=@#{file_path}") expect(result).to include('--verbose') expect(result).to include("--header 'X-Splunk-Mint-Auth-Token: e05ba40754c4869fb7e0b61'") expect(result).to include("--header 'X-Splunk-Mint-apikey: 33823d3a'") expect(result).to include('--progress-bar -o /dev/null --no-buffer') expect(result).not_to(include('-x ')) expect(result).not_to(include('--proxy-user')) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/appledoc_spec.rb
fastlane/spec/actions_specs/appledoc_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Appledoc Integration" do it "default use case" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --exit-threshold \"2\" input/dir") end it "accepts an input path with spaces" do input_dir = "input/dir with spaces/file" result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: '#{input_dir}' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --exit-threshold \"2\" #{input_dir.shellescape}") end it "accepts an array of input paths" do input_dir_with_spaces = "second/input dir with spaces" result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: ['input/dir', '#{input_dir_with_spaces}', 'third/input/file.h'] ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --exit-threshold \"2\" input/dir #{input_dir_with_spaces.shellescape} third/input/file.h") end it "adds output param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', output: '~/Desktop' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --output \"~/Desktop\" --exit-threshold \"2\" input/dir") end it "adds templates param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', templates: 'path/to/templates' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --templates \"path/to/templates\" --exit-threshold \"2\" input/dir") end it "adds docset_install_path param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_install_path: 'docs/install/path' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-install-path \"docs/install/path\" --exit-threshold \"2\" input/dir") end it "adds include param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', include: 'path/to/include' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --include \"path/to/include\" --exit-threshold \"2\" input/dir") end it "adds ignore param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', ignore: 'ignored/path' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --ignore \"ignored/path\" --exit-threshold \"2\" input/dir") end it "adds multiple ignore params to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', ignore: ['ignored/path', 'ignored/path2'] ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --ignore \"ignored/path\" --ignore \"ignored/path2\" --exit-threshold \"2\" input/dir") end it "adds exclude_output param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', exclude_output: 'excluded/path' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --exclude-output \"excluded/path\" --exit-threshold \"2\" input/dir") end it "adds index_desc param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', index_desc: 'index_desc/path' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --index-desc \"index_desc/path\" --exit-threshold \"2\" input/dir") end it "adds project_version param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', project_version: 'VERSION' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --project-version \"VERSION\" --exit-threshold \"2\" input/dir") end it "adds company_id param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', company_id: 'COMPANY ID' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --company-id \"COMPANY ID\" --exit-threshold \"2\" input/dir") end it "adds create_html param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', create_html: true ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --create-html --exit-threshold \"2\" input/dir") end it "adds create_docset param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', create_docset: true ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --create-docset --exit-threshold \"2\" input/dir") end it "adds install_docset param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', install_docset: true ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --install-docset --exit-threshold \"2\" input/dir") end it "adds publish_docset param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', publish_docset: true ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --publish-docset --exit-threshold \"2\" input/dir") end it "adds no_create_docset param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', no_create_docset: true ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --no-create-docset --exit-threshold \"2\" input/dir") end it "adds html_anchors param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', html_anchors: 'some anchors' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --html-anchors \"some anchors\" --exit-threshold \"2\" input/dir") end it "adds clean_output param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', clean_output: true ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --clean-output --exit-threshold \"2\" input/dir") end it "adds docset_bundle_id param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_bundle_id: 'com.bundle.id' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-bundle-id \"com.bundle.id\" --exit-threshold \"2\" input/dir") end it "adds docset_bundle_name param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_bundle_name: 'Bundle name' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-bundle-name \"Bundle name\" --exit-threshold \"2\" input/dir") end it "adds docset_desc param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_desc: 'DocSet description' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-desc \"DocSet description\" --exit-threshold \"2\" input/dir") end it "adds docset_copyright param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_copyright: 'DocSet copyright' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-copyright \"DocSet copyright\" --exit-threshold \"2\" input/dir") end it "adds docset_feed_name param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_feed_name: 'DocSet feed name' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-feed-name \"DocSet feed name\" --exit-threshold \"2\" input/dir") end it "adds docset_feed_url param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_feed_url: 'http://docset-feed-url.com' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-feed-url \"http://docset-feed-url.com\" --exit-threshold \"2\" input/dir") end it "adds docset_feed_formats param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_feed_formats: 'atom' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-feed-formats \"atom\" --exit-threshold \"2\" input/dir") end it "adds docset_package_url param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_package_url: 'http://docset-package-url.com' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-package-url \"http://docset-package-url.com\" --exit-threshold \"2\" input/dir") end it "adds docset_fallback_url param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_fallback_url: 'http://docset-fallback-url.com' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-fallback-url \"http://docset-fallback-url.com\" --exit-threshold \"2\" input/dir") end it "adds docset_publisher_id param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_publisher_id: 'Publisher ID' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-publisher-id \"Publisher ID\" --exit-threshold \"2\" input/dir") end it "adds docset_publisher_name param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_publisher_name: 'Publisher name' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-publisher-name \"Publisher name\" --exit-threshold \"2\" input/dir") end it "adds docset_min_xcode_version param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_min_xcode_version: '6.4' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-min-xcode-version \"6.4\" --exit-threshold \"2\" input/dir") end it "adds docset_platform_family param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_platform_family: 'ios' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-platform-family \"ios\" --exit-threshold \"2\" input/dir") end it "adds docset_cert_issuer param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_cert_issuer: 'Some issuer' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-cert-issuer \"Some issuer\" --exit-threshold \"2\" input/dir") end it "adds docset_cert_signer param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_cert_signer: 'Some signer' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-cert-signer \"Some signer\" --exit-threshold \"2\" input/dir") end it "adds docset_bundle_filename param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_bundle_filename: 'DocSet bundle filename' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-bundle-filename \"DocSet bundle filename\" --exit-threshold \"2\" input/dir") end it "adds docset_atom_filename param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_atom_filename: 'DocSet atom feed filename' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-atom-filename \"DocSet atom feed filename\" --exit-threshold \"2\" input/dir") end it "adds docset_xml_filename param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_xml_filename: 'DocSet xml feed filename' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-xml-filename \"DocSet xml feed filename\" --exit-threshold \"2\" input/dir") end it "adds docset_package_filename param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docset_package_filename: 'DocSet package filename' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docset-package-filename \"DocSet package filename\" --exit-threshold \"2\" input/dir") end it "adds options param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', options: '--use-single-star --keep-intermediate-files --search-undocumented-doc' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --use-single-star --keep-intermediate-files --search-undocumented-doc --exit-threshold \"2\" input/dir") end it "adds crossref_format param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', crossref_format: 'some regex' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --crossref-format \"some regex\" --exit-threshold \"2\" input/dir") end it "adds docs_section_title param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', docs_section_title: 'Section title' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --docs-section-title \"Section title\" --exit-threshold \"2\" input/dir") end it "adds warnings param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', warnings: '--warn-missing-output-path --warn-missing-company-id --warn-undocumented-object' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --warn-missing-output-path --warn-missing-company-id --warn-undocumented-object --exit-threshold \"2\" input/dir") end it "adds logformat param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', logformat: '1' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --logformat \"1\" --exit-threshold \"2\" input/dir") end it "adds verbose param to command" do result = Fastlane::FastFile.new.parse("lane :test do appledoc( project_name: 'Project Name', project_company: 'Company', input: 'input/dir', verbose: '1' ) end").runner.execute(:test) expect(result).to eq("appledoc --project-name \"Project Name\" --project-company \"Company\" --verbose \"1\" --exit-threshold \"2\" input/dir") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/set_info_plist_value_spec.rb
fastlane/spec/actions_specs/set_info_plist_value_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "set_info_plist" do let(:plist_path) { "./fastlane/spec/fixtures/plist/Info.plist" } let(:test_path) { "/tmp/fastlane/tests/fastlane" } let(:output_path) { "Folder/output.plist" } let(:new_value) { "NewValue#{Time.now.to_i}" } it "stores changes in the plist file" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) old_value = Fastlane::FastFile.new.parse("lane :test do get_info_plist_value(path: '#{plist_path}', key: 'CFBundleIdentifier') end").runner.execute(:test) Fastlane::FastFile.new.parse("lane :test do set_info_plist_value(path: '#{plist_path}', key: 'CFBundleIdentifier', value: '#{new_value}') end").runner.execute(:test) Fastlane::FastFile.new.parse("lane :test do set_info_plist_value(path: '#{plist_path}', key: 'CFBundleIdentifier', value: '#{new_value}') end").runner.execute(:test) value = Fastlane::FastFile.new.parse("lane :test do get_info_plist_value(path: '#{plist_path}', key: 'CFBundleIdentifier') end").runner.execute(:test) expect(value).to eq(new_value) ret = Fastlane::FastFile.new.parse("lane :test do set_info_plist_value(path: '#{plist_path}', key: 'CFBundleIdentifier', value: '#{old_value}') end").runner.execute(:test) expect(ret).to eq(old_value) end it "stores changes in the output plist file" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) old_value = Fastlane::FastFile.new.parse("lane :test do get_info_plist_value(path: '#{plist_path}', key: 'CFBundleIdentifier') end").runner.execute(:test) Fastlane::FastFile.new.parse("lane :test do set_info_plist_value(path: '#{plist_path}', key: 'CFBundleIdentifier', value: '#{new_value}', output_file_name:'#{File.join(test_path, output_path)}') end").runner.execute(:test) value = Fastlane::FastFile.new.parse("lane :test do get_info_plist_value(path: '#{plist_path}', key: 'CFBundleIdentifier') end").runner.execute(:test) expect(value).to eq(old_value) value = Fastlane::FastFile.new.parse("lane :test do get_info_plist_value(path: '#{File.join(test_path, output_path)}', key: 'CFBundleIdentifier') end").runner.execute(:test) expect(value).to eq(new_value) File.delete(File.join(test_path, output_path)) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/xcodebuild_spec.rb
fastlane/spec/actions_specs/xcodebuild_spec.rb
describe Fastlane do describe Fastlane::FastFile do build_log_path = File.expand_path("#{FastlaneCore::Helper.buildlog_path}/fastlane/xcbuild/#{Time.now.strftime('%F')}/#{Process.pid}/xcodebuild.log") describe "Xcodebuild Integration" do before :each do Fastlane::Actions.lane_context.delete(:IPA_OUTPUT_PATH) Fastlane::Actions.lane_context.delete(:XCODEBUILD_ARCHIVE) end it "works with all parameters" do result = Fastlane::FastFile.new.parse("lane :test do xcodebuild( analyze: true, archive: true, build: true, clean: true, install: true, installsrc: true, test: true, arch: 'architecture', alltargets: true, archive_path: './build/MyApp.xcarchive', configuration: 'Debug', derivedDataPath: '/derived/data/path', destination: 'name=iPhone 5s,OS=8.1', destination_timeout: 240, dry_run: true, enable_address_sanitizer: true, enable_thread_sanitizer: false, enable_code_coverage: true, export_archive: true, export_format: 'ipa', export_installer_identity: true, export_options_plist: '/path/to/plist', export_path: './build/MyApp', export_profile: 'MyApp Distribution', export_signing_identity: 'Distribution: MyCompany, LLC', export_with_original_signing_identity: true, hide_shell_script_environment: true, jobs: 5, parallelize_targets: true, keychain: '/path/to/My.keychain', project: 'MyApp.xcodeproj', result_bundle_path: '/result/bundle/path', scheme: 'MyApp', sdk: 'iphonesimulator', skip_unavailable_actions: true, target: 'MyAppTarget', toolchain: 'toolchain name', workspace: 'MyApp.xcworkspace', xcconfig: 'my.xcconfig', buildlog_path: 'mypath', raw_buildlog: false, xcpretty_output: 'test', xcargs: '-newArgument YES' ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && xcodebuild analyze archive build clean install installsrc test -arch \"architecture\" " \ "-alltargets -archivePath \"./build/MyApp.xcarchive\" -configuration \"Debug\" -derivedDataPath \"/derived/data/path\" " \ "-destination \"name=iPhone 5s,OS=8.1\" -destination-timeout \"240\" -dry-run -exportArchive -exportFormat \"ipa\" " \ "-exportInstallerIdentity -exportOptionsPlist \"/path/to/plist\" -exportPath \"./build/MyApp\" -exportProvisioningProfile " \ "\"MyApp Distribution\" -exportSigningIdentity \"Distribution: MyCompany, LLC\" -exportWithOriginalSigningIdentity " \ "-hideShellScriptEnvironment -jobs \"5\" -parallelizeTargets OTHER_CODE_SIGN_FLAGS=\"--keychain /path/to/My.keychain\" -project " \ "\"MyApp.xcodeproj\" -resultBundlePath \"/result/bundle/path\" -scheme \"MyApp\" -sdk \"iphonesimulator\" -skipUnavailableActions -target " \ "\"MyAppTarget\" -toolchain \"toolchain name\" -workspace \"MyApp.xcworkspace\" -xcconfig \"my.xcconfig\" -newArgument YES -enableAddressSanitizer " \ "\"YES\" -enableThreadSanitizer \"NO\" -enableCodeCoverage \"YES\" | tee 'mypath/xcodebuild.log' | xcpretty --color --test" ) end it "works with a destination list" do result = Fastlane::FastFile.new.parse("lane :test do xcodebuild( destination: [ 'name=iPhone 5s,OS=8.1', 'name=iPhone 4,OS=7.1', ], destination_timeout: 240 ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-destination \"name=iPhone 5s,OS=8.1\" " \ + "-destination \"name=iPhone 4,OS=7.1\" " \ + "-destination-timeout \"240\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "| tee '#{build_log_path}' | xcpretty --color --simple" ) end it "works with build settings" do result = Fastlane::FastFile.new.parse("lane :test do xcodebuild( build_settings: { 'CODE_SIGN_IDENTITY' => 'iPhone Developer: Josh', 'JOBS' => 16, 'PROVISIONING_PROFILE' => 'JoshIsCoolProfile', 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) NDEBUG=1' } ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "CODE_SIGN_IDENTITY=\"iPhone Developer: Josh\" " \ + "JOBS=\"16\" " \ + "PROVISIONING_PROFILE=\"JoshIsCoolProfile\" " \ + "GCC_PREPROCESSOR_DEFINITIONS=\"\\$(inherited) NDEBUG=1\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "| tee '#{build_log_path}' | xcpretty --color --simple" ) # expect(result).to include('CODE_SIGN_IDENTITY="iPhone Developer: Josh"') # expect(result).to include('JOBS="16"') # expect(result).to include('PROVISIONING_PROFILE="JoshIsCoolProfile"') end it "works with export_options_plist as hash" do result = Fastlane::FastFile.new.parse("lane :test do xcodebuild( archive_path: './build-dir/MyApp.xcarchive', export_archive: true, export_options_plist: { method: \"ad-hoc\", thinning: \"<thin-for-all-variants>\", teamID: \"1234567890\", manifest: { appURL: \"https://example.com/path/MyApp Name.ipa\", displayImageURL: \"https://example.com/display image.png\", fullSizeImageURL: \"https://example.com/fullSize image.png\", }, } ) end").runner.execute(:test) expect(result).to start_with( "set -o pipefail && " \ + "xcodebuild " \ + "-archivePath \"./build-dir/MyApp.xcarchive\" " \ + "-exportArchive " \ ) expect(result).to match(/-exportOptionsPlist \".*\.plist\"/) expect(result).to end_with( "-exportPath \"./build-dir/MyApp\" " \ + "| tee '#{build_log_path}' | xcpretty --color --simple" ) end it "works with export_options_plist as hash which contains no manifest" do result = Fastlane::FastFile.new.parse("lane :test do xcodebuild( archive_path: './build-dir/MyApp.xcarchive', export_archive: true, export_options_plist: { method: \"ad-hoc\", thinning: \"<thin-for-all-variants>\", teamID: \"1234567890\", } ) end").runner.execute(:test) expect(result).to start_with( "set -o pipefail && " \ + "xcodebuild " \ + "-archivePath \"./build-dir/MyApp.xcarchive\" " \ + "-exportArchive " \ ) expect(result).to match(/-exportOptionsPlist \".*\.plist\"/) expect(result).to end_with( "-exportPath \"./build-dir/MyApp\" " \ + "| tee '#{build_log_path}' | xcpretty --color --simple" ) end it "when archiving, should cache the archive path for a later export step" do Fastlane::FastFile.new.parse("lane :test do xcodebuild( archive: true, archive_path: './build/MyApp.xcarchive', scheme: 'MyApp', workspace: 'MyApp.xcworkspace' ) end").runner.execute(:test) expect(Fastlane::Actions.lane_context[:XCODEBUILD_ARCHIVE]).to eq("./build/MyApp.xcarchive") end it "when exporting, should use the cached archive path from a previous archive step" do result = Fastlane::FastFile.new.parse("lane :test do xcodebuild( archive: true, archive_path: './build-dir/MyApp.xcarchive', scheme: 'MyApp', workspace: 'MyApp.xcworkspace' ) xcodebuild( export_archive: true, export_path: './build-dir/MyApp' ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-exportArchive " \ + "-exportPath \"./build-dir/MyApp\" " \ + "-archivePath \"./build-dir/MyApp.xcarchive\" " \ + "| tee '#{build_log_path}' | xcpretty --color --simple" ) end it "when exporting, should cache the ipa path for a later deploy step" do Fastlane::FastFile.new.parse("lane :test do xcodebuild( archive_path: './build-dir/MyApp.xcarchive', export_archive: true, export_path: './build-dir/MyApp' ) end").runner.execute(:test) expect(Fastlane::Actions.lane_context[:IPA_OUTPUT_PATH]).to eq("./build-dir/MyApp.ipa") end it "when exporting Mac app, should cache the app path for a later deploy step" do Fastlane::FastFile.new.parse("lane :test do xcodebuild( archive_path: './build-dir/MyApp.xcarchive', export_archive: true, export_format: 'app', export_path: './build-dir/MyApp' ) end").runner.execute(:test) expect(Fastlane::Actions.lane_context[:IPA_OUTPUT_PATH]).to eq("./build-dir/MyApp.app") end context "when using environment variables" before :each do ENV["XCODE_BUILD_PATH"] = "./build-dir/" ENV["XCODE_SCHEME"] = "MyApp" ENV["XCODE_WORKSPACE"] = "MyApp.xcworkspace" end after :each do ENV.delete("XCODE_BUILD_PATH") ENV.delete("XCODE_SCHEME") ENV.delete("XCODE_WORKSPACE") end it "can archive" do result = Fastlane::FastFile.new.parse("lane :test do xcodebuild( archive: true ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "archive " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "-archivePath \"./build-dir/MyApp.xcarchive\" " \ + "| tee '#{build_log_path}' | xcpretty --color --simple" ) end it "can export" do ENV.delete("XCODE_SCHEME") ENV.delete("XCODE_WORKSPACE") result = Fastlane::FastFile.new.parse("lane :test do xcodebuild( archive_path: './build-dir/MyApp.xcarchive', export_archive: true ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-archivePath \"./build-dir/MyApp.xcarchive\" " \ + "-exportArchive " \ + "-exportPath \"./build-dir/MyApp\" " \ + "| tee '#{build_log_path}' | xcpretty --color --simple" ) end end describe "xcarchive" do it "is equivalent to 'xcodebuild archive'" do result = Fastlane::FastFile.new.parse("lane :test do xcarchive( archive_path: './build-dir/MyApp.xcarchive', scheme: 'MyApp', workspace: 'MyApp.xcworkspace' ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-archivePath \"./build-dir/MyApp.xcarchive\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "archive " \ + "| tee '#{build_log_path}' | xcpretty --color --simple" ) end end describe "xcbuild" do it "is equivalent to 'xcodebuild build'" do result = Fastlane::FastFile.new.parse("lane :test do xcbuild( scheme: 'MyApp', workspace: 'MyApp.xcworkspace' ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "| tee '#{build_log_path}' | xcpretty --color --simple" ) end end describe "xcbuild without xpretty" do it "is equivalent to 'xcodebuild build'" do result = Fastlane::FastFile.new.parse("lane :test do xcbuild( scheme: 'MyApp', workspace: 'MyApp.xcworkspace', raw_buildlog: true ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "| tee '#{build_log_path}' " ) end end # describe "xcbuild without xpretty and with test" do # it "is equivalent to 'xcodebuild build'" do # result = Fastlane::FastFile.new.parse("lane :test do # xcbuild( # scheme: 'MyApp', # workspace: 'MyApp.xcworkspace', # raw_buildlog: true, # test: true # ) # end").runner.execute(:test) # expect(result).to eq( # "set -o pipefail && " \ # + "xcodebuild " \ # + "-scheme \"MyApp\" " \ # + "-workspace \"MyApp.xcworkspace\" " \ # + "build test " \ # + "| tee '#{build_log_path}' " # ) # end # end describe "xcbuild without xpretty and with test and reports" do it "is equivalent to 'xcodebuild build'" do result = Fastlane::FastFile.new.parse("lane :test do xcbuild( scheme: 'MyApp', workspace: 'MyApp.xcworkspace', raw_buildlog: true, report_formats: ['html'], test: true ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "cat '#{build_log_path}' " \ + "| xcpretty --color --report html --test > /dev/null" ) end end describe "xcclean" do it "is equivalent to 'xcodebuild clean'" do result = Fastlane::FastFile.new.parse("lane :test do xcclean end").runner.execute(:test) expect(result).to eq( "set -o pipefail && xcodebuild clean | tee '#{build_log_path}' | xcpretty --color --simple" ) end end # describe "xcexport" do # it "is equivalent to 'xcodebuild -exportArchive'" do # result = Fastlane::FastFile.new.parse("lane :test do # xcexport( # archive_path: './build-dir/MyApp.xcarchive', # export_path: './build-dir/MyApp', # ) # end").runner.execute(:test) # expect(result).to eq( # "set -o pipefail && " \ # + "xcodebuild " \ # + "-archivePath \"./build-dir/MyApp.xcarchive\" " \ # + "-exportArchive " \ # + "-exportPath \"./build-dir/MyApp\" " \ # + "| tee '#{build_log_path}' | xcpretty --color --simple" # ) # end # end describe "xctest" do it "is equivalent to 'xcodebuild build test'" do result = Fastlane::FastFile.new.parse("lane :test do xctest( destination: 'name=iPhone 5s,OS=8.1', destination_timeout: 240, scheme: 'MyApp', workspace: 'MyApp.xcworkspace' ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-destination \"name=iPhone 5s,OS=8.1\" " \ + "-destination-timeout \"240\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "test " \ + "| tee '#{build_log_path}' | xcpretty --color --test" ) end end describe "address sanitizer" do it "address sanitizer is enabled" do result = Fastlane::FastFile.new.parse("lane :test do xctest( destination: 'name=iPhone 5s,OS=8.1', destination_timeout: 240, scheme: 'MyApp', workspace: 'MyApp.xcworkspace', enable_address_sanitizer: true ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-destination \"name=iPhone 5s,OS=8.1\" " \ + "-destination-timeout \"240\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "test " \ + "-enableAddressSanitizer \"YES\" " \ + "| tee '#{build_log_path}' | xcpretty --color --test" ) end it "address sanitizer is disabled" do result = Fastlane::FastFile.new.parse("lane :test do xctest( destination: 'name=iPhone 5s,OS=8.1', destination_timeout: 240, scheme: 'MyApp', workspace: 'MyApp.xcworkspace', enable_address_sanitizer: false ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-destination \"name=iPhone 5s,OS=8.1\" " \ + "-destination-timeout \"240\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "test " \ + "-enableAddressSanitizer \"NO\" " \ + "| tee '#{build_log_path}' | xcpretty --color --test" ) end end describe "thread sanitizer" do it "thread sanitizer is enabled" do result = Fastlane::FastFile.new.parse("lane :test do xctest( destination: 'name=iPhone 5s,OS=8.1', destination_timeout: 240, scheme: 'MyApp', workspace: 'MyApp.xcworkspace', enable_thread_sanitizer: true ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-destination \"name=iPhone 5s,OS=8.1\" " \ + "-destination-timeout \"240\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "test " \ + "-enableThreadSanitizer \"YES\" " \ + "| tee '#{build_log_path}' | xcpretty --color --test" ) end it "thread sanitizer is disabled" do result = Fastlane::FastFile.new.parse("lane :test do xctest( destination: 'name=iPhone 5s,OS=8.1', destination_timeout: 240, scheme: 'MyApp', workspace: 'MyApp.xcworkspace', enable_thread_sanitizer: false ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-destination \"name=iPhone 5s,OS=8.1\" " \ + "-destination-timeout \"240\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "test " \ + "-enableThreadSanitizer \"NO\" " \ + "| tee '#{build_log_path}' | xcpretty --color --test" ) end end describe 'overriding xcodebuild architecture' do it 'does not override the architecture if the option is not present' do result = Fastlane::FastFile.new.parse("lane :build do xcodebuild( scheme: 'MyApp', workspace: 'MyApp.xcworkspace', ) end").runner.execute(:build) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "| tee '#{build_log_path}' | xcpretty --color --simple" ) end it 'overrides the architecture with what is specified if the option is present' do result = Fastlane::FastFile.new.parse("lane :build do xcodebuild( scheme: 'MyApp', workspace: 'MyApp.xcworkspace', xcodebuild_architecture: 'x86_64' ) end").runner.execute(:build) expect(result).to eq( "set -o pipefail && " \ + "arch -x86_64 " \ + "xcodebuild " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "| tee '#{build_log_path}' | xcpretty --color --simple" ) end end describe "test code coverage" do it "code coverage is enabled" do result = Fastlane::FastFile.new.parse("lane :test do xctest( destination: 'name=iPhone 5s,OS=8.1', destination_timeout: 240, scheme: 'MyApp', workspace: 'MyApp.xcworkspace', enable_code_coverage: true ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-destination \"name=iPhone 5s,OS=8.1\" " \ + "-destination-timeout \"240\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "test " \ + "-enableCodeCoverage \"YES\" " \ + "| tee '#{build_log_path}' | xcpretty --color --test" ) end it "code coverage is disabled" do result = Fastlane::FastFile.new.parse("lane :test do xctest( destination: 'name=iPhone 5s,OS=8.1', destination_timeout: 240, scheme: 'MyApp', workspace: 'MyApp.xcworkspace', enable_code_coverage: false ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-destination \"name=iPhone 5s,OS=8.1\" " \ + "-destination-timeout \"240\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "test " \ + "-enableCodeCoverage \"NO\" " \ + "| tee '#{build_log_path}' | xcpretty --color --test" ) end end describe "test reporting" do it "should work with xcpretty report params" do result = Fastlane::FastFile.new.parse("lane :test do xctest( destination: 'name=iPhone 5s,OS=8.1', scheme: 'MyApp', workspace: 'MyApp.xcworkspace', report_formats: ['junit'], report_path: './build-dir/test-report' ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-destination \"name=iPhone 5s,OS=8.1\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "test " \ + "| tee '#{build_log_path}' | xcpretty --color " \ + "--report junit " \ + "--output \"./build-dir/test-report\" " \ + "--test" ) end it "should save reports to BUILD_PATH + \"/report\" by default" do ENV["XCODE_BUILD_PATH"] = "./build" result = Fastlane::FastFile.new.parse("lane :test do xctest( destination: 'name=iPhone 5s,OS=8.1', scheme: 'MyApp', workspace: 'MyApp.xcworkspace', report_formats: ['html'], report_screenshots: true ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-destination \"name=iPhone 5s,OS=8.1\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "test " \ + "| tee '#{build_log_path}' | xcpretty --color " \ + "--report html " \ + "--screenshots " \ + "--output \"./build/report\" " \ + "--test" ) ENV.delete("XCODE_BUILD_PATH") end it "should support multiple output formats" do result = Fastlane::FastFile.new.parse("lane :test do xctest( destination: 'name=iPhone 5s,OS=8.1', scheme: 'MyApp', workspace: 'MyApp.xcworkspace', report_formats: [ 'html', 'junit', 'json-compilation-database' ] ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-destination \"name=iPhone 5s,OS=8.1\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "test " \ + "| tee '#{build_log_path}' | xcpretty --color " \ + "--report html " \ + "--report json-compilation-database " \ + "--report junit " \ + "--test" ) end it "should support multiple reports " do result = Fastlane::FastFile.new.parse("lane :test do xctest( destination: 'name=iPhone 5s,OS=8.1', scheme: 'MyApp', workspace: 'MyApp.xcworkspace', reports: [{ report: 'html', output: './build-dir/test-report.html', screenshots: 1 }, { report: 'junit', output: './build-dir/test-report.xml' }], ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-destination \"name=iPhone 5s,OS=8.1\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "test " \ + "| tee '#{build_log_path}' | xcpretty --color " \ + "--report html " \ + "--output \"./build-dir/test-report.html\" " \ + "--screenshots " \ + "--report junit " \ + "--output \"./build-dir/test-report.xml\" " \ + "--test" ) end it "should support omitting output when specifying multiple reports " do ENV["XCODE_BUILD_PATH"] = "./build" result = Fastlane::FastFile.new.parse("lane :test do xctest( destination: 'name=iPhone 5s,OS=8.1', scheme: 'MyApp', workspace: 'MyApp.xcworkspace', reports: [{ report: 'html', }, { report: 'junit', }], ) end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "-destination \"name=iPhone 5s,OS=8.1\" " \ + "-scheme \"MyApp\" " \ + "-workspace \"MyApp.xcworkspace\" " \ + "build " \ + "test " \ + "| tee '#{build_log_path}' | xcpretty --color " \ + "--report html " \ + "--output \"./build/report/report.html\" " \ + "--report junit " \ + "--output \"./build/report/report.xml\" " \ + "--test" ) end it "should detect and use the workspace, when a workspace is present" do allow(Dir).to receive(:glob).with("*.xcworkspace").and_return(["MyApp.xcworkspace"]) result = Fastlane::FastFile.new.parse("lane :test do xcbuild end").runner.execute(:test) expect(result).to eq( "set -o pipefail && " \ + "xcodebuild " \ + "build " \ + "-workspace \"MyApp.xcworkspace\" " \ + "| tee '#{build_log_path}' | xcpretty --color " \ + "--simple" ) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/get_build_number_action_spec.rb
fastlane/spec/actions_specs/get_build_number_action_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Get Build Number Integration" do require 'shellwords' it "gets the build number of the Xcode project" do Fastlane::FastFile.new.parse("lane :test do get_build_number(xcodeproj: '.xcproject') end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER]).to match(/cd .* && agvtool what-version -terse/) end it "raises an exception when user passes workspace" do expect do Fastlane::FastFile.new.parse("lane :test do get_build_number(xcodeproj: 'project.xcworkspace') end").runner.execute(:test) end.to raise_error("Please pass the path to the project, not the workspace") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/copy_artifacts_spec.rb
fastlane/spec/actions_specs/copy_artifacts_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Copy Artifacts Integration" do before do # Create base test directory @tmp_path = Dir.mktmpdir FileUtils.mkdir_p("#{@tmp_path}/source") end it "Copies a file to target path" do FileUtils.touch("#{@tmp_path}/source/copy_artifacts") Fastlane::FastFile.new.parse("lane :test do copy_artifacts(artifacts: '#{@tmp_path}/source/copy_artifacts', target_path: '#{@tmp_path}/target') end").runner.execute(:test) expect(File.exist?("#{@tmp_path}/target/copy_artifacts")).to eq(true) end it "Copies a directory and subfiles to target path" do FileUtils.mkdir_p("#{@tmp_path}/source/dir") FileUtils.touch("#{@tmp_path}/source/dir/copy_artifacts") Fastlane::FastFile.new.parse("lane :test do copy_artifacts(artifacts: '#{@tmp_path}/source/*', target_path: '#{@tmp_path}/target/') end").runner.execute(:test) expect(Dir.exist?("#{@tmp_path}/target/dir")).to eq(true) expect(File.exist?("#{@tmp_path}/target/dir/copy_artifacts")).to eq(true) end it "Copies a file with a space" do FileUtils.touch("#{@tmp_path}/source/copy_artifacts\ with\ a\ space") Fastlane::FastFile.new.parse("lane :test do copy_artifacts(artifacts: '#{@tmp_path}/source/copy_artifacts\ with\ a\ space', target_path: '#{@tmp_path}/target') end").runner.execute(:test) expect(File.exist?("#{@tmp_path}/target/copy_artifacts\ with\ a\ space")).to eq(true) end it "Copies a file with verbose" do source_path = "#{@tmp_path}/source" FileUtils.touch(source_path) target_path = "#{@tmp_path}/target738" expect(UI).to receive(:verbose).once.ordered.with("Copying artifacts #{source_path} to #{target_path}") expect(UI).to receive(:verbose).once.ordered.with('Keeping original files') FastlaneSpec::Env.with_verbose(true) do Fastlane::FastFile.new.parse("lane :test do copy_artifacts(artifacts: '#{source_path}', target_path: '#{target_path}') end").runner.execute(:test) end expect(File.exist?(source_path)).to eq(true) expect(File.exist?(target_path)).to eq(true) end it "Copies a file without keeping original and verbose" do source_path = "#{@tmp_path}/source" FileUtils.touch(source_path) target_path = "#{@tmp_path}/target987" expect(UI).to receive(:verbose).once.ordered.with("Copying artifacts #{source_path} to #{target_path}") expect(UI).to receive(:verbose).once.ordered.with('Not keeping original files') FastlaneSpec::Env.with_verbose(true) do Fastlane::FastFile.new.parse("lane :test do copy_artifacts(artifacts: '#{source_path}', target_path: '#{target_path}', keep_original: false) end").runner.execute(:test) end expect(File.exist?(source_path)).to eq(false) expect(File.exist?(target_path)).to eq(true) end it "Copies a file with file missing does not fail (no flag set)" do source_path = "#{@tmp_path}/source/missing" target_path = "#{@tmp_path}/target123" Fastlane::FastFile.new.parse("lane :test do copy_artifacts(artifacts: '#{source_path}', target_path: '#{target_path}') end").runner.execute(:test) expect(File.exist?(source_path)).to eq(false) end it "Copies a file with file missing fails (flag set)" do source_path = "#{@tmp_path}/source/not_going_to_be_there" target_path = "#{@tmp_path}/target456" expect do Fastlane::FastFile.new.parse("lane :test do copy_artifacts(artifacts: '#{source_path}', target_path: '#{target_path}', fail_on_missing: true) end").runner.execute(:test) end.to raise_error("Not all files were present in copy artifacts. Missing #{source_path}") expect(File.exist?(source_path)).to eq(false) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/import_certificate_spec.rb
fastlane/spec/actions_specs/import_certificate_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Import certificate Integration" do before(:each) do allow(FastlaneCore::Helper).to receive(:backticks).with('security -h | grep set-key-partition-list', print: false).and_return(' set-key-partition-list Set the partition list of a key.') end it "works with certificate and password" do cert_name = "test.cer" keychain = 'test.keychain' password = 'testpassword' keychain_path = File.expand_path(File.join('~', 'Library', 'Keychains', keychain)) expected_command = "security import #{cert_name} -k '#{keychain_path}' -P #{password} -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild -T /usr/bin/productsign 1> /dev/null" # this command is also sent on macOS Sierra and we need to allow it or else the test will fail allowed_command = "security set-key-partition-list -S apple-tool:,apple: -s -k #{''.shellescape} #{keychain_path.shellescape} 1> /dev/null" allow(File).to receive(:file?).and_return(false) allow(File).to receive(:file?).with(keychain_path).and_return(true) allow(File).to receive(:exist?).and_return(false) expect(File).to receive(:exist?).with(cert_name).and_return(true) allow(Open3).to receive(:popen3).with(expected_command) allow(Open3).to receive(:popen3).with(allowed_command) Fastlane::FastFile.new.parse("lane :test do import_certificate ({ keychain_name: '#{keychain}', certificate_path: '#{cert_name}', certificate_password: '#{password}' }) end").runner.execute(:test) end it "works with certificate and password that contain spaces, special chars, or '\'" do cert_name = '\" test \".cer' keychain = '\" test \".keychain' password = '\"test pa$$word\"' keychain_path = File.expand_path(File.join('~', 'Library', 'Keychains', keychain)) expected_security_import_command = "security import #{cert_name.shellescape} -k '#{keychain_path.shellescape}' -P #{password.shellescape} -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild -T /usr/bin/productsign 1> /dev/null" # this command is also sent on macOS Sierra and we need to allow it or else the test will fail expected_set_key_partition_list_command = "security set-key-partition-list -S apple-tool:,apple: -s -k #{password.shellescape} #{keychain_path.shellescape} 1> /dev/null" allow(File).to receive(:file?).and_return(false) allow(File).to receive(:file?).with(keychain_path).and_return(true) allow(File).to receive(:exist?).and_return(false) expect(File).to receive(:exist?).with(cert_name).and_return(true) allow(Open3).to receive(:popen3).with(expected_security_import_command) allow(Open3).to receive(:popen3).with(expected_set_key_partition_list_command) Fastlane::FastFile.new.parse("lane :test do import_certificate ({ keychain_name: '#{keychain}', keychain_password: '#{password}', certificate_path: '#{cert_name}', certificate_password: '#{password}' }) end").runner.execute(:test) end it "works with a boolean for log_output" do cert_name = "test.cer" keychain = 'test.keychain' password = 'testpassword' keychain_path = File.expand_path(File.join('~', 'Library', 'Keychains', keychain)) expected_command = "security import #{cert_name} -k '#{keychain_path}' -P #{password} -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild -T /usr/bin/productsign" # this command is also sent on macOS Sierra and we need to allow it or else the test will fail allowed_command = "security set-key-partition-list -S apple-tool:,apple: -s -k #{''.shellescape} #{keychain_path.shellescape} 1> /dev/null" allow(File).to receive(:file?).and_return(false) allow(File).to receive(:file?).with(keychain_path).and_return(true) allow(File).to receive(:exist?).and_return(false) expect(File).to receive(:exist?).with(cert_name).and_return(true) allow(Open3).to receive(:popen3).with(expected_command) allow(Open3).to receive(:popen3).with(allowed_command) Fastlane::FastFile.new.parse("lane :test do import_certificate ({ keychain_name: '#{keychain}', certificate_path: '#{cert_name}', certificate_password: '#{password}', log_output: true }) end").runner.execute(:test) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/team_name_spec.rb
fastlane/spec/actions_specs/team_name_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Team Name Action" do it "works as expected" do new_val = "abcdef" Fastlane::FastFile.new.parse("lane :test do team_name '#{new_val}' end").runner.execute(:test) [:FASTLANE_TEAM_NAME, :PRODUCE_TEAM_NAME].each do |current| expect(ENV[current.to_s]).to eq(new_val) end end it "raises an error if no team Name is given" do expect do Fastlane::FastFile.new.parse("lane :test do team_name end").runner.execute(:test) end.to raise_error("Please pass your Team Name (e.g. team_name 'Felix Krause')") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/increment_build_number_spec.rb
fastlane/spec/actions_specs/increment_build_number_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Increment Build Number Integration" do require 'shellwords' describe "With agv enabled" do before(:each) do allow(Fastlane::Actions::IncrementBuildNumberAction).to receive(:system).with(/agvtool/).and_return(true) end it "increments the build number of the Xcode project" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool next[-]version [-]all && cd [-]/) .once .and_return("") expect(Fastlane::Actions).to receive(:sh) .with(/agvtool what[-]version/, log: false) .once .and_return("Current version of project Test is:\n40") Fastlane::FastFile.new.parse("lane :test do increment_build_number(xcodeproj: '.xcproject') end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER]).to eq('40') end it "pass a custom build number to the tool" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool new[-]version [-]all 24 && cd [-]/) .once .and_return("") result = Fastlane::FastFile.new.parse("lane :test do increment_build_number(build_number: 24, xcodeproj: '.xcproject') end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER]).to eq('24') end it "skips info plist updating" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool new[-]version 24 && cd [-]/) .once .and_return("") result = Fastlane::FastFile.new.parse("lane :test do increment_build_number(build_number: 24, xcodeproj: '.xcproject', skip_info_plist: true) end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER]).to eq('24') end it "displays error when $(SRCROOT) detected" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool new[-]version [-]all 24 && cd [-]/) .and_return("Something\n$(SRCROOT)/Test/Info.plist") expect(UI).to receive(:error).with('Cannot set build number with plist path containing $(SRCROOT)') expect(UI).to receive(:error).with('Please remove $(SRCROOT) in your Xcode target build settings') result = Fastlane::FastFile.new.parse("lane :test do increment_build_number(build_number: 24, xcodeproj: '.xcproject') end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER]).to eq('24') end it "raises an exception when user passes workspace" do expect do Fastlane::FastFile.new.parse("lane :test do increment_build_number(xcodeproj: 'project.xcworkspace') end").runner.execute(:test) end.to raise_error("Please pass the path to the project, not the workspace") end it "properly removes new lines of the build number" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool new[-]version [-]all 24 && cd [-]/) .once .and_return("") result = Fastlane::FastFile.new.parse("lane :test do increment_build_number(build_number: '24\n', xcodeproj: '.xcproject') end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER]).to eq('24') end end describe "With agv not enabled" do before(:each) do allow(Fastlane::Actions::IncrementBuildNumberAction).to receive(:system).and_return(nil) end it "raises an exception when agv not enabled" do expect do Fastlane::FastFile.new.parse("lane :test do increment_build_number(xcodeproj: '.xcproject') end").runner.execute(:test) end.to raise_error(/Apple Generic Versioning is not enabled./) end it "pass a custom build number to the tool" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool new[-]version [-]all 21 && cd [-]/) .once .and_return("") result = Fastlane::FastFile.new.parse("lane :test do increment_build_number(build_number: 21, xcodeproj: '.xcproject') end").runner.execute(:test) expect(result).to eq('21') expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER]).to eq('21') end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/reset_git_repo_spec.rb
fastlane/spec/actions_specs/reset_git_repo_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "reset_git_repo" do it "works as expected inside a Fastfile" do paths = Fastlane::FastFile.new.parse("lane :test do reset_git_repo(force: true, files: ['.']) end").runner.execute(:test) expect(paths).to eq(['.']) end it "works as expected inside a Fastfile" do expect do ff = Fastlane::FastFile.new.parse("lane :test do reset_git_repo end").runner.execute(:test) end.to raise_exception("This is a destructive and potentially dangerous action. To protect from data loss, please add the `ensure_git_status_clean` action to the beginning of your lane, or if you're absolutely sure of what you're doing then call this action with the :force option.") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/run_tests_spec.rb
fastlane/spec/actions_specs/run_tests_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Scan Integration" do context ":fail_build" do it "raises an error if build/compile error and fail_build is true" do allow(Scan).to receive(:config=).and_return(nil) allow_any_instance_of(Scan::Manager).to receive(:work).and_raise(FastlaneCore::Interface::FastlaneBuildFailure.new) expect do Fastlane::FastFile.new.parse("lane :test do run_tests(fail_build: true) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneBuildFailure) end it "raises an error if build/compile error and fail_build is false" do allow(Scan).to receive(:config=).and_return(nil) allow_any_instance_of(Scan::Manager).to receive(:work).and_raise(FastlaneCore::Interface::FastlaneBuildFailure.new) expect do Fastlane::FastFile.new.parse("lane :test do run_tests(fail_build: false) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneBuildFailure) end it "raises an error if tests fail and fail_build is true" do allow(Scan).to receive(:config=).and_return(nil) allow_any_instance_of(Scan::Manager).to receive(:work).and_raise(FastlaneCore::Interface::FastlaneTestFailure.new) expect do Fastlane::FastFile.new.parse("lane :test do run_tests(fail_build: true) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneTestFailure) end it "does not raise an error if tests fail and fail_build is false" do allow(Scan).to receive(:config=).and_return(nil) allow_any_instance_of(Scan::Manager).to receive(:work).and_raise(FastlaneCore::Interface::FastlaneTestFailure.new) expect do Fastlane::FastFile.new.parse("lane :test do run_tests(fail_build: false) end").runner.execute(:test) end.not_to(raise_error) end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/unlock_keychain_spec.rb
fastlane/spec/actions_specs/unlock_keychain_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Unlock keychain Integration" do # do not use lazy init here # this will prevent race conditions during parallel runs let!(:keychain_path) { Tempfile.new('foo').path } it "works with path and password and existing keychain" do result = Fastlane::FastFile.new.parse("lane :test do unlock_keychain ({ path: '#{keychain_path}', password: 'testpassword' }) end").runner.execute(:test) expect(result.size).to eq(3) expect(result[0]).to start_with("security list-keychains -s") expect(result[0]).to end_with(keychain_path) expect(result[1]).to eq("security unlock-keychain -p testpassword #{keychain_path}") expect(result[2]).to eq("security set-keychain-settings #{keychain_path}") end it "doesn't add keychain to search list" do result = Fastlane::FastFile.new.parse("lane :test do unlock_keychain ({ path: '#{keychain_path}', password: 'testpassword', add_to_search_list: false, }) end").runner.execute(:test) expect(result.size).to eq(2) expect(result[0]).to eq("security unlock-keychain -p testpassword #{keychain_path}") expect(result[1]).to eq("security set-keychain-settings #{keychain_path}") end it "replace keychain in search list" do result = Fastlane::FastFile.new.parse("lane :test do unlock_keychain ({ path: '#{keychain_path}', password: 'testpassword', add_to_search_list: :replace, }) end").runner.execute(:test) expect(result.size).to eq(3) expect(result[0]).to eq("security list-keychains -s #{keychain_path}") expect(result[1]).to eq("security unlock-keychain -p testpassword #{keychain_path}") expect(result[2]).to eq("security set-keychain-settings #{keychain_path}") end it "set default keychain" do result = Fastlane::FastFile.new.parse("lane :test do unlock_keychain ({ path: '#{keychain_path}', password: 'testpassword', set_default: true, }) end").runner.execute(:test) expect(result.size).to eq(4) expect(result[0]).to start_with("security list-keychains -s") expect(result[0]).to end_with(keychain_path) expect(result[1]).to eq("security default-keychain -s #{keychain_path}") expect(result[2]).to eq("security unlock-keychain -p testpassword #{keychain_path}") expect(result[3]).to eq("security set-keychain-settings #{keychain_path}") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/changelog_from_git_commits_spec.rb
fastlane/spec/actions_specs/changelog_from_git_commits_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "changelog_from_git_commits" do it "Collects messages from the last tag to HEAD by default" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits end").runner.execute(:test) # In test mode, Actions.sh returns command to be executed rather than # actual command output. tag_name = %w(git rev-list --tags --max-count=1).shelljoin describe = %W(git describe --tags #{tag_name}).shelljoin changelog = %W(git log --pretty=%B #{describe}...HEAD).shelljoin expect(result).to eq(changelog) end it "Uses the provided pretty format to collect log messages" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(pretty: '%s%n%b') end").runner.execute(:test) tag_name = %w(git rev-list --tags --max-count=1).shelljoin describe = %W(git describe --tags #{tag_name}).shelljoin changelog = %W(git log --pretty=%s%n%b #{describe}...HEAD).shelljoin expect(result).to eq(changelog) end it "Uses the provided date format to collect log messages if specified" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(pretty: '%s%n%b', date_format: 'short') end").runner.execute(:test) tag_name = %w(git rev-list --tags --max-count=1).shelljoin describe = %W(git describe --tags #{tag_name}).shelljoin changelog = %W(git log --pretty=%s%n%b --date=short #{describe}...HEAD).shelljoin expect(result).to eq(changelog) end it "Does not match lightweight tags when searching for the last one if so requested" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(match_lightweight_tag: false) end").runner.execute(:test) tag_name = %w(git rev-list --tags --max-count=1).shelljoin describe = %W(git describe #{tag_name}).shelljoin changelog = %W(git log --pretty=%B #{describe}...HEAD).shelljoin expect(result).to eq(changelog) end it "Collects logs in the specified revision range if specified" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(between: ['abcd', '1234']) end").runner.execute(:test) expect(result).to eq(%w(git log --pretty=%B abcd...1234).shelljoin) end it "Handles tag names with characters that need shell escaping" do tag = 'v1.8.0(30)' result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(between: ['#{tag}', 'HEAD']) end").runner.execute(:test) expect(result).to eq(%W(git log --pretty=%B #{tag}...HEAD).shelljoin) end it "Does not accept a :between array of size 1" do expect do Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(between: ['abcd']) end").runner.execute(:test) end.to raise_error(":between must be an array of size 2") end it "Does not accept a :between array with nil values" do expect do Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(between: ['abcd', nil]) end").runner.execute(:test) end.to raise_error(":between must not contain nil values") end it "Converts a string value for :commits_count" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(commits_count: '10') end").runner.execute(:test) expect(result).to eq(%w(git log --pretty=%B -n 10).shelljoin) end it "Does not accept a :commits_count and :between at the same time" do expect do Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(commits_count: 10, between: ['abcd', '1234']) end").runner.execute(:test) end.to raise_error("Unresolved conflict between options: 'commits_count' and 'between'") end it "Does not accept a :commits_count < 1" do expect do Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(commits_count: -1) end").runner.execute(:test) end.to raise_error(":commits_count must be >= 1") end it "Collects logs with specified number of commits" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(commits_count: 10) end").runner.execute(:test) expect(result).to eq(%w(git log --pretty=%B -n 10).shelljoin) end it "Does not accept an invalid value for :merge_commit_filtering" do values = Fastlane::Actions::GIT_MERGE_COMMIT_FILTERING_OPTIONS.map { |o| "'#{o}'" }.join(', ') error_msg = "Valid values for :merge_commit_filtering are #{values}" expect do Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(merge_commit_filtering: 'invalid') end").runner.execute(:test) end.to raise_error(error_msg) end it "Does not include merge commits in the list of commits" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(include_merges: false) end").runner.execute(:test) tag_name = %w(git rev-list --tags --max-count=1).shelljoin describe = %W(git describe --tags #{tag_name}).shelljoin changelog = %W(git log --pretty=%B #{describe}...HEAD --no-merges).shelljoin expect(result).to eq(changelog) end it "Only include merge commits if merge_commit_filtering is only_include_merges" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(merge_commit_filtering: 'only_include_merges') end").runner.execute(:test) tag_name = %w(git rev-list --tags --max-count=1).shelljoin describe = %W(git describe --tags #{tag_name}).shelljoin changelog = %W(git log --pretty=%B #{describe}...HEAD --merges).shelljoin expect(result).to eq(changelog) end it "Include merge commits if merge_commit_filtering is include_merges" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(merge_commit_filtering: 'include_merges') end").runner.execute(:test) tag_name = %w(git rev-list --tags --max-count=1).shelljoin describe = %W(git describe --tags #{tag_name}).shelljoin changelog = %W(git log --pretty=%B #{describe}...HEAD).shelljoin expect(result).to eq(changelog) end it "Does not include merge commits if merge_commit_filtering is exclude_merges" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(merge_commit_filtering: 'exclude_merges') end").runner.execute(:test) tag_name = %w(git rev-list --tags --max-count=1).shelljoin describe = %W(git describe --tags #{tag_name}).shelljoin changelog = %W(git log --pretty=%B #{describe}...HEAD --no-merges).shelljoin expect(result).to eq(changelog) end it "Uses pattern matching for tag name if requested" do tag_match_pattern = '*1.8*' result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(tag_match_pattern: '#{tag_match_pattern}') end").runner.execute(:test) tag_name = %W(git rev-list --tags=#{tag_match_pattern} --max-count=1).shelljoin describe = %W(git describe --tags #{tag_name} --match #{tag_match_pattern}).shelljoin changelog = %W(git log --pretty=%B #{describe}...HEAD).shelljoin expect(result).to eq(changelog) end it "Does not use pattern matching for tag name if so requested" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits() end").runner.execute(:test) tag_name = %w(git rev-list --tags --max-count=1).shelljoin describe = %W(git describe --tags #{tag_name}).shelljoin changelog = %W(git log --pretty=%B #{describe}...HEAD).shelljoin expect(result).to eq(changelog) end it "Returns a scoped log from the app's path if so requested" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(app_path: './apps/ios') end").runner.execute(:test) tag_name = %w(git rev-list --tags --max-count=1).shelljoin describe = %W(git describe --tags #{tag_name}).shelljoin changelog = %W(git log --pretty=%B #{describe}...HEAD ./apps/ios).shelljoin expect(result).to eq(changelog) end it "Runs between option from command line" do options = FastlaneCore::Configuration.create(Fastlane::Actions::ChangelogFromGitCommitsAction.available_options, { between: '123456,HEAD' }) result = Fastlane::Actions::ChangelogFromGitCommitsAction.run(options) changelog = %w(git log --pretty=%B 123456...HEAD).shelljoin expect(result).to eq(changelog) end it "Accepts string value for :between" do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(between: 'abcd,1234') end").runner.execute(:test) expect(result).to eq(%w(git log --pretty=%B abcd...1234).shelljoin) end it "Does not accept string if it does not contain comma" do expect do result = Fastlane::FastFile.new.parse("lane :test do changelog_from_git_commits(between: 'abcd1234') end").runner.execute(:test) end.to raise_error(":between must be an array of size 2") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/setup_travis_spec.rb
fastlane/spec/actions_specs/setup_travis_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Setup Travis Integration" do let(:tmp_keychain_name) { "fastlane_tmp_keychain" } def check_keychain_nil expect(ENV["MATCH_KEYCHAIN_NAME"]).to be_nil expect(ENV["MATCH_KEYCHAIN_PASSWORD"]).to be_nil expect(ENV["MATCH_READONLY"]).to be_nil end def check_keychain_created expect(ENV["MATCH_KEYCHAIN_NAME"]).to eq(tmp_keychain_name) expect(ENV["MATCH_KEYCHAIN_PASSWORD"]).to eq("") expect(ENV["MATCH_READONLY"]).to eq("true") end it "doesn't work outside CI" do allow(FastlaneCore::Helper).to receive(:mac?).and_return(true) stub_const("ENV", {}) expect(UI).to receive(:message).with("Not running on CI, skipping CI setup") Fastlane::FastFile.new.parse("lane :test do setup_travis end").runner.execute(:test) check_keychain_nil end it "skips outside macOS CI agent" do allow(FastlaneCore::Helper).to receive(:mac?).and_return(false) stub_const("ENV", { "TRAVIS" => "true" }) expect(UI).to receive(:message).with("Skipping Keychain setup on non-macOS CI Agent") Fastlane::FastFile.new.parse("lane :test do setup_travis end").runner.execute(:test) check_keychain_nil end it "works on macOS Environment when forced" do allow(FastlaneCore::Helper).to receive(:mac?).and_return(true) stub_const("ENV", {}) Fastlane::FastFile.new.parse("lane :test do setup_travis( force: true ) end").runner.execute(:test) check_keychain_created end it "works on macOS Environment inside CI" do allow(FastlaneCore::Helper).to receive(:mac?).and_return(true) expect(Fastlane::Actions::CreateKeychainAction).to receive(:run).with( { name: tmp_keychain_name, default_keychain: true, unlock: true, timeout: 3600, lock_when_sleeps: true, password: "", add_to_search_list: true } ) stub_const("ENV", { "TRAVIS" => "true" }) Fastlane::FastFile.new.parse("lane :test do setup_travis end").runner.execute(:test) check_keychain_created end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/hg_push_spec.rb
fastlane/spec/actions_specs/hg_push_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Mercurial Push to Remote Action" do it "works without passing any options" do result = Fastlane::FastFile.new.parse("lane :test do hg_push end").runner.execute(:test) expect(result).to include("hg push") end it "works with options specified" do result = Fastlane::FastFile.new.parse("lane :test do hg_push( destination: 'https://test/owner/repo', force: true ) end").runner.execute(:test) expect(result).to eq("hg push --force https://test/owner/repo") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/set_pod_key_spec.rb
fastlane/spec/actions_specs/set_pod_key_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "CocoaPods-Keys Integration" do it "default use case" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) result = Fastlane::FastFile.new.parse("lane :test do set_pod_key( key: 'APIToken', value: '1234' ) end").runner.execute(:test) expect(result).to eq("bundle exec pod keys set \"APIToken\" \"1234\"") end it "default use case with no bundle exec" do result = Fastlane::FastFile.new.parse("lane :test do set_pod_key( use_bundle_exec: false, key: 'APIToken', value: '1234' ) end").runner.execute(:test) expect(result).to eq("pod keys set \"APIToken\" \"1234\"") end it "appends the project name when provided" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) result = Fastlane::FastFile.new.parse("lane :test do set_pod_key( key: 'APIToken', value: '1234', project: 'MyProject' ) end").runner.execute(:test) expect(result).to eq("bundle exec pod keys set \"APIToken\" \"1234\" \"MyProject\"") end it "requires a key" do expect do Fastlane::FastFile.new.parse("lane :test do set_pod_key( value: '1234' ) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError, /'key'/) end it "requires a value" do expect do Fastlane::FastFile.new.parse("lane :test do set_pod_key( key: 'APIToken' ) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError, /'value'/) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/verify_pod_keys_spec.rb
fastlane/spec/actions_specs/verify_pod_keys_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "CocoaPods Keys Verification" do let(:key) { "Key" } let(:target) { "Target" } before(:each) do options = { "target" => :target, "keys" => [:key] } allow(Fastlane::Actions::VerifyPodKeysAction).to receive(:plugin_options).and_return(options) end describe "valid values" do value = "Value" before(:each) do allow(Fastlane::Actions::VerifyPodKeysAction).to receive(:value).with(:key, :target).and_return(value) end it "raises no exception" do expect do Fastlane::FastFile.new.parse("lane :test do verify_pod_keys end").runner.execute(:test) end.to_not(raise_error) end end describe "invalid values" do value = "" before(:each) do allow(Fastlane::Actions::VerifyPodKeysAction).to receive(:value).with(:key, :target).and_return(value) end it "raises an exception" do expect do Fastlane::FastFile.new.parse("lane :test do verify_pod_keys end").runner.execute(:test) end.to raise_error("Did not pass validation for key key. Run `[bundle exec] pod keys get key target` to see what it is. It's likely this is running with empty/OSS keys.") end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/slather_spec.rb
fastlane/spec/actions_specs/slather_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Slather Integration" do let(:action) { Fastlane::Actions::SlatherAction } it "works with all parameters" do allow(Fastlane::Actions::SlatherAction).to receive(:slather_version).and_return(Gem::Version.create('2.8.0')) source_files = "*.swift" result = Fastlane::FastFile.new.parse("lane :test do slather({ use_bundle_exec: false, build_directory: 'foo', input_format: 'bah', scheme: 'Foo', configuration: 'Bar', buildkite: true, jenkins: true, travis: true, travis_pro: true, circleci: true, coveralls: true, teamcity: true, simple_output: true, gutter_json: true, cobertura_xml: true, sonarqube_xml: true, llvm_cov: true, json: true, html: true, show: true, verbose: true, source_directory: 'baz', output_directory: '123', ignore: 'nothing', proj: 'foo.xcodeproj', binary_basename: ['YourApp', 'YourFramework'], binary_file: 'you', workspace: 'foo.xcworkspace', arch: 'arm64', source_files: '#{source_files}', decimals: '2', ymlfile: 'foo.yml' }) end").runner.execute(:test) expected = "slather coverage --travis --travispro --circleci --jenkins --buildkite --teamcity --coveralls --simple-output --gutter-json --cobertura-xml --sonarqube-xml --llvm-cov --json --html --show --build-directory foo --source-directory baz --output-directory 123 --ignore nothing --verbose --input-format bah --scheme Foo --configuration Bar --workspace foo.xcworkspace --binary-file you --binary-basename YourApp --binary-basename YourFramework --arch arm64 --source-files #{source_files.shellescape} --decimals 2 --ymlfile foo.yml foo.xcodeproj".gsub(/\s+/, ' ') expect(result).to eq(expected) end it "works with bundle" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) allow(Fastlane::Actions::SlatherAction).to receive(:slather_version).and_return(Gem::Version.create('2.8.0')) result = Fastlane::FastFile.new.parse("lane :test do slather({ use_bundle_exec: true, build_directory: 'foo', input_format: 'bah', scheme: 'Foo', configuration: 'Bar', buildkite: true, jenkins: true, travis: true, travis_pro: true, circleci: true, coveralls: true, simple_output: true, gutter_json: true, cobertura_xml: true, sonarqube_xml: true, llvm_cov: true, json: true, html: true, show: true, source_directory: 'baz', output_directory: '123', ignore: 'nothing', proj: 'foo.xcodeproj', binary_basename: ['YourApp', 'YourFramework'], binary_file: 'you', workspace: 'foo.xcworkspace', ymlfile: 'foo.yml' }) end").runner.execute(:test) expected = 'bundle exec slather coverage --travis --travispro --circleci --jenkins --buildkite --coveralls --simple-output --gutter-json --cobertura-xml --sonarqube-xml --llvm-cov --json --html --show --build-directory foo --source-directory baz --output-directory 123 --ignore nothing --input-format bah --scheme Foo --configuration Bar --workspace foo.xcworkspace --binary-file you --binary-basename YourApp --binary-basename YourFramework --ymlfile foo.yml foo.xcodeproj'.gsub(/\s+/, ' ') expect(result).to eq(expected) end it "requires project to be specified if .slather.yml is not found" do expect do Fastlane::FastFile.new.parse("lane :test do slather end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError) end it "does not require project if .slather.yml is found" do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) File.write('./.slather.yml', '') result = Fastlane::FastFile.new.parse("lane :test do slather end").runner.execute(:test) expect(result).to eq("slather coverage") end it "does not require any parameters other than project" do result = Fastlane::FastFile.new.parse("lane :test do slather({ proj: 'foo.xcodeproj' }) end").runner.execute(:test) expect(result).to eq("slather coverage foo.xcodeproj") end it "works with spaces in paths" do allow(Fastlane::Actions::SlatherAction).to receive(:slather_version).and_return(Gem::Version.create('2.8.0')) build_dir = "build dir" source_dir = "source dir" output_dir = "output dir" ignore = "nothing to ignore" scheme = "Foo App" proj = "foo bar.xcodeproj" ymlfile = "fake yml file.yml" result = Fastlane::FastFile.new.parse("lane :test do slather({ build_directory: '#{build_dir}', input_format: 'bah', scheme: '#{scheme}', source_directory: '#{source_dir}', output_directory: '#{output_dir}', ignore: '#{ignore}', ymlfile: '#{ymlfile}', proj: '#{proj}' }) end").runner.execute(:test) expected = "slather coverage --build-directory #{build_dir.shellescape} --source-directory #{source_dir.shellescape} --output-directory #{output_dir.shellescape} --ignore #{ignore.shellescape} --input-format bah --scheme #{scheme.shellescape} --ymlfile #{ymlfile.shellescape} #{proj.shellescape}".gsub(/\s+/, ' ') expect(result).to eq(expected) end it "works with binary_file set to true or false" do possible_values = ["true", "false"] expected = "slather coverage foo.xcodeproj".gsub(/\s+/, ' ') possible_values.each do |value| result = Fastlane::FastFile.new.parse("lane :test do slather({ binary_file: #{value}, proj: 'foo.xcodeproj' }) end").runner.execute(:test) expect(result).to eq(expected) end end it "works with binary_file as string" do result = Fastlane::FastFile.new.parse("lane :test do slather({ binary_file: 'bar', proj: 'foo.xcodeproj' }) end").runner.execute(:test) expect(result).to eq("slather coverage --binary-file bar foo.xcodeproj") end it "works with binary_file as array" do binary_file = ['other', 'stuff'] expected = "slather coverage --binary-file #{binary_file[0]} --binary-file #{binary_file[1]} foo.xcodeproj".gsub(/\s+/, ' ') result = Fastlane::FastFile.new.parse("lane :test do slather({ binary_file: #{binary_file}, proj: 'foo.xcodeproj' }) end").runner.execute(:test) expect(result).to eq(expected) end it "works with binary_basename as string" do result = Fastlane::FastFile.new.parse("lane :test do slather({ binary_basename: 'bar', proj: 'foo.xcodeproj' }) end").runner.execute(:test) expect(result).to eq("slather coverage --binary-basename bar foo.xcodeproj") end it "works with binary_basename as array" do binary_basename = ['other', 'stuff'] expected = "slather coverage --binary-basename #{binary_basename[0]} --binary-basename #{binary_basename[1]} foo.xcodeproj".gsub(/\s+/, ' ') result = Fastlane::FastFile.new.parse("lane :test do slather({ binary_basename: #{binary_basename}, proj: 'foo.xcodeproj' }) end").runner.execute(:test) expect(result).to eq(expected) end it "works with binary_basename as environment string" do ENV['FL_SLATHER_BINARY_BASENAME'] = 'bar' result = Fastlane::FastFile.new.parse("lane :test do slather({ proj: 'foo.xcodeproj' }) end").runner.execute(:test) expect(result).to eq("slather coverage --binary-basename bar foo.xcodeproj") ENV.delete('FL_SLATHER_BINARY_BASENAME') end it "works with binary_basename as environment array" do ENV['FL_SLATHER_BINARY_BASENAME'] = 'other,stuff' binary_basenames = ENV['FL_SLATHER_BINARY_BASENAME'].split(',') expected = "slather coverage --binary-basename #{binary_basenames[0]} --binary-basename #{binary_basenames[1]} foo.xcodeproj".gsub(/\s+/, ' ') result = Fastlane::FastFile.new.parse("lane :test do slather({ proj: 'foo.xcodeproj' }) end").runner.execute(:test) expect(result).to eq(expected) ENV.delete('FL_SLATHER_BINARY_BASENAME') end it "works with multiple ignore patterns" do pattern1 = "Pods/*" pattern2 = "../**/*/Xcode*" result = Fastlane::FastFile.new.parse("lane :test do slather({ ignore: ['#{pattern1}', '#{pattern2}'], proj: 'foo.xcodeproj' }) end").runner.execute(:test) expect(result).to eq("slather coverage --ignore #{pattern1.shellescape} --ignore #{pattern2.shellescape} foo.xcodeproj") end describe "#configuration_available?" do let(:param) { { use_bundle_exec: false } } let(:version) { '' } before do allow(action).to receive(:slather_version).and_return(Gem::Version.create(version)) end context "when slather version is 2.4.0" do let(:version) { '2.4.0' } it "configuration option is not available" do expect(action.configuration_available?).to be_falsey end end context "when slather version is 2.4.1" do let(:version) { '2.4.1' } it "configuration option is available" do expect(action.configuration_available?).to be_truthy end end context "when slather version is 2.4.2" do let(:version) { '2.4.2' } it "configuration option is available" do expect(action.configuration_available?).to be_truthy end end end describe "#ymlfile_available?" do let(:param) { { use_bundle_exec: false } } let(:version) { '' } before do allow(action).to receive(:slather_version).and_return(Gem::Version.create(version)) end context "when slather version is 2.7.0" do let(:version) { '2.7.0' } it "ymlfile option is not available" do expect(action.ymlfile_available?).to be_falsey end end context "when slather version is 2.8.0" do let(:version) { '2.8.0' } it "ymlfile option is available" do expect(action.ymlfile_available?).to be_truthy end end context "when slather version is 2.8.1" do let(:version) { '2.8.1' } it "ymlfile option is available" do expect(action.ymlfile_available?).to be_truthy end end end describe "#validate_params!" do let(:version) { '' } before do allow(action).to receive(:slather_version).and_return(Gem::Version.create(version)) end describe "with configuration param" do let(:param) { { configuration: 'Debug', proj: 'test.xcodeproj' } } context "when slather version is 2.4.0" do let(:version) { '2.4.0' } it "does not pass the validation" do expect do action.validate_params!(param) end.to raise_error(FastlaneCore::Interface::FastlaneError, 'configuration option is available since version 2.4.1') end end context "when slather version is 2.4.1" do let(:version) { '2.4.1' } it "pass the validation" do expect(action.validate_params!(param)).to be_truthy end end end describe "with ymlfile param" do let(:param) { { ymlfile: 'foo.yml', proj: 'test.xcodeproj' } } context "when slather version is 2.7.0" do let(:version) { '2.7.0' } it "does not pass the validation" do expect do action.validate_params!(param) end.to raise_error(FastlaneCore::Interface::FastlaneError, 'ymlfile option is available since version 2.8.0') end end context "when slather version is 2.8.0" do let(:version) { '2.8.0' } it "pass the validation" do expect(action.validate_params!(param)).to be_truthy end end end end after(:each) do File.delete('./.slather.yml') if File.exist?("./.slather.yml") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/git_branch_spec.rb
fastlane/spec/actions_specs/git_branch_spec.rb
describe Fastlane::Actions::GitBranchAction do describe "CI set ENV values" do Fastlane::Actions::SharedValues::GIT_BRANCH_ENV_VARS.each do |env_var| it "can control the output of the action with #{env_var}" do FastlaneSpec::Env.with_env_values(env_var => "#{env_var}-branch-name") do result = Fastlane::FastFile.new.parse("lane :test do git_branch end").runner.execute(:test) expect(result).to eq("#{env_var}-branch-name") end end end end describe "CI set ENV values but FL_GIT_BRANCH_DONT_USE_ENV_VARS is true" do Fastlane::Actions::SharedValues::GIT_BRANCH_ENV_VARS.each do |env_var| it "gets the value from Git directly with #{env_var}" do expect(Fastlane::Actions).to receive(:sh) .with("git rev-parse --abbrev-ref HEAD", log: false) .and_return("branch-name-from-git") FastlaneSpec::Env.with_env_values(env_var => "#{env_var}-branch-name", 'FL_GIT_BRANCH_DONT_USE_ENV_VARS' => 'true') do result = Fastlane::FastFile.new.parse("lane :test do git_branch end").runner.execute(:test) expect(result).to eq("branch-name-from-git") end end end end describe "with no CI set ENV values" do it "gets the value from Git directly" do expect(Fastlane::Actions).to receive(:sh) .with("git rev-parse --abbrev-ref HEAD", log: false) .and_return("branch-name") result = Fastlane::FastFile.new.parse("lane :test do git_branch end").runner.execute(:test) expect(result).to eq("branch-name") end it "returns empty string if git is at HEAD" do expect(Fastlane::Actions).to receive(:sh) .with("git rev-parse --abbrev-ref HEAD", log: false) .and_return("HEAD") result = Fastlane::FastFile.new.parse("lane :test do git_branch end").runner.execute(:test) expect(result).to eq("") end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/default_platform_spec.rb
fastlane/spec/actions_specs/default_platform_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Default Platform Action" do it "stores the default platform and converts to a symbol" do Fastlane::Actions::DefaultPlatformAction.run(['ios']) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DEFAULT_PLATFORM]).to eq(:ios) end it "raises an error if no platform is given" do expect do Fastlane::Actions::DefaultPlatformAction.run([]) end.to raise_error("You forgot to pass the default platform") end it "works as expected inside a Fastfile" do Fastlane::FastFile.new.parse("lane :test do default_platform :ios end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::DEFAULT_PLATFORM]).to eq(:ios) end end describe "Extra platforms" do around(:each) do |example| Fastlane::SupportedPlatforms.extra = [] example.run Fastlane::SupportedPlatforms.extra = [] end it "displays a warning if a platform is not supported" do expect(FastlaneCore::UI).to receive(:important).with("Platform 'notSupportedOS' is not officially supported. Currently supported platforms are [:ios, :mac, :android].") Fastlane::Actions::DefaultPlatformAction.run(['notSupportedOS']) end it "doesn't display a warning at every run if a platform has been added to extra" do Fastlane::SupportedPlatforms.extra = [:notSupportedOS] expect(FastlaneCore::UI).not_to(receive(:important)) Fastlane::Actions::DefaultPlatformAction.run(['notSupportedOS']) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/trainer_spec.rb
fastlane/spec/actions_specs/trainer_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Trainer Integration" do context ":fail_build" do it "does not raise an error if tests fail and fail_build is false", requires_xcode: true do expect do Fastlane::FastFile.new.parse("lane :parse_test_result do trainer( path: '../trainer/spec/fixtures/Test.test_result.xcresult', output_directory: '/tmp/trainer_results', fail_build: false ) end").runner.execute(:parse_test_result) end.not_to(raise_error) end it "raises an error if tests fail and fail_build is true", requires_xcode: true do failing_xcresult_path = "../trainer/spec/fixtures/Test.test_result.xcresult" expect do Fastlane::FastFile.new.parse("lane :parse_test_result do trainer( path: '../trainer/spec/fixtures/Test.test_result.xcresult', output_directory: '/tmp/trainer_results', fail_build: true ) end").runner.execute(:parse_test_result) end.to raise_error(FastlaneCore::Interface::FastlaneTestFailure) end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/bundle_install_spec.rb
fastlane/spec/actions_specs/bundle_install_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "bundle install action" do it "default use case" do expect(Fastlane::Actions::BundleInstallAction).to receive(:gemfile_exists?).and_return(true) result = Fastlane::FastFile.new.parse("lane :test do bundle_install end").runner.execute(:test) expect(result).to eq("bundle install") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/appaloosa_spec.rb
fastlane/spec/actions_specs/appaloosa_spec.rb
describe Fastlane do describe Fastlane::FastFile do APPALOOSA_SERVER = Fastlane::Actions::AppaloosaAction::APPALOOSA_SERVER describe 'Appaloosa Integration' do before :each do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) end let(:appaloosa_lane) do "lane :test do appaloosa( { binary: './fastlane/spec/fixtures/fastfiles/Fastfile1', api_token: 'xxx', store_id: '556', screenshots: '' } ) end" end context 'without ipa or apk' do let(:appaloosa_lane) { "lane :test do appaloosa({ api_token: 'xxx', store_id: 'xxx' }) end" } it 'raises a Fastlane error' do expect { Fastlane::FastFile.new.parse(appaloosa_lane).runner.execute(:test) }.to( raise_error(FastlaneCore::Interface::FastlaneError) do |error| expect(error.message).to match(/Couldn't find ipa/) end ) end end context 'without api_token' do let(:appaloosa_lane) do "lane :test do appaloosa( { store_id: 'xxx', binary: './fastlane/spec/fixtures/fastfiles/Fastfile1' } ) end" end it 'raises a Fastlane error for missing api_token' do expect { Fastlane::FastFile.new.parse(appaloosa_lane).runner.execute(:test) }.to( raise_error(FastlaneCore::Interface::FastlaneError) do |error| expect(error.message).to match(/No value found for 'api_token'/) end ) end end context 'without store_id' do let(:appaloosa_lane) do "lane :test do appaloosa( { api_token: 'xxx', binary: './fastlane/spec/fixtures/fastfiles/Fastfile1' } ) end" end it 'raises a Fastlane error for missing store_id' do expect { Fastlane::FastFile.new.parse(appaloosa_lane).runner.execute(:test) }.to( raise_error(FastlaneCore::Interface::FastlaneError) do |error| expect(error.message).to match("No value found for 'store_id'") end ) end end context 'when upload_service returns an error' do before do stub_request(:get, "#{APPALOOSA_SERVER}/upload_services/presign_form?api_key=xxx&file=Fastfile1&group_ids=&store_id=556"). to_return(status: 200, body: '{ "errors": "A group id is incorrect" }', headers: {}) end it 'returns group_id errors' do expect { Fastlane::FastFile.new.parse(appaloosa_lane).runner.execute(:test) }.to( raise_error(FastlaneCore::Interface::FastlaneError) do |error| expect(error.message).to match('ERROR: A group id is incorrect') end ) end end context 'when get_s3_url return a 404' do let(:presign_s3_key) { Base64.encode64('https://appaloosa.com/test') } let(:presign_payload) { { s3_sign: presign_s3_key, path: 'https://appaloosa.com/file.apk' }.to_json } let(:expect_error) { 'ERROR: A problem occurred with your API token and your store id. Please try again.' } before do stub_request(:get, "#{APPALOOSA_SERVER}/upload_services/presign_form?api_key=xxx&file=Fastfile1&group_ids=&store_id=556"). to_return(status: 200, body: presign_payload) stub_request(:put, "http://appaloosa.com/test"). to_return(status: 200) stub_request(:get, "#{APPALOOSA_SERVER}/556/upload_services/url_for_download?api_key=xxx&key=https://appaloosa.com/file.apk&store_id=556"). to_return(status: 404) end it 'raises a Fastlane error for problem with API token or store id' do expect { Fastlane::FastFile.new.parse(appaloosa_lane).runner.execute(:test) }.to( raise_error(FastlaneCore::Interface::FastlaneError) do |error| expect(error.message).to eq(expect_error) end ) end end context 'when get_s3_url return a 403' do let(:presign_s3_key) { Base64.encode64('https://appaloosa.com/test') } let(:presign_payload) { { s3_sign: presign_s3_key, path: 'https://appaloosa.com/file.apk' }.to_json } let(:expect_error) { 'ERROR: A problem occurred with your API token and your store id. Please try again.' } before do stub_request(:get, "#{APPALOOSA_SERVER}/upload_services/presign_form?api_key=xxx&file=Fastfile1&group_ids=&store_id=556"). to_return(status: 200, body: presign_payload) stub_request(:put, "http://appaloosa.com/test"). to_return(status: 200) stub_request(:get, "#{APPALOOSA_SERVER}/556/upload_services/url_for_download?api_key=xxx&key=https://appaloosa.com/file.apk&store_id=556"). to_return(status: 403) end it 'raises a Fastlane error for problem with API token or store id' do expect { Fastlane::FastFile.new.parse(appaloosa_lane).runner.execute(:test) }.to( raise_error(FastlaneCore::Interface::FastlaneError) do |error| expect(error.message).to eq(expect_error) end ) end end context 'with valid parameters' do let(:presign_s3_key) { Base64.encode64('https://appaloosa.com/test') } let(:presign_payload) { { s3_sign: presign_s3_key, path: 'https://appaloosa.com/file.apk' }.to_json } let(:upload_services_payload) do { store_id: '673', api_key: '80d982459eac288245c9', key: 'https://appaloosa.com/fastlane/mqkaoev2/iphone6-screenshot2.png' }.to_json end before do stub_request(:get, "#{APPALOOSA_SERVER}/upload_services/presign_form?api_key=xxx&file=Fastfile1&group_ids=&store_id=556"). to_return(status: 200, body: presign_payload, headers: {}) stub_request(:put, "http://appaloosa.com/test"). to_return(status: 200, body: '', headers: {}) stub_request(:get, "#{APPALOOSA_SERVER}/556/upload_services/url_for_download?api_key=xxx&key=https://appaloosa.com/file.apk&store_id=556"). to_return(status: 200, body: upload_services_payload, headers: {}) end it 'works with valid parameters' do Fastlane::FastFile.new.parse(appaloosa_lane).runner.execute(:test) end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/create_xcframework_spec.rb
fastlane/spec/actions_specs/create_xcframework_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Create XCFramework Action" do before(:each) do allow(File).to receive(:exist?).and_call_original allow(File).to receive(:directory?).and_call_original end it "requires to either provide :frameworks, :frameworks_with_dsyms, :libraries or :libraries_with_headers_or_dsyms" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("Please provide either :frameworks, :frameworks_with_dsyms, :libraries or :libraries_with_headers_or_dsyms to be packaged into the xcframework") end context "when trying to use more than one list of artifacts" do before(:each) do allow(File).to receive(:exist?).with('FrameworkA.framework').and_return(true) allow(File).to receive(:directory?).with('FrameworkA.framework').and_return(true) allow(File).to receive(:exist?).with('LibraryA.so').and_return(true) allow(File).to receive(:directory?).with('libraryA.so.dSYM').and_return(true) end it "forbids to provide both :frameworks and :frameworks_with_dsyms" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks: ['FrameworkA.framework'], frameworks_with_dsyms: { 'FrameworkA.framework' => { dysm: 'FrameworkA.framework.dSYM' } }, output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("Unresolved conflict between options: 'frameworks' and 'frameworks_with_dsyms'") end it "forbids to provide both :frameworks and :libraries" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks: ['FrameworkA.framework'], libraries: ['LibraryA.so'], output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("Unresolved conflict between options: 'frameworks' and 'libraries'") end it "forbids to provide both :frameworks and :libraries_with_headers_or_dsyms" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks: ['FrameworkA.framework'], libraries_with_headers_or_dsyms: { 'LibraryA.so' => { dsyms: 'libraryA.so.dSYM' } }, output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("Unresolved conflict between options: 'frameworks' and 'libraries_with_headers_or_dsyms'") end it "forbids to provide both :frameworks_with_dsyms and :libraries" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks_with_dsyms: { 'FrameworkA.framework' => { dysm: 'FrameworkA.framework.dSYM' } }, libraries: ['LibraryA.so'], output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("Unresolved conflict between options: 'frameworks_with_dsyms' and 'libraries'") end it "forbids to provide both :frameworks_with_dsyms and :libraries_with_headers_or_dsyms" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks_with_dsyms: { 'FrameworkA.framework' => { dysm: 'FrameworkA.framework.dSYM' } }, libraries_with_headers_or_dsyms: { 'LibraryA.so' => { dsyms: 'libraryA.so.dSYM' } }, output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("Unresolved conflict between options: 'frameworks_with_dsyms' and 'libraries_with_headers_or_dsyms'") end it "forbids to provide both :libraries and :libraries_with_headers_or_dsyms" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( libraries: ['LibraryA.so'], libraries_with_headers_or_dsyms: { 'LibraryA.so' => { dsyms: 'libraryA.so.dSYM' } }, output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("Unresolved conflict between options: 'libraries' and 'libraries_with_headers_or_dsyms'") end end context "when packaging frameworks" do context "which exist" do before(:each) do allow(File).to receive(:exist?).with('FrameworkA.framework').and_return(true) allow(File).to receive(:exist?).with('FrameworkB.framework').and_return(true) end context "and are directories" do before(:each) do allow(File).to receive(:directory?).with('FrameworkA.framework').and_return(true) allow(File).to receive(:directory?).with('FrameworkB.framework').and_return(true) end context "provided as an Array (without dSYMs)" do it "should work properly for public frameworks" do result = Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks: ['FrameworkA.framework', 'FrameworkB.framework'], output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) expect(result).to eq('xcodebuild -create-xcframework ' \ + '-framework "FrameworkA.framework" -framework "FrameworkB.framework" ' \ + '-output "UniversalFramework.xcframework"') end it "should work properly for internal frameworks" do result = Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks: ['FrameworkA.framework', 'FrameworkB.framework'], output: 'UniversalFramework.xcframework', allow_internal_distribution: true ) end").runner.execute(:test) expect(result).to eq('xcodebuild -create-xcframework ' \ + '-framework "FrameworkA.framework" -framework "FrameworkB.framework" ' \ + '-output "UniversalFramework.xcframework" ' \ + '-allow-internal-distribution') end end context "provided as a Hash (with dSYMs)" do context "which dSYM is a directory" do before(:each) do allow(File).to receive(:directory?).with('FrameworkB.framework.dSYM').and_return(true) end it "should work properly for public frameworks" do result = Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks_with_dsyms: {'FrameworkA.framework' => {}, 'FrameworkB.framework' => { dsyms: 'FrameworkB.framework.dSYM' } }, output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) expect(result).to eq('xcodebuild -create-xcframework ' \ + '-framework "FrameworkA.framework" -framework "FrameworkB.framework" -debug-symbols "FrameworkB.framework.dSYM" ' \ + '-output "UniversalFramework.xcframework"') end it "should work properly for internal frameworks" do result = Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks_with_dsyms: {'FrameworkA.framework' => {}, 'FrameworkB.framework' => { dsyms: 'FrameworkB.framework.dSYM' } }, output: 'UniversalFramework.xcframework', allow_internal_distribution: true ) end").runner.execute(:test) expect(result).to eq('xcodebuild -create-xcframework ' \ + '-framework "FrameworkA.framework" -framework "FrameworkB.framework" -debug-symbols "FrameworkB.framework.dSYM" ' \ + '-output "UniversalFramework.xcframework" ' \ + '-allow-internal-distribution') end end context "which dSYM is not a directory" do it "should fail due to wrong dSYM directory" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks_with_dsyms: {'FrameworkA.framework' => {}, 'FrameworkB.framework' => { dsyms: 'FrameworkB.framework.dSYM' } }, output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("FrameworkB.framework.dSYM doesn't seem to be a dSYM archive") end end end end context "and are not directories" do it "should fail due to wrong framework when provided as an Array" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks: ['FrameworkA.framework', 'FrameworkB.framework'], output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("FrameworkA.framework doesn't seem to be a framework") end it "should fail due to wrong framework when provided as a Hash" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks_with_dsyms: {'FrameworkA.framework' => {}, 'FrameworkB.framework' => { dsyms: 'FrameworkB.framework.dSYM' } }, output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("FrameworkA.framework doesn't seem to be a framework") end end end context "which don't exist" do it "should fail due to missing framework" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks: ['FrameworkA.framework', 'FrameworkB.framework'], output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("Couldn't find framework at FrameworkA.framework") end end end context "when rewriting existing xcframework" do before(:each) do allow(File).to receive(:exist?).with('FrameworkA.framework').and_return(true) allow(File).to receive(:exist?).with('FrameworkB.framework').and_return(true) allow(File).to receive(:directory?).with('FrameworkA.framework').and_return(true) allow(File).to receive(:directory?).with('FrameworkB.framework').and_return(true) allow(File).to receive(:directory?).with('UniversalFramework.xcframework').and_return(true) end it "should delete the existing xcframework" do expect(FileUtils).to receive(:remove_dir).with('UniversalFramework.xcframework') Fastlane::FastFile.new.parse("lane :test do create_xcframework( frameworks: ['FrameworkA.framework', 'FrameworkB.framework'], output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end end context "when packaging libraries" do context "which exist" do before(:each) do allow(File).to receive(:exist?).with('LibraryA.so').and_return(true) allow(File).to receive(:exist?).with('LibraryB.so').and_return(true) end context "provided as an Array (without headers or dSYMs)" do it "should work properly for public frameworks" do result = Fastlane::FastFile.new.parse("lane :test do create_xcframework( libraries: ['LibraryA.so', 'LibraryB.so'], output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) expect(result).to eq('xcodebuild -create-xcframework ' \ + '-library "LibraryA.so" -library "LibraryB.so" ' \ + '-output "UniversalFramework.xcframework"') end it "should work properly for internal frameworks" do result = Fastlane::FastFile.new.parse("lane :test do create_xcframework( libraries: ['LibraryA.so', 'LibraryB.so'], output: 'UniversalFramework.xcframework', allow_internal_distribution: true ) end").runner.execute(:test) expect(result).to eq('xcodebuild -create-xcframework ' \ + '-library "LibraryA.so" -library "LibraryB.so" ' \ + '-output "UniversalFramework.xcframework" ' \ + '-allow-internal-distribution') end end context "provided as a Hash (with headers or dSYMs)" do context "which headers and dSYMs are a directory" do before(:each) do allow(File).to receive(:directory?).with('libraryA.so.dSYM').and_return(true) allow(File).to receive(:directory?).with('headers').and_return(true) end it "should work properly for public frameworks" do result = Fastlane::FastFile.new.parse("lane :test do create_xcframework( libraries_with_headers_or_dsyms: { 'LibraryA.so' => { dsyms: 'libraryA.so.dSYM' }, 'LibraryB.so' => { headers: 'headers' } }, output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) expect(result).to eq('xcodebuild -create-xcframework ' \ + '-library "LibraryA.so" -debug-symbols "libraryA.so.dSYM" -library "LibraryB.so" -headers "headers" ' \ + '-output "UniversalFramework.xcframework"') end it "should work properly for internal frameworks" do result = Fastlane::FastFile.new.parse("lane :test do create_xcframework( libraries_with_headers_or_dsyms: { 'LibraryA.so' => { dsyms: 'libraryA.so.dSYM' }, 'LibraryB.so' => { headers: 'headers' } }, output: 'UniversalFramework.xcframework', allow_internal_distribution: true ) end").runner.execute(:test) expect(result).to eq('xcodebuild -create-xcframework ' \ + '-library "LibraryA.so" -debug-symbols "libraryA.so.dSYM" -library "LibraryB.so" -headers "headers" ' \ + '-output "UniversalFramework.xcframework" ' \ + '-allow-internal-distribution') end end context "which headers is not a directory" do before(:each) do allow(File).to receive(:directory?).with('libraryA.so.dSYM').and_return(true) end it "should fail due to wrong headers directory" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( libraries_with_headers_or_dsyms: { 'LibraryA.so' => { dsyms: 'libraryA.so.dSYM' }, 'LibraryB.so' => { headers: 'headers' } }, output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("headers doesn't exist or is not a directory") end end context "which dSYMs is not a directory" do before(:each) do allow(File).to receive(:directory?).with('headers').and_return(true) end it "should fail due to wrong dSYM directory" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( libraries_with_headers_or_dsyms: { 'LibraryA.so' => { dsyms: 'libraryA.so.dSYM' }, 'LibraryB.so' => { headers: 'headers' } }, output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("libraryA.so.dSYM doesn't seem to be a dSYM archive") end end end end context "which don't exist" do it "should fail due to missing library" do expect do Fastlane::FastFile.new.parse("lane :test do create_xcframework( libraries: ['LibraryA.so', 'LibraryB.so'], output: 'UniversalFramework.xcframework' ) end").runner.execute(:test) end.to raise_error("Couldn't find library at LibraryA.so") end end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/update_fastlane_spec.rb
fastlane/spec/actions_specs/update_fastlane_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "update_fastlane" do let(:mock_updater) { double("mock_updater") } let(:mock_cleanup) { double("mock_cleanup") } let(:mock_instance) do { update: mock_updater, cleanup: mock_cleanup } end it "when no update needed" do expect(Gem::CommandManager).to receive(:instance).and_return(mock_instance).twice expect(UI).to receive(:success).with("Driving the lane 'test' 🚀") expect(UI).to receive(:message).with("Looking for updates for fastlane...") expect(UI).to receive(:success).with("Nothing to update ✅") expect(mock_updater).to receive(:highest_installed_gems).and_return({}) expect(mock_updater).to receive(:which_to_update).and_return({}) result = Fastlane::FastFile.new.parse("lane :test do update_fastlane end").runner.execute(:test) end it "when update with RubyGems" do expect(Gem::CommandManager).to receive(:instance).and_return(mock_instance).twice # Manifest expect(FastlaneCore::FastlaneFolder).to receive(:swift?).and_return(true) expect(UI).to receive(:success).with(%r{fastlane\/swift\/upgrade_manifest.json}) # Start expect(UI).to receive(:success).with("Driving the lane 'test' 🚀") expect(UI).to receive(:message).with("Looking for updates for fastlane...") # Find outdated version expect(mock_updater).to receive(:highest_installed_gems).and_return({ "fastlane" => Gem::Specification.new do |s| s.name = 'fastlane' s.version = '2.143.0' end }) expect(mock_updater).to receive(:which_to_update).and_return([["fastlane", "2.143.0"]]) # Fetch latest version and update expect(FastlaneCore::UpdateChecker).to receive(:fetch_latest).and_return("2.165.0") expect(UI).to receive(:message).with(/Updating fastlane from/) expect(mock_updater).to receive(:update_gem) expect(UI).to receive(:success).with("Finished updating fastlane") # Clean expect(UI).to receive(:message).with("Cleaning up old versions...") expect(mock_cleanup).to receive(:options).and_return({}) expect(mock_cleanup).to receive(:execute) # Restart process expect(UI).to receive(:message).with("fastlane.tools successfully updated! I will now restart myself... 😴") expect(Fastlane::Actions::UpdateFastlaneAction).to receive(:exec) result = Fastlane::FastFile.new.parse("lane :test do update_fastlane end").runner.execute(:test) end it "when update with Homebrew" do expect(Fastlane::Helper).to receive(:homebrew?).and_return(true).twice expect(Gem::CommandManager).to receive(:instance).and_return(mock_instance).twice # Manifest expect(FastlaneCore::FastlaneFolder).to receive(:swift?).and_return(true) expect(UI).to receive(:success).with(%r{fastlane\/swift\/upgrade_manifest.json}) # Start expect(UI).to receive(:success).with("Driving the lane 'test' 🚀") expect(UI).to receive(:message).with("Looking for updates for fastlane...") # Find outdated version expect(mock_updater).to receive(:highest_installed_gems).and_return({ "fastlane" => Gem::Specification.new do |s| s.name = 'fastlane' s.version = '2.143.0' end }) expect(mock_updater).to receive(:which_to_update).and_return([["fastlane", "2.143.0"]]) # Fetch latest version and update expect(FastlaneCore::UpdateChecker).to receive(:fetch_latest).and_return("2.165.0") expect(UI).to receive(:message).with(/Updating fastlane from/) expect(Fastlane::Helper).to receive(:backticks).with("brew upgrade fastlane") expect(UI).to receive(:success).with("Finished updating fastlane") # Restart process expect(UI).to receive(:message).with("fastlane.tools successfully updated! I will now restart myself... 😴") expect(Fastlane::Actions::UpdateFastlaneAction).to receive(:exec) result = Fastlane::FastFile.new.parse("lane :test do update_fastlane end").runner.execute(:test) end describe "#get_gem_name" do it "with RubyGems < 3.1" do require 'rubygems' tool_info = ["fastlane", Gem::Version.new("1.2.3")] name = Fastlane::Actions::UpdateFastlaneAction.get_gem_name(tool_info) expect(name).to eq("fastlane") end it "with RubyGems >= 3.1" do tool_info = OpenStruct.new tool_info.name = "fastlane" tool_info.version = "1.2.3" name = Fastlane::Actions::UpdateFastlaneAction.get_gem_name(tool_info) expect(name).to eq("fastlane") end it "with unsupported RubyGems" do expect do tool_info = OpenStruct.new Fastlane::Actions::UpdateFastlaneAction.get_gem_name(tool_info) end.to raise_error(FastlaneCore::Interface::FastlaneCrash, /Unknown gem update information returned from RubyGems. Please file a new issue for this/) end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/pod_lib_lint_spec.rb
fastlane/spec/actions_specs/pod_lib_lint_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Pod Lib Lint action" do before :each do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) end it "generates the correct pod lib lint command with no parameters" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint") end it "generates the correct pod lib lint command with a verbose parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(verbose: true) end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --verbose") end it "generates the correct pod lib lint command with allow warnings parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(allow_warnings: true) end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --allow-warnings") end it "generates the correct pod lib lint command with quick parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(quick: true) end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --quick") end it "generates the correct pod lib lint command with private parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(private: true) end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --private") end it "generates the correct pod lib lint command with fail-fast parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(fail_fast: true) end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --fail-fast") end it "generates the correct pod lib lint command with use-libraries parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(use_libraries: true) end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --use-libraries") end it "generates the correct pod lib lint command with swift-version parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(swift_version: '4.2') end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --swift-version=4.2") end it "generates the correct pod lib lint command with podspec parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(podspec: 'fastlane') end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint fastlane") end it "generates the correct pod lib lint command with subspec parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(subspec: 'test-subspec') end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --subspec='test-subspec'") end it "generates the correct pod lib lint command with use_modular_headers parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(use_modular_headers: true) end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --use-modular-headers") end it "generates the correct pod lib lint command with include_podspecs parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(include_podspecs: '**/*.podspec') end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --include-podspecs='**/*.podspec'") end it "generates the correct pod lib lint command with external_podspecs parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(external_podspecs: '**/*.podspec') end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --external-podspecs='**/*.podspec'") end it "generates the correct pod lib lint command with no_clean parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(no_clean: true) end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --no-clean") end it "generates the correct pod lib lint command with no_subspecs parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(no_subspecs: true) end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --no-subspecs") end it "generates the correct pod lib lint command with platforms parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(platforms: 'ios,macos') end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --platforms=ios,macos") end it "generates the correct pod lib lint command with skip_import_validation parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(skip_import_validation: true) end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --skip-import-validation") end it "generates the correct pod lib lint command with skip_tests parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(skip_tests: true) end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --skip-tests") end it "generates the correct pod lib lint command with analyze parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_lib_lint(analyze: true) end").runner.execute(:test) expect(result).to eq("bundle exec pod lib lint --analyze") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/nexus_upload_spec.rb
fastlane/spec/actions_specs/nexus_upload_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Nexus Upload integration" do it "sets verbosity correctly" do expect(Fastlane::Actions::NexusUploadAction.verbose(verbose: true)).to eq("--verbose") expect(Fastlane::Actions::NexusUploadAction.verbose(verbose: false)).to eq("--silent") end it "sets upload url correctly for Nexus 2" do expect(Fastlane::Actions::NexusUploadAction.upload_url(endpoint: "http://localhost:8081", mount_path: "/nexus", nexus_version: 2)).to eq("http://localhost:8081/nexus/service/local/artifact/maven/content") expect(Fastlane::Actions::NexusUploadAction.upload_url(endpoint: "http://localhost:8081", mount_path: "/custom-nexus", nexus_version: 2)).to eq("http://localhost:8081/custom-nexus/service/local/artifact/maven/content") expect(Fastlane::Actions::NexusUploadAction.upload_url(endpoint: "http://localhost:8081", mount_path: "", nexus_version: 2)).to eq("http://localhost:8081/service/local/artifact/maven/content") end it "sets upload url correctly for Nexus 3 with all required parameters" do tmp_path = Dir.mktmpdir file_path = "#{tmp_path}/file.ipa" FileUtils.touch(file_path) expect(Fastlane::Actions::NexusUploadAction.upload_url( endpoint: 'http://localhost:8081', mount_path: '/nexus', nexus_version: 3, repo_id: 'artefacts', repo_group_id: 'com.fastlane', repo_project_name: 'myproject', repo_project_version: '1.12', file: file_path.to_s )).to eq("http://localhost:8081/nexus/repository/artefacts/com/fastlane/myproject/1.12/myproject-1.12.ipa") end it "sets upload url correctly for Nexus 3 with repo classifier" do tmp_path = Dir.mktmpdir file_path = "#{tmp_path}/file.ipa" FileUtils.touch(file_path) expect(Fastlane::Actions::NexusUploadAction.upload_url( endpoint: 'http://localhost:8081', mount_path: '/nexus', nexus_version: 3, repo_id: 'artefacts', repo_group_id: 'com.fastlane', repo_project_name: 'myproject', repo_project_version: '1.12', file: file_path.to_s, repo_classifier: 'ipa' )).to eq("http://localhost:8081/nexus/repository/artefacts/com/fastlane/myproject/1.12/myproject-1.12-ipa.ipa") end it "sets upload options correctly for Nexus 2 with all required parameters" do tmp_path = Dir.mktmpdir file_path = "#{tmp_path}/file.ipa" FileUtils.touch(file_path) result = Fastlane::Actions::NexusUploadAction.upload_options( nexus_version: 2, repo_id: 'artefacts', repo_group_id: 'com.fastlane', repo_project_name: 'myproject', repo_project_version: '1.12', file: file_path.to_s, username: 'admin', password: 'admin123' ) expect(result).to include('-F p=zip') expect(result).to include('-F hasPom=false') expect(result).to include('-F r=artefacts') expect(result).to include('-F g=com.fastlane') expect(result).to include('-F a=myproject') expect(result).to include('-F v=1.12') expect(result).to include('-F e=ipa') expect(result).to include("-F file=@#{file_path}") expect(result).to include('-u admin:admin123') end it "sets upload options correctly for Nexus 2 with repo classifier" do tmp_path = Dir.mktmpdir file_path = "#{tmp_path}/file.ipa" FileUtils.touch(file_path) result = Fastlane::Actions::NexusUploadAction.upload_options( nexus_version: 2, repo_id: 'artefacts', repo_group_id: 'com.fastlane', repo_project_name: 'myproject', repo_project_version: '1.12', file: file_path.to_s, username: 'admin', password: 'admin123', repo_classifier: 'dSYM' ) expect(result).to include('-F p=zip') expect(result).to include('-F hasPom=false') expect(result).to include('-F r=artefacts') expect(result).to include('-F g=com.fastlane') expect(result).to include('-F a=myproject') expect(result).to include('-F v=1.12') expect(result).to include('-F c=dSYM') expect(result).to include('-F e=ipa') expect(result).to include("-F file=@#{file_path}") expect(result).to include('-u admin:admin123') end it "sets upload options correctly for Nexus 3 with all required parameters" do tmp_path = Dir.mktmpdir file_path = "#{tmp_path}/file.ipa" FileUtils.touch(file_path) result = Fastlane::Actions::NexusUploadAction.upload_options( nexus_version: 3, file: file_path.to_s, username: 'admin', password: 'admin123' ) expect(result).to include("--upload-file #{file_path}") expect(result).to include('-u admin:admin123') end it "sets ssl option correctly" do expect(Fastlane::Actions::NexusUploadAction.ssl_options(ssl_verify: false)).to eq(["--insecure"]) expect(Fastlane::Actions::NexusUploadAction.ssl_options(ssl_verify: true)).to eq([]) end it "sets proxy options correctly" do expect(Fastlane::Actions::NexusUploadAction.proxy_options(proxy_address: "", proxy_port: nil, proxy_username: nil, proxy_password: nil)).to eq([]) expect(Fastlane::Actions::NexusUploadAction.proxy_options(proxy_address: nil, proxy_port: "", proxy_username: nil, proxy_password: nil)).to eq([]) expect(Fastlane::Actions::NexusUploadAction.proxy_options(proxy_address: nil, proxy_port: nil, proxy_username: "", proxy_password: "")).to eq([]) expect(Fastlane::Actions::NexusUploadAction.proxy_options(proxy_address: "http://1", proxy_port: "2", proxy_username: "3", proxy_password: "4")).to eq(["-x http://1:2", "--proxy-user 3:4"]) end it "raises an error if file does not exist" do file_path = File.expand_path('/tmp/xfile.ipa') expect do result = Fastlane::FastFile.new.parse("lane :test do nexus_upload(file: '/tmp/xfile.ipa', repo_id: 'artefacts', repo_group_id: 'com.fastlane', repo_project_name: 'myproject', repo_project_version: '1.12', endpoint: 'http://localhost:8081', username: 'admin', password: 'admin123', verbose: true, ssl_verify: false, proxy_address: 'http://server', proxy_port: '30', proxy_username: 'admin', proxy_password: 'admin') end").runner.execute(:test) end.to raise_exception("Couldn't find file at path '#{file_path}'") end it "uses mandatory options correctly" do tmp_path = Dir.mktmpdir file_path = "#{tmp_path}/file.ipa" FileUtils.touch(file_path) result = Fastlane::FastFile.new.parse("lane :test do nexus_upload(file: '#{file_path}', repo_id: 'artefacts', repo_group_id: 'com.fastlane', repo_project_name: 'myproject', repo_project_version: '1.12', endpoint: 'http://localhost:8081', username: 'admin', password: 'admin123', verbose: true, ssl_verify: false, proxy_address: 'http://server', proxy_port: '30', proxy_username: 'admin', proxy_password: 'admin') end").runner.execute(:test) expect(result).to include('-F p=zip') expect(result).to include('-F hasPom=false') expect(result).to include('-F r=artefacts') expect(result).to include('-F g=com.fastlane') expect(result).to include('-F a=myproject') expect(result).to include('-F v=1.12') expect(result).to include('-F e=ipa') expect(result).to include("-F file=@#{tmp_path}") expect(result).to include('-u admin:admin123') expect(result).to include('--verbose') expect(result).to include('http://localhost:8081/nexus/service/local/artifact/maven/content') expect(result).to include('-x http://server:30') expect(result).to include('--proxy-user admin:admin') expect(result).to include('--insecure') end it "uses optional options correctly" do tmp_path = Dir.mktmpdir file_path = "#{tmp_path}/file.ipa" FileUtils.touch(file_path) result = Fastlane::FastFile.new.parse("lane :test do nexus_upload(file: '#{file_path}', repo_id: 'artefacts', repo_group_id: 'com.fastlane', repo_project_name: 'myproject', repo_project_version: '1.12', repo_classifier: 'dSYM', endpoint: 'http://localhost:8081', mount_path: '/my-nexus', username: 'admin', password: 'admin123', verbose: true) end").runner.execute(:test) expect(result).to include('-F p=zip') expect(result).to include('-F hasPom=false') expect(result).to include('-F r=artefacts') expect(result).to include('-F g=com.fastlane') expect(result).to include('-F a=myproject') expect(result).to include('-F v=1.12') expect(result).to include('-F c=dSYM') expect(result).to include('-F e=ipa') expect(result).to include("-F file=@#{file_path}") expect(result).to include('-u admin:admin123') expect(result).to include('--verbose') expect(result).to include('http://localhost:8081/my-nexus/service/local/artifact/maven/content') expect(result).not_to(include('-x ')) expect(result).not_to(include('--proxy-user')) end it "runs the correct command for Nexus 3" do tmp_path = Dir.mktmpdir file_path = "#{tmp_path}/file.ipa" FileUtils.touch(file_path) result = Fastlane::FastFile.new.parse("lane :test do nexus_upload(file: '#{file_path}', nexus_version: 3, repo_id: 'artefacts', repo_group_id: 'com.fastlane', repo_project_name: 'myproject', repo_project_version: '1.12', endpoint: 'http://localhost:8081', username: 'admin', password: 'admin123', verbose: true, ssl_verify: false, proxy_address: 'http://server', proxy_port: '30', proxy_username: 'admin', proxy_password: 'admin') end").runner.execute(:test) expect(result).to include("--upload-file #{tmp_path}") expect(result).to include('-u admin:admin123') expect(result).to include('--verbose') expect(result).to include('http://localhost:8081/nexus/repository/artefacts/com/fastlane/myproject/1.12/myproject-1.12.ipa') expect(result).to include('-x http://server:30') expect(result).to include('--proxy-user admin:admin') expect(result).to include('--insecure') end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/xcode_server_get_assets_spec.rb
fastlane/spec/actions_specs/xcode_server_get_assets_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "xcode_server_get_assets" do it "fails if server is unavailable" do stub_request(:get, "https://1.2.3.4:20343/api/bots").to_return(status: 500) begin result = Fastlane::FastFile.new.parse("lane :test do xcode_server_get_assets( host: '1.2.3.4', bot_name: '' ) end").runner.execute(:test) rescue => e expect(e.to_s).to eq("Failed to fetch Bots from Xcode Server at https://1.2.3.4, response: 500: .") else fail("Error should have been raised") end end it "fails if selected bot doesn't have any integrations" do stub_request(:get, "https://1.2.3.4:20343/api/bots"). to_return(status: 200, body: File.read("./fastlane/spec/fixtures/requests/xcode_server_bots.json")) stub_request(:get, "https://1.2.3.4:20343/api/bots/c7ccb2e699d02c74cf750a189360426d/integrations?last=10"). to_return(status: 200, body: "{\"count\":0,\"results\":[]}") begin result = Fastlane::FastFile.new.parse("lane :test do xcode_server_get_assets( host: '1.2.3.4', bot_name: 'bot-2' ) end").runner.execute(:test) rescue => e expect(e.to_s).to eq("Failed to find any completed integration for Bot \"bot-2\"") else fail("Error should have been raised") end end it "fails if integration number specified is not available" do stub_request(:get, "https://1.2.3.4:20343/api/bots"). to_return(status: 200, body: File.read("./fastlane/spec/fixtures/requests/xcode_server_bots.json")) stub_request(:get, "https://1.2.3.4:20343/api/bots/c7ccb2e699d02c74cf750a189360426d/integrations?last=10"). to_return(status: 200, body: File.read("./fastlane/spec/fixtures/requests/xcode_server_integrations.json")) begin result = Fastlane::FastFile.new.parse("lane :test do xcode_server_get_assets( host: '1.2.3.4', bot_name: 'bot-2', integration_number: 3 ) end").runner.execute(:test) rescue => e expect(e.to_s).to eq("Specified integration number 3 does not exist.") else fail("Error should have been raised") end end it "fails if assets are not available" do stub_request(:get, "https://1.2.3.4:20343/api/bots"). to_return(status: 200, body: File.read("./fastlane/spec/fixtures/requests/xcode_server_bots.json")) stub_request(:get, "https://1.2.3.4:20343/api/bots/c7ccb2e699d02c74cf750a189360426d/integrations?last=10"). to_return(status: 200, body: File.read("./fastlane/spec/fixtures/requests/xcode_server_integrations.json")) stub_request(:get, "https://1.2.3.4:20343/api/integrations/0a0fb158e7bf3d06aa87bf96eb001454/assets"). to_return(status: 500) begin result = Fastlane::FastFile.new.parse("lane :test do xcode_server_get_assets( host: '1.2.3.4', bot_name: 'bot-2' ) end").runner.execute(:test) rescue => e expect(e.to_s).to eq("Integration doesn't have any assets (it probably never ran).") else fail("Error should have been raised") end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/deliver_action_spec.rb
fastlane/spec/actions_specs/deliver_action_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Deliver Integration" do it "uses the snapshot path if given" do test_val = "test_val" Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::SNAPSHOT_SCREENSHOTS_PATH] = test_val result = Fastlane::FastFile.new.parse("lane :test do deliver end").runner.execute(:test) expect(result[:screenshots_path]).to eq(test_val) end it "uses the ipa path if given and raises an error if not available" do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::IPA_OUTPUT_PATH] = "something.ipa" expect do Fastlane::FastFile.new.parse("lane :test do deliver end").runner.execute(:test) end.to raise_error(/Could not find ipa file at path '/) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/hockey_spec.rb
fastlane/spec/actions_specs/hockey_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Hockey Integration" do before :each do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) end it "raises an error if no build file was given" do expect do Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx' }) end").runner.execute(:test) end.to raise_error("You have to provide a build file (params 'apk' or 'ipa')") end describe "iOS" do it "raises an error if given ipa file was not found" do expect do Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './notHere.ipa' }) end").runner.execute(:test) end.to raise_error("Couldn't find ipa file at path './notHere.ipa'") end end describe "Android" do it "raises an error if given apk file was not found" do expect do Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', apk: './notHere.ipa' }) end").runner.execute(:test) end.to raise_error("Couldn't find apk file at path './notHere.ipa'") end end it "raises an error if supplied dsym file was not found" do expect do Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', dsym: './notHere.dSYM.zip' }) end").runner.execute(:test) end.to raise_error("Symbols on path '#{File.expand_path('./notHere.dSYM.zip')}' not found") end it "allows to send a dsym only" do values = Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', upload_dsym_only: true, dsym: './fastlane/spec/fixtures/dSYM/Themoji.dSYM.zip' }) end").runner.execute(:test) expect(values[:notify]).to eq(1.to_s) expect(values[:status]).to eq(2.to_s) expect(values[:create_status]).to eq(2.to_s) expect(values[:notes]).to eq("No changelog given") expect(values[:release_type]).to eq(0.to_s) expect(values.key?(:tags)).to eq(false) expect(values.key?(:teams)).to eq(false) expect(values.key?(:owner_id)).to eq(false) expect(values.key?(:ipa)).to eq(false) expect(values[:mandatory]).to eq(0.to_s) expect(values[:notes_type]).to eq(1.to_s) expect(values[:upload_dsym_only]).to eq(true) expect(values[:strategy]).to eq("add") end it "raises an error if both ipa and apk provided" do expect do Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', apk: './fastlane/spec/fixtures/fastfiles/Fastfile1' }) end").runner.execute(:test) end.to raise_error("You can't use 'ipa' and 'apk' options in one run") end it "raises an error if no api token was given" do expect do Fastlane::FastFile.new.parse("lane :test do hockey({ apk: './fastlane/spec/fixtures/fastfiles/Fastfile1' }) end").runner.execute(:test) end.to raise_error("No API token for Hockey given, pass using `api_token: 'token'`") end it "works with valid parameters" do Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', apk: './fastlane/spec/fixtures/fastfiles/Fastfile1' }) end").runner.execute(:test) end it "has the correct default values" do values = Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1' }) end").runner.execute(:test) expect(values[:notify]).to eq("1") expect(values[:status]).to eq("2") expect(values[:create_status]).to eq(2.to_s) expect(values[:notes]).to eq("No changelog given") expect(values[:release_type]).to eq("0") expect(values.key?(:tags)).to eq(false) expect(values.key?(:teams)).to eq(false) expect(values.key?(:owner_id)).to eq(false) expect(values[:mandatory]).to eq("0") expect(values[:notes_type]).to eq("1") expect(values[:upload_dsym_only]).to eq(false) expect(values[:strategy]).to eq("add") end it "can use a generated changelog as release notes" do values = Fastlane::FastFile.new.parse("lane :test do # changelog_from_git_commits sets this lane context variable Actions.lane_context[SharedValues::FL_CHANGELOG] = 'autogenerated changelog' hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', }) end").runner.execute(:test) expect(values[:notes]).to eq('autogenerated changelog') end it "has the correct default notes_type value" do values = Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', }) end").runner.execute(:test) expect(values[:notes_type]).to eq("1") end it "can change the notes_type" do values = Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', notes_type: '0' }) end").runner.execute(:test) expect(values[:notes_type]).to eq("0") end it "can change the release_type" do values = Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', release_type: '1' }) end").runner.execute(:test) expect(values[:release_type]).to eq(1.to_s) end it "can change teams" do values = Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', teams: '123,123' }) end").runner.execute(:test) expect(values[:teams]).to eq('123,123') end it "can change mandatory" do values = Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', mandatory: '1' }) end").runner.execute(:test) expect(values[:mandatory]).to eq("1") end it "can change tags" do values = Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', tags: '123,123' }) end").runner.execute(:test) expect(values[:tags]).to eq('123,123') end it "can change owners" do values = Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', owner_id: '123' }) end").runner.execute(:test) expect(values[:owner_id]).to eq('123') end it "has the correct default strategy value" do values = Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', }) end").runner.execute(:test) expect(values[:strategy]).to eq("add") end it "can change the strategy" do values = Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', strategy: 'replace' }) end").runner.execute(:test) expect(values[:strategy]).to eq("replace") end it "raises an error if supplied strategy was invalid" do expect do values = Fastlane::FastFile.new.parse("lane :test do hockey({ api_token: 'xxx', ipa: './fastlane/spec/fixtures/fastfiles/Fastfile1', strategy: 'wrongvalue' }) end").runner.execute(:test) end.to raise_error("Invalid value 'wrongvalue' for key 'strategy'. Allowed values are 'add', 'replace'.") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/pod_push_spec.rb
fastlane/spec/actions_specs/pod_push_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Pod Push action" do before :each do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) end it "generates the correct pod push command with no parameters" do result = Fastlane::FastFile.new.parse("lane :test do pod_push end").runner.execute(:test) expect(result).to eq("pod trunk push") end it "generates the correct pod push command with a path parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_push(path: './fastlane/spec/fixtures/podspecs/test.podspec') end").runner.execute(:test) expect(result).to eq("pod trunk push './fastlane/spec/fixtures/podspecs/test.podspec'") end it "generates the correct pod push command with a repo parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_push(path: './fastlane/spec/fixtures/podspecs/test.podspec', repo: 'MyRepo') end").runner.execute(:test) expect(result).to eq("pod repo push MyRepo './fastlane/spec/fixtures/podspecs/test.podspec'") end it "generates the correct pod push command with a repo parameter with the swift version flag" do result = Fastlane::FastFile.new.parse("lane :test do pod_push(path: './fastlane/spec/fixtures/podspecs/test.podspec', repo: 'MyRepo', swift_version: '4.0') end").runner.execute(:test) expect(result).to eq("pod repo push MyRepo './fastlane/spec/fixtures/podspecs/test.podspec' --swift-version=4.0") end it "generates the correct pod push command with a repo parameter with the allow warnings and use libraries flags" do result = Fastlane::FastFile.new.parse("lane :test do pod_push(path: './fastlane/spec/fixtures/podspecs/test.podspec', repo: 'MyRepo', allow_warnings: true, use_libraries: true) end").runner.execute(:test) expect(result).to eq("pod repo push MyRepo './fastlane/spec/fixtures/podspecs/test.podspec' --allow-warnings --use-libraries") end it "generates the correct pod push command with a repo parameter with the skip import validation and skip tests flags" do result = Fastlane::FastFile.new.parse("lane :test do pod_push(path: './fastlane/spec/fixtures/podspecs/test.podspec', repo: 'MyRepo', skip_import_validation: true, skip_tests: true) end").runner.execute(:test) expect(result).to eq("pod repo push MyRepo './fastlane/spec/fixtures/podspecs/test.podspec' --skip-import-validation --skip-tests") end it "generates the correct pod push command with a repo parameter with the use json flag" do result = Fastlane::FastFile.new.parse("lane :test do pod_push(path: './fastlane/spec/fixtures/podspecs/test.podspec', repo: 'MyRepo', use_json: true) end").runner.execute(:test) expect(result).to eq("pod repo push MyRepo './fastlane/spec/fixtures/podspecs/test.podspec' --use-json") end it "generates the correct pod push command with a json file" do result = Fastlane::FastFile.new.parse("lane :test do pod_push(path: './fastlane/spec/fixtures/podspecs/test.podspec.json', repo: 'MyRepo') end").runner.execute(:test) expect(result).to eq("pod repo push MyRepo './fastlane/spec/fixtures/podspecs/test.podspec.json'") end it "errors if the path file does not end with .podspec or .podspec.json" do ff = Fastlane::FastFile.new.parse("lane :test do pod_push(path: './fastlane/spec/fixtures/podspecs/test.notpodspec') end") expect do ff.runner.execute(:test) end.to raise_error("File must be a `.podspec` or `.podspec.json`") end context "with use_bundle_exec flag" do context "true" do it "appends bundle exec at the beginning of the command" do result = Fastlane::FastFile.new.parse("lane :test do pod_push(use_bundle_exec: true) end").runner.execute(:test) expect(result).to eq("bundle exec pod trunk push") end end context "false" do it "does not appends bundle exec at the beginning of the command" do result = Fastlane::FastFile.new.parse("lane :test do pod_push(use_bundle_exec: false) end").runner.execute(:test) expect(result).to eq("pod trunk push") end end end it "generates the correct pod push command with the synchronous parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_push(synchronous: true) end").runner.execute(:test) expect(result).to eq("pod trunk push --synchronous") end it "generates the correct pod push command with the no overwrite parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_push(no_overwrite: true) end").runner.execute(:test) expect(result).to eq("pod trunk push --no-overwrite") end it "generates the correct pod push command with the local only parameter" do result = Fastlane::FastFile.new.parse("lane :test do pod_push(local_only: true) end").runner.execute(:test) expect(result).to eq("pod trunk push --local-only") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/commit_version_bump_action_spec.rb
fastlane/spec/actions_specs/commit_version_bump_action_spec.rb
describe Fastlane::Actions::CommitVersionBumpAction do let(:action) { Fastlane::Actions::CommitVersionBumpAction } describe 'settings_plists_from_param' do it 'returns the param in an array if a String' do settings_plists = action.settings_plists_from_param("About.plist") expect(settings_plists).to eq(["About.plist"]) end it 'returns the param if an Array' do settings_plists = action.settings_plists_from_param(["About.plist", "Root.plist"]) expect(settings_plists).to eq(["About.plist", "Root.plist"]) end it 'returns ["Root.plist"] for any other input' do settings_plists = action.settings_plists_from_param(true) expect(settings_plists).to eq(["Root.plist"]) end end describe 'settings_bundle_file_path' do it 'returns the path of a file in the settings bundle from an Xcodeproj::Project' do settings_bundle = double("file", path: "Settings.bundle", real_path: "/path/to/MyApp/Settings.bundle") xcodeproj = double("xcodeproj", files: [settings_bundle]) file_path = action.settings_bundle_file_path(xcodeproj, "Root.plist") expect(file_path).to eq("/path/to/MyApp/Settings.bundle/Root.plist") end it 'raises if no settings bundle in the project' do xcodeproj = double("xcodeproj", files: []) expect do action.settings_bundle_file_path(xcodeproj, "Root.plist") end.to raise_error(RuntimeError) end end describe 'modified_files_relative_to_repo_root' do it 'returns an empty array if modified_files is nil' do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::MODIFIED_FILES] = nil expect(action.modified_files_relative_to_repo_root("/path/to/repo/root")).to be_empty end it 'returns a list of relative paths given a list of possibly absolute paths' do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::MODIFIED_FILES] = Set.new(%w{relative/path1 /path/to/repo/root/relative/path2}) relative_paths = action.modified_files_relative_to_repo_root("/path/to/repo/root") expect(relative_paths).to eq(%w{relative/path1 relative/path2}) end it 'removes duplicates' do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::MODIFIED_FILES] = Set.new(%w{relative/path /path/to/repo/root/relative/path}) relative_paths = action.modified_files_relative_to_repo_root("/path/to/repo/root") expect(relative_paths).to eq(["relative/path"]) end end describe 'Actions::add_modified_files' do it 'adds an array of paths to the list, initializing to [] if nil' do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::MODIFIED_FILES] = nil Fastlane::Actions.add_modified_files(%w{relative/path1 /path/to/repo/root/relative/path2}) expected = Set.new(%w{relative/path1 /path/to/repo/root/relative/path2}) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::MODIFIED_FILES]).to eq(expected) end it 'ignores duplicates' do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::MODIFIED_FILES] = Set.new(["relative/path"]) Fastlane::Actions.add_modified_files(["relative/path"]) expected = Set.new(["relative/path"]) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::MODIFIED_FILES]).to eq(expected) end end describe 'build_git_command' do it 'creates a git commit with the provided message' do command = action.build_git_command(message: "my commit message") expect(command).to eq("git commit -m 'my commit message'") end it 'creates a commit message containing the build number if no message is provided' do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER] = "123" command = action.build_git_command(no_verify: false) expect(command).to eq("git commit -m 'Version Bump to 123'") end it 'creates a default commit message if no message or build number is provided' do command = action.build_git_command(no_verify: false) expect(command).to eq("git commit -m 'Version Bump'") end it 'appends the --no-verify if required' do command = action.build_git_command(message: "my commit message", no_verify: true) expect(command).to eq("git commit -m 'my commit message' --no-verify") end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/add_git_tag_spec.rb
fastlane/spec/actions_specs/add_git_tag_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Add Git Tag Integration" do require 'shellwords' build_number = 1337 before :each do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER] = build_number end context "when 'includes_lane' option is enabled" do it "appends lane_name in the tag and git message" do lane_name = "fake_lane_name" message = "builds/#{lane_name}/#{build_number} (fastlane)" tag = "builds/#{lane_name}/#{build_number}" expect(UI).to receive(:message).with("Adding git tag '#{tag.shellescape}' 🎯.") expect(Fastlane::Actions).to receive(:sh).with("git tag -am #{message.shellescape} #{tag.shellescape}") Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::LANE_NAME] = lane_name options = FastlaneCore::Configuration.create(Fastlane::Actions::AddGitTagAction.available_options, {}) Fastlane::Actions::AddGitTagAction.run(options) end it "removes spaces from lane_name before appending it in the tag and git message" do lane_name = "fake lane name with spaces" lane_name_without_spaces = "fakelanenamewithspaces" message = "builds/#{lane_name_without_spaces}/#{build_number} (fastlane)" tag = "builds/#{lane_name_without_spaces}/#{build_number}" expect(UI).to receive(:message).with("Adding git tag '#{tag.shellescape}' 🎯.") expect(Fastlane::Actions).to receive(:sh).with("git tag -am #{message.shellescape} #{tag.shellescape}") Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::LANE_NAME] = lane_name options = FastlaneCore::Configuration.create(Fastlane::Actions::AddGitTagAction.available_options, {}) Fastlane::Actions::AddGitTagAction.run(options) end end context "when 'includes_lane' option is not enabled" do it "doesn't append lane_name in the tag and git message" do lane_name = "fake_lane_name" message = "builds/#{build_number} (fastlane)" tag = "builds/#{build_number}" expect(UI).to receive(:message).with("Adding git tag '#{tag.shellescape}' 🎯.") expect(Fastlane::Actions).to receive(:sh).with("git tag -am #{message.shellescape} #{tag.shellescape}") Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::LANE_NAME] = lane_name options = FastlaneCore::Configuration.create(Fastlane::Actions::AddGitTagAction.available_options, { includes_lane: false, }) Fastlane::Actions::AddGitTagAction.run(options) end end it "generates a tag based on existing context" do result = Fastlane::FastFile.new.parse("lane :test do add_git_tag end").runner.execute(:test) message = "builds/test/1337 (fastlane)" tag = "builds/test/1337" expect(result).to eq("git tag -am #{message.shellescape} #{tag.shellescape}") end it "allows you to specify grouping and build number" do specified_build_number = 42 grouping = 'grouping' result = Fastlane::FastFile.new.parse("lane :test do add_git_tag ({ grouping: '#{grouping}', build_number: #{specified_build_number}, }) end").runner.execute(:test) message = "#{grouping}/test/#{specified_build_number} (fastlane)" tag = "#{grouping}/test/#{specified_build_number}" expect(result).to eq("git tag -am #{message.shellescape} #{tag.shellescape}") end it "allows you to not include the current lane in the tag and message" do result = Fastlane::FastFile.new.parse("lane :test do add_git_tag ({ includes_lane: false, }) end").runner.execute(:test) message = "builds/#{build_number} (fastlane)" tag = "builds/#{build_number}" expect(result).to eq("git tag -am #{message.shellescape} #{tag.shellescape}") end it "allows you to specify a prefix" do prefix = '16309-' result = Fastlane::FastFile.new.parse("lane :test do add_git_tag ({ prefix: '#{prefix}', }) end").runner.execute(:test) message = "builds/test/#{prefix}#{build_number} (fastlane)" tag = "builds/test/#{prefix}#{build_number}" expect(result).to eq("git tag -am #{message.shellescape} #{tag.shellescape}") end it "allows you to specify a postfix" do postfix = '-RC1' result = Fastlane::FastFile.new.parse("lane :test do add_git_tag ({ postfix: '#{postfix}', }) end").runner.execute(:test) message = "builds/test/#{build_number}#{postfix} (fastlane)" tag = "builds/test/#{build_number}#{postfix}" expect(result).to eq("git tag -am #{message.shellescape} #{tag.shellescape}") end it "allows you to specify your own tag" do tag = '2.0.0' result = Fastlane::FastFile.new.parse("lane :test do add_git_tag ({ tag: '#{tag}', }) end").runner.execute(:test) message = "#{tag} (fastlane)" expect(result).to eq("git tag -am #{message.shellescape} #{tag.shellescape}") end it "raises error if no tag or build_number are provided" do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER] = nil expect do Fastlane::FastFile.new.parse("lane :test do add_git_tag ({}) end").runner.execute(:test) end.to raise_error(/No value found for 'tag' or 'build_number'. At least one of them must be provided. Note that if you do specify a tag, all other arguments are ignored./) end it "specified tag overrides generate tag" do tag = '2.0.0' result = Fastlane::FastFile.new.parse("lane :test do add_git_tag ({ tag: '#{tag}', grouping: 'grouping', build_number: 'build_number', prefix: 'prefix', }) end").runner.execute(:test) message = "#{tag} (fastlane)" expect(result).to eq("git tag -am #{message.shellescape} #{tag.shellescape}") end it "allows you to specify your own message" do tag = '2.0.0' message = "message" result = Fastlane::FastFile.new.parse("lane :test do add_git_tag ({ tag: '#{tag}', message: '#{message}' }) end").runner.execute(:test) expect(result).to eq("git tag -am #{message.shellescape} #{tag.shellescape}") end it "properly shell escapes its message" do tag = '2.0.0' message = "message with 'quotes' (and parens)" result = Fastlane::FastFile.new.parse("lane :test do add_git_tag ({ tag: '#{tag}', message: \"#{message}\" }) end").runner.execute(:test) expect(result).to eq("git tag -am #{message.shellescape} #{tag.shellescape}") end it "allows you to force the tag creation" do tag = '2.0.0' message = "message" result = Fastlane::FastFile.new.parse("lane :test do add_git_tag ({ tag: '#{tag}', message: '#{message}', force: true }) end").runner.execute(:test) expect(result).to eq("git tag -am #{message.shellescape} --force #{tag.shellescape}") end it "allows you to specify the commit where to add the tag" do tag = '2.0.0' commit = 'beta_tag' message = "message" result = Fastlane::FastFile.new.parse("lane :test do add_git_tag ({ tag: '#{tag}', message: '#{message}', commit: '#{commit}' }) end").runner.execute(:test) expect(result).to eq("git tag -am #{message.shellescape} #{tag.shellescape} #{commit}") end it "allows you to sign the tag using the default e-mail address's key." do tag = '2.0.0' message = "message" result = Fastlane::FastFile.new.parse("lane :test do add_git_tag ({ tag: '#{tag}', message: '#{message}', sign: true }) end").runner.execute(:test) expect(result).to eq("git tag -am #{message.shellescape} -s #{tag.shellescape}") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/flock_spec.rb
fastlane/spec/actions_specs/flock_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Flock Action" do FLOCK_BASE_URL = Fastlane::Actions::FlockAction::BASE_URL def run_flock(**arguments) parsed_arguments = Fastlane::ConfigurationHelper.parse( Fastlane::Actions::FlockAction, arguments ) Fastlane::Actions::FlockAction.run(parsed_arguments) end context 'options' do before do ENV['FL_FLOCK_BASE_URL'] = 'https://example.com' stub_request(:any, /example\.com/) end it 'requires message' do expect { run_flock(token: 'xxx') }.to( raise_error(FastlaneCore::Interface::FastlaneError) do |error| expect(error.message).to match(/message/) end ) end it 'requires token' do expect { run_flock(message: 'xxx') }.to( raise_error(FastlaneCore::Interface::FastlaneError) do |error| expect(error.message).to match(/token/) end ) end it 'allows environment variables' do ENV['FL_FLOCK_MESSAGE'] = 'xxx' ENV['FL_FLOCK_TOKEN'] = 'xxx' expect { run_flock }.to_not(raise_error) end end it 'fails on non 200 response' do stub_request(:post, "#{FLOCK_BASE_URL}/token"). to_return(status: 400) expect { run_flock(message: 'message', token: 'token') }.to( raise_error(FastlaneCore::Interface::FastlaneError) do |error| expect(error.message).to match(/Error sending message to Flock/) end ) end it 'performs POST request with specified options' do stub_request(:post, "#{FLOCK_BASE_URL}/token"). with(body: '{"text":"message"}', headers: { 'Content-Type' => 'application/json' }). to_return(status: 200) run_flock(message: 'message', token: 'token') end it 'handles quotes in message' do message = %("that's what", she said) stub_request(:post, //). with(body: %({"text":"\\"that's what\\", she said"})) run_flock(message: message, token: 'xxx') end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/xcode_select_spec.rb
fastlane/spec/actions_specs/xcode_select_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Xcode Select Integration" do let(:invalid_path) { "/path/to/nonexistent/dir" } let(:valid_path) { "/valid/path/to/xcode" } before(:each) do allow(Dir).to receive(:exist?).with(invalid_path).and_return(false) allow(Dir).to receive(:exist?).with(valid_path).and_return(true) end after(:each) do ENV.delete("DEVELOPER_DIR") end it "throws an exception if no params are passed" do expect do Fastlane::FastFile.new.parse("lane :test do xcode_select end").runner.execute(:test) end.to raise_error("Path to Xcode application required (e.g. `xcode_select(\"/Applications/Xcode.app\")`)") end it "throws an exception if the Xcode path is not a valid directory" do expect do Fastlane::FastFile.new.parse("lane :test do xcode_select \"#{invalid_path}\" end").runner.execute(:test) end.to raise_error("Path '/path/to/nonexistent/dir' doesn't exist") end it "sets the DEVELOPER_DIR environment variable" do Fastlane::FastFile.new.parse("lane :test do xcode_select \"#{valid_path}\" end").runner.execute(:test) expect(ENV["DEVELOPER_DIR"]).to eq(valid_path + "/Contents/Developer") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/verify_build_spec.rb
fastlane/spec/actions_specs/verify_build_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "verify_build" do let(:no_such_file) { "no-such-file.ipa" } let(:not_an_ipa) { File.expand_path("./fastlane_core/spec/fixtures/ipas/not-an-ipa.ipa") } let(:correctly_signed_ipa) { File.expand_path("./fastlane_core/spec/fixtures/ipas/very-capable-app.ipa") } let(:correctly_signed_ipa_with_spaces) { File.expand_path("./fastlane_core/spec/fixtures/ipas/very capable app.ipa") } let(:correctly_signed_xcarchive) { File.expand_path("./fastlane_core/spec/fixtures/archives/very-capable-app.xcarchive") } let(:correctly_signed_xcarchive_with_spaces) { File.expand_path("./fastlane_core/spec/fixtures/archives/very capable app.xcarchive") } let(:correctly_signed_app) { File.expand_path("./fastlane_core/spec/fixtures/archives/very-capable-app.xcarchive/Products/Applications/very-capable-app.app") } let(:correctly_signed_app_with_spaces) { File.expand_path("./fastlane_core/spec/fixtures/archives/very capable app.xcarchive/Products/Applications/very capable app.app") } let(:incorrectly_signed_ipa) { File.expand_path("./fastlane_core/spec/fixtures/ipas/IncorrectlySigned.ipa") } let(:ipa_with_no_app) { File.expand_path("./fastlane_core/spec/fixtures/ipas/no-app-bundle.ipa") } let(:simulator_app) { File.expand_path("./fastlane_core/spec/fixtures/bundles/simulator-app.app") } let(:not_an_app) { File.expand_path("./fastlane_core/spec/fixtures/bundles/not-an-app.txt") } let(:archive_with_no_app) { File.expand_path("./fastlane_core/spec/fixtures/archives/no-app-bundle.xcarchive") } let(:expected_title) { "Summary for verify_build #{Fastlane::VERSION}" } let(:expected_app_info) do { "bundle_identifier" => "org.fastlane.very-capable-app", "team_identifier" => "TestFixture", "app_name" => "very-capable-app", "provisioning_uuid" => "12345678-1234-1234-1234-123456789012", "team_name" => "TestFixture", "authority" => ["TestFixture"] } end before(:each) do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::IPA_OUTPUT_PATH] = nil allow(FastlaneCore::UI).to receive(:success).with("Driving the lane 'test' 🚀") end if FastlaneCore::Helper.mac? it "uses the ipa output path from lane context" do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::IPA_OUTPUT_PATH] = correctly_signed_ipa expect(FastlaneCore::PrintTable).to receive(:print_values).with(config: expected_app_info, title: expected_title) expect(FastlaneCore::UI).to receive(:success).with("Build is verified, have a 🍪.") Fastlane::FastFile.new.parse("lane :test do verify_build end").runner.execute(:test) end it "uses ipa set via ipa_path" do expect(FastlaneCore::PrintTable).to receive(:print_values).with(config: expected_app_info, title: expected_title) expect(FastlaneCore::UI).to receive(:success).with("Build is verified, have a 🍪.") Fastlane::FastFile.new.parse("lane :test do verify_build( ipa_path: '#{correctly_signed_ipa}' ) end").runner.execute(:test) end it "uses ipa set via ipa_path that contains spaces" do expect(FastlaneCore::PrintTable).to receive(:print_values).with(config: expected_app_info, title: expected_title) expect(FastlaneCore::UI).to receive(:success).with("Build is verified, have a 🍪.") Fastlane::FastFile.new.parse("lane :test do verify_build( ipa_path: '#{correctly_signed_ipa_with_spaces}' ) end").runner.execute(:test) end it "uses app bundle set via build_path" do expect(FastlaneCore::PrintTable).to receive(:print_values).with(config: expected_app_info, title: expected_title) expect(FastlaneCore::UI).to receive(:success).with("Build is verified, have a 🍪.") Fastlane::FastFile.new.parse("lane :test do verify_build( build_path: '#{correctly_signed_app}' ) end").runner.execute(:test) end it "uses app bundle set via build_path that contains spaces" do expect(FastlaneCore::PrintTable).to receive(:print_values).with(config: expected_app_info, title: expected_title) expect(FastlaneCore::UI).to receive(:success).with("Build is verified, have a 🍪.") Fastlane::FastFile.new.parse("lane :test do verify_build( build_path: '#{correctly_signed_app_with_spaces}' ) end").runner.execute(:test) end it "raises an error if app is built for iOS simulator" do expect(FastlaneCore::UI).to receive(:user_error!).with(/Unable to find embedded profile/).and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build( build_path: '#{simulator_app}' ) end").runner.execute(:test) end.to raise_error(/Unable to find embedded profile/) end it "uses xcarchive set via build_path" do expect(FastlaneCore::PrintTable).to receive(:print_values).with(config: expected_app_info, title: expected_title) expect(FastlaneCore::UI).to receive(:success).with("Build is verified, have a 🍪.") Fastlane::FastFile.new.parse("lane :test do verify_build( build_path: '#{correctly_signed_xcarchive}' ) end").runner.execute(:test) end it "uses xcarchive set via build_path that contain spaces" do expect(FastlaneCore::PrintTable).to receive(:print_values).with(config: expected_app_info, title: expected_title) expect(FastlaneCore::UI).to receive(:success).with("Build is verified, have a 🍪.") Fastlane::FastFile.new.parse("lane :test do verify_build( build_path: '#{correctly_signed_xcarchive_with_spaces}' ) end").runner.execute(:test) end end describe "Conflicting options" do it "raises an error if both build_path and ipa_path options are specified" do expect(FastlaneCore::UI).to receive(:user_error!).with("Unresolved conflict between options: 'build_path' and 'ipa_path'").and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build( build_path: 'path/to/build', ipa_path: 'path/to/ipa' ) end").runner.execute(:test) end.to raise_error("Unresolved conflict between options: 'build_path' and 'ipa_path'") end it "raises an error if both ipa_path and build_path options are specified" do expect(FastlaneCore::UI).to receive(:user_error!).with("Unresolved conflict between options: 'ipa_path' and 'build_path'").and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build( ipa_path: 'path/to/ipa', build_path: 'path/to/build' ) end").runner.execute(:test) end.to raise_error("Unresolved conflict between options: 'ipa_path' and 'build_path'") end end describe "Missing ipa file" do it "raises an error if ipa file path set via lane context does not exist" do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::IPA_OUTPUT_PATH] = no_such_file expect(FastlaneCore::UI).to receive(:user_error!).with("Unable to find file '#{no_such_file}'").and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build end").runner.execute(:test) end.to raise_error("Unable to find file '#{no_such_file}'") end it "raises an error if specified ipa file does not exist" do expect(FastlaneCore::UI).to receive(:user_error!).with("Unable to find file '#{no_such_file}'").and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build( ipa_path: '#{no_such_file}' ) end").runner.execute(:test) end.to raise_error("Unable to find file '#{no_such_file}'") end it "ignores ipa path from lane context if custom ipa is specified" do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::IPA_OUTPUT_PATH] = correctly_signed_ipa expect(FastlaneCore::UI).to receive(:user_error!).with("Unable to find file '#{no_such_file}'").and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build( ipa_path: '#{no_such_file}' ) end").runner.execute(:test) end.to raise_error("Unable to find file '#{no_such_file}'") end end describe "Missing build file" do it "raises an error if specified build file does not exist" do expect(FastlaneCore::UI).to receive(:user_error!).with("Unable to find file '#{no_such_file}'").and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build( build_path: '#{no_such_file}' ) end").runner.execute(:test) end.to raise_error("Unable to find file '#{no_such_file}'") end it "ignores ipa path from lane context if custom build path is specified" do Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::IPA_OUTPUT_PATH] = correctly_signed_ipa expect(FastlaneCore::UI).to receive(:user_error!).with("Unable to find file '#{no_such_file}'").and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build( build_path: '#{no_such_file}' ) end").runner.execute(:test) end.to raise_error("Unable to find file '#{no_such_file}'") end end describe "Invalid build file" do it "raises an error if ipa is not signed correctly" do expect(FastlaneCore::UI).to receive(:user_error!).with("Unable to verify code signing").and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build( build_path: '#{incorrectly_signed_ipa}' ) end").runner.execute(:test) end.to raise_error("Unable to verify code signing") end it "raises an error if ipa is not a valid zip archive" do expect(FastlaneCore::UI).to receive(:user_error!).with("Unable to unzip ipa").and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build( ipa_path: '#{not_an_ipa}' ) end").runner.execute(:test) end.to raise_error("Unable to unzip ipa") end it "raises an error if build path is not a valid app file" do expect(FastlaneCore::UI).to receive(:user_error!).with("Unable to verify code signing").and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build( build_path: '#{not_an_app}' ) end").runner.execute(:test) end.to raise_error("Unable to verify code signing") end end describe "Missing app file" do it "raises an error if ipa_path does not contain an app file" do expect(FastlaneCore::UI).to receive(:user_error!).with("Unable to find app file").and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build( ipa_path: '#{ipa_with_no_app}' ) end").runner.execute(:test) end.to raise_error("Unable to find app file") end it "raises an error if build_path does not contain an app file" do expect(FastlaneCore::UI).to receive(:user_error!).with("Unable to find app file").and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build( build_path: '#{ipa_with_no_app}' ) end").runner.execute(:test) end.to raise_error("Unable to find app file") end it "raises an error if xcarchive does not contain an app file" do expect(FastlaneCore::UI).to receive(:user_error!).with("Unable to find app file").and_call_original expect do Fastlane::FastFile.new.parse("lane :test do verify_build( build_path: '#{archive_with_no_app}' ) end").runner.execute(:test) end.to raise_error("Unable to find app file") end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/xcversion_spec.rb
fastlane/spec/actions_specs/xcversion_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "xcversion integration" do after(:each) do ENV.delete("DEVELOPER_DIR") end context "when a version requirement is specified" do let(:v7_2) do double("XcodeInstall::Xcode", version: "7.2", path: "/Test/Xcode7.2") end let(:v7_2_1) do double("XcodeInstall::Xcode", version: "7.2.1", path: "/Test/Xcode7.2.1") end let(:v7_3) do double("XcodeInstall::Xcode", version: "7.3", path: "/Test/Xcode7.3") end context "with a valid requirement" do before do require "xcode/install" installer = double("XcodeInstall::Installer") allow(installer).to receive(:installed_versions).and_return([v7_2, v7_2_1, v7_3]) allow(XcodeInstall::Installer).to receive(:new).and_return(installer) end context "with a specific requirement" do it "selects the correct version of xcode" do Fastlane::FastFile.new.parse("lane :test do xcversion version: '= 7.2' end").runner.execute(:test) expect(ENV["DEVELOPER_DIR"]).to eq(File.join(v7_2.path, "Contents/Developer")) end end context "with a pessimistic requirement" do it "selects the correct version of xcode" do Fastlane::FastFile.new.parse("lane :test do xcversion version: '~> 7.2.0' end").runner.execute(:test) expect(ENV["DEVELOPER_DIR"]).to eq(File.join(v7_2_1.path, "Contents/Developer")) end end context "with an unsatisfiable requirement" do it "raises an error" do expect do Fastlane::FastFile.new.parse("lane :test do xcversion version: '= 7.1' end").runner.execute(:test) end.to raise_error("Cannot find an installed Xcode satisfying '= 7.1'") end end end end describe "version default value" do context "load a .xcode-version file if it exists" do context "uses default" do let(:v13_0) do double("XcodeInstall::Xcode", version: "13.0", path: "/Test/Xcode13.0") end let(:xcode_version_path) { ".xcode-version" } before do require "xcode/install" installer = double("XcodeInstall::Installer") allow(installer).to receive(:installed_versions).and_return([v13_0]) allow(XcodeInstall::Installer).to receive(:new).and_return(installer) allow(Dir).to receive(:glob).with(".xcode-version").and_return([xcode_version_path]) end it "succeeds if the numbers match" do expect(UI).to receive(:message).with(/Setting Xcode version/) allow(File).to receive(:read).with(xcode_version_path).and_return("13.0") result = Fastlane::FastFile.new.parse("lane :test do xcversion end").runner.execute(:test) expect(ENV["DEVELOPER_DIR"]).to eq(File.join(v13_0.path, "Contents/Developer")) end it "fails if the numbers don't match" do allow(File).to receive(:read).with(xcode_version_path).and_return("14.0") expect do Fastlane::FastFile.new.parse("lane :test do xcversion end").runner.execute(:test) end.to raise_error("Cannot find an installed Xcode satisfying '14.0'") end end context "overrides default" do let(:v13_0) do double("XcodeInstall::Xcode", version: "13.0", path: "/Test/Xcode13.0") end let(:xcode_version_path) { ".xcode-version" } before do require "xcode/install" installer = double("XcodeInstall::Installer") allow(installer).to receive(:installed_versions).and_return([v13_0]) allow(XcodeInstall::Installer).to receive(:new).and_return(installer) allow(Dir).to receive(:glob).with(".xcode-version").and_return([xcode_version_path]) end it "succeeds if the numbers match" do expect(UI).to receive(:message).with(/Setting Xcode version/) allow(File).to receive(:read).with(xcode_version_path).and_return("14.0") result = Fastlane::FastFile.new.parse("lane :test do xcversion(version: '13.0') end").runner.execute(:test) expect(ENV["DEVELOPER_DIR"]).to eq(File.join(v13_0.path, "Contents/Developer")) end end end context "no .xcode-version file exists" do it "raises an error" do expect do Fastlane::FastFile.new.parse("lane :test do xcversion end").runner.execute(:test) end.to raise_error("Version must be specified") end end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/git_tag_exists_spec.rb
fastlane/spec/actions_specs/git_tag_exists_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "git_tag_exists" do it "executes the correct git command" do allow(Fastlane::Actions).to receive(:sh) .with("git rev-parse -q --verify refs/tags/1.2.0", anything) .and_return("12345") result = Fastlane::FastFile.new.parse("lane :test do git_tag_exists(tag: '1.2.0') end").runner.execute(:test) end it "executes the correct git command remote" do allow(Fastlane::Actions).to receive(:sh) .with("git ls-remote -q --exit-code origin refs/tags/1.2.0", anything) .and_return("12345") result = Fastlane::FastFile.new.parse("lane :test do git_tag_exists(tag: '1.2.0', remote: true) end").runner.execute(:test) allow(Fastlane::Actions).to receive(:sh) .with("git ls-remote -q --exit-code huga refs/tags/1.2.0", anything) .and_return("12345") result = Fastlane::FastFile.new.parse("lane :test do git_tag_exists(tag: '1.2.0', remote: true, remote_name: 'huga') end").runner.execute(:test) end it "logs the command if verbose" do FastlaneSpec::Env.with_verbose(true) do allow(Fastlane::Actions).to receive(:sh) .with(anything, hash_including(log: true)) .and_return("") result = Fastlane::FastFile.new.parse("lane :test do git_tag_exists(tag: '1.2.0') end").runner.execute(:test) end end context("when the tag exists") do before do allow(Fastlane::Actions).to receive(:sh) .with("git rev-parse -q --verify refs/tags/1.2.0", hash_including(log: nil)) .and_return("41215512353215321") end it "returns true" do result = Fastlane::FastFile.new.parse("lane :test do git_tag_exists(tag: '1.2.0') end").runner.execute(:test) expect(result).to eq(true) end end context("when the tag doesn't exist") do before do allow(Fastlane::Actions).to receive(:sh) { |command, params| expect(command).to eq('git rev-parse -q --verify refs/tags/1.2.0') expect(params[:log]).to be_nil params[:error_callback].call('error') } end it "returns true" do result = Fastlane::FastFile.new.parse("lane :test do git_tag_exists(tag: '1.2.0') end").runner.execute(:test) expect(result).to eq(false) end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/produce_spec.rb
fastlane/spec/actions_specs/produce_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Produce Integration" do it "raises an error if non hash is passed" do expect do Fastlane::FastFile.new.parse("lane :test do produce('text') end").runner.execute(:test) end.to raise_error("You have to call the integration like `produce(key: \"value\")`. Run `fastlane action produce` for all available keys. Please check out the current documentation on GitHub.") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/set_changelog_spec.rb
fastlane/spec/actions_specs/set_changelog_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "set_changelog" do context 'with invalid platform' do let(:invalidPlatform_lane) { "lane :test do set_changelog(app_identifier: 'x.y.z', platform: 'whatever', changelog: 'custom changelog', username: 'name@example.com') end" } it 'raises a Fastlane error' do expect { Fastlane::FastFile.new.parse(invalidPlatform_lane).runner.execute(:test) }.to( raise_error(FastlaneCore::Interface::FastlaneError) do |error| expect(error.message).to match(/Invalid platform 'whatever', must be ios, appletvos, xros, mac/) end ) end end context 'with invalid app_identifier' do let(:validPlatform_lane) { "lane :test do set_changelog(app_identifier: 'x.y.z', platform: 'ios', changelog: 'custom changelog', username: 'name@example.com') end" } it 'raises a Fastlane error' do allow(Spaceship::ConnectAPI).to receive(:login).and_return(true) allow(Spaceship::ConnectAPI).to receive(:select_team).and_return(true) allow(Spaceship::ConnectAPI::App).to receive(:find).and_return(nil) expect { Fastlane::FastFile.new.parse(validPlatform_lane).runner.execute(:test) }.to( raise_error(FastlaneCore::Interface::FastlaneError) do |error| expect(error.message).to match(/Couldn't find app with identifier x.y.z/) end ) end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/verify_xcode_spec.rb
fastlane/spec/actions_specs/verify_xcode_spec.rb
describe Fastlane::Actions::VerifyXcodeAction do describe 'codesign verification' do it "reports success for AppStore codesign details" do fixture_data = File.read('./fastlane/spec/fixtures/verify_xcode/xcode_codesign_appstore.txt') allow(FastlaneCore::UI).to receive(:message) expect(Fastlane::Actions).to receive(:sh).with(/codesign/).and_return(fixture_data) expect(FastlaneCore::UI).to receive(:success).with(/Successfully verified/) Fastlane::Actions::VerifyXcodeAction.verify_codesign({ xcode_path: '' }) end it "reports success for AppStore post 11.3 codesign details" do fixture_data = File.read('./fastlane/spec/fixtures/verify_xcode/xcode_codesign_appstore_11_4.txt') allow(FastlaneCore::UI).to receive(:message) expect(Fastlane::Actions).to receive(:sh).with(/codesign/).and_return(fixture_data) expect(FastlaneCore::UI).to receive(:success).with(/Successfully verified/) Fastlane::Actions::VerifyXcodeAction.verify_codesign({ xcode_path: '' }) end it "reports success for developer.apple.com pre-Xcode 8 codesign details" do fixture_data = File.read('./fastlane/spec/fixtures/verify_xcode/xcode7_codesign_developer_portal.txt') allow(FastlaneCore::UI).to receive(:message) expect(Fastlane::Actions).to receive(:sh).with(/codesign/).and_return(fixture_data) expect(FastlaneCore::UI).to receive(:success).with(/Successfully verified/) Fastlane::Actions::VerifyXcodeAction.verify_codesign({ xcode_path: '' }) end it "reports success for developer.apple.com post-Xcode 8 codesign details" do fixture_data = File.read('./fastlane/spec/fixtures/verify_xcode/xcode8_codesign_developer_portal.txt') allow(FastlaneCore::UI).to receive(:message) expect(Fastlane::Actions).to receive(:sh).with(/codesign/).and_return(fixture_data) expect(FastlaneCore::UI).to receive(:success).with(/Successfully verified/) Fastlane::Actions::VerifyXcodeAction.verify_codesign({ xcode_path: '' }) end it "raises an error for invalid codesign details" do fixture_data = File.read('./fastlane/spec/fixtures/verify_xcode/xcode_codesign_invalid.txt') allow(FastlaneCore::UI).to receive(:message) allow(FastlaneCore::UI).to receive(:error) expect(Fastlane::Actions).to receive(:sh).with(/codesign/).and_return(fixture_data) expect do Fastlane::Actions::VerifyXcodeAction.verify_codesign({ xcode_path: '' }) end.to raise_error(FastlaneCore::Interface::FastlaneError) end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/increment_version_number_action_spec.rb
fastlane/spec/actions_specs/increment_version_number_action_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Increment Version Number Integration" do { "1" => "2", "1.1" => "1.2", "1.1.1" => "1.1.2" }.each do |from_version, to_version| it "increments all targets' version number from #{from_version} to #{to_version}" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool what-marketing-version/, any_args) .once .and_return(from_version) Fastlane::FastFile.new.parse("lane :test do increment_version_number end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::VERSION_NUMBER]).to match(/cd .* && agvtool new-marketing-version #{to_version}/) end end ["1.0", "10"].each do |version| it "raises an exception when trying to increment patch version number for #{version} (which has no patch number)" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool what-marketing-version/, any_args) .once .and_return(version) expect do Fastlane::FastFile.new.parse("lane :test do increment_version_number(bump_type: 'patch') end").runner.execute(:test) end.to raise_error("Can't increment version") end end { "1.0.0" => "1.1.0", "10.13" => "10.14" }.each do |from_version, to_version| it "increments all targets' minor version number from #{from_version} to #{to_version}" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool what-marketing-version/, any_args) .once .and_return(from_version) Fastlane::FastFile.new.parse("lane :test do increment_version_number(bump_type: 'minor') end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::VERSION_NUMBER]).to match(/cd .* && agvtool new-marketing-version #{to_version}/) end end it "raises an exception when trying to increment minor version number for 12 (which has no minor number)" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool what-marketing-version/, any_args) .once .and_return("12") expect do Fastlane::FastFile.new.parse("lane :test do increment_version_number(bump_type: 'minor') end").runner.execute(:test) end.to raise_error("Can't increment version") end { "1.0.0" => "2.0.0", "10.13" => "11.0", "12" => "13" }.each do |from_version, to_version| it "it increments all targets' major version number from #{from_version} to #{to_version}" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool what-marketing-version/, any_args) .once .and_return(from_version) Fastlane::FastFile.new.parse("lane :test do increment_version_number(bump_type: 'major') end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::VERSION_NUMBER]).to match(/cd .* && agvtool new-marketing-version #{to_version}/) end end ["1.4.3", "1.0", "10"].each do |version| it "passes a custom version number #{version}" do result = Fastlane::FastFile.new.parse("lane :test do increment_version_number(version_number: \"#{version}\") end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::VERSION_NUMBER]).to match(/cd .* && agvtool new-marketing-version #{version}/) end end it "prefers a custom version number over a boring version bump" do Fastlane::FastFile.new.parse("lane :test do increment_version_number(version_number: '1.77.3', bump_type: 'major') end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::VERSION_NUMBER]).to match(/cd .* && agvtool new-marketing-version 1.77.3/) end it "automatically removes new lines from the version number" do Fastlane::FastFile.new.parse("lane :test do increment_version_number(version_number: '1.77.3\n', bump_type: 'major') end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::VERSION_NUMBER]).to end_with("&& agvtool new-marketing-version 1.77.3") end it "returns the new version as return value" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool what-marketing-version/, any_args) .once .and_return("1.0.0") result = Fastlane::FastFile.new.parse("lane :test do increment_version_number(bump_type: 'major') end").runner.execute(:test) expect(result).to eq(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::VERSION_NUMBER]) end it "raises an exception when xcode project path wasn't found" do expect do Fastlane::FastFile.new.parse("lane :test do increment_version_number(xcodeproj: '/nothere') end").runner.execute(:test) end.to raise_error("Could not find Xcode project") end it "raises an exception when user passes workspace" do expect do Fastlane::FastFile.new.parse("lane :test do increment_version_number(xcodeproj: 'project.xcworkspace') end").runner.execute(:test) end.to raise_error("Please pass the path to the project, not the workspace") end ["A", "1.2.3.4", "1.2.3-pre"].each do |version| it "raises an exception when unable to calculate new version for #{version} (which does not match any of the supported schemes)" do expect(Fastlane::Actions).to receive(:sh) .with(/agvtool what-marketing-version/, any_args) .once .and_return(version) expect do Fastlane::FastFile.new.parse("lane :test do increment_version_number end").runner.execute(:test) end.to raise_error("Your current version (#{version}) does not respect the format A or A.B or A.B.C") end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/update_code_signing_settings_spec.rb
fastlane/spec/actions_specs/update_code_signing_settings_spec.rb
require "xcodeproj" # 771D79501D9E69C900D840FA = demo # 77C503031DD3175E00AC8FF0 = today describe Fastlane do describe Fastlane::FastFile do let(:project_path_old) do "./fastlane/spec/fixtures/xcodeproj/update-code-signing-settings-old.xcodeproj" end let(:unmodified_project_path) do "./fastlane/spec/fixtures/xcodeproj/update-code-signing-settings.xcodeproj" end project_path = nil before :each do ENV.delete("FASTLANE_TEAM_ID") temp_dir = Dir.tmpdir FileUtils.copy_entry(unmodified_project_path, temp_dir) project_path = temp_dir end describe "Update Code Signing Settings" do before :each do allow(FastlaneCore::FastlaneFolder).to receive(:path).and_return(nil) end it "Automatic code signing" do allow(UI).to receive(:success) expect(UI).to receive(:success).with("Successfully updated project settings to use Code Sign Style = 'Automatic'") result = Fastlane::FastFile.new.parse("lane :test do update_code_signing_settings(use_automatic_signing: true, path: '#{project_path}', team_id: 'XXXX') end").runner.execute(:test) expect(result).to eq(true) project = Xcodeproj::Project.open(project_path) project.targets.each do |target| target.build_configuration_list.get_setting("CODE_SIGN_STYLE").map do |build_config, value| expect(value).to eq("Automatic") end end end it "Manual code signing for specific target" do allow(UI).to receive(:success) expect(UI).to receive(:success).with("Successfully updated project settings to use Code Sign Style = 'Manual'") expect(UI).to receive(:success).with("\t * today") expect(UI).to receive(:important).with("Skipping demo not selected (today)") result = Fastlane::FastFile.new.parse("lane :test do update_code_signing_settings(use_automatic_signing: false, path: '#{project_path}', targets: ['today']) end").runner.execute(:test) expect(result).to eq(false) project = Xcodeproj::Project.open(project_path) project.targets.each do |target| target.build_configuration_list.get_setting("CODE_SIGN_STYLE").map do |build_config, value| expect(value).to eq(target.name == 'today' ? "Manual" : "Automatic") end end end it "Manual code signing" do allow(UI).to receive(:success) expect(UI).to receive(:success).with("Successfully updated project settings to use Code Sign Style = 'Manual'") result = Fastlane::FastFile.new.parse("lane :test do update_code_signing_settings(use_automatic_signing: false, path: '#{project_path}') end").runner.execute(:test) expect(result).to eq(false) project = Xcodeproj::Project.open(project_path) project.targets.each do |target| target.build_configuration_list.get_setting("CODE_SIGN_STYLE").map do |build_config, value| expect(value).to eq("Manual") end end end it "sets team id" do # G3KGXDXQL9 allow(UI).to receive(:success) expect(UI).to receive(:success).with("Successfully updated project settings to use Code Sign Style = 'Manual'") ["Debug", "Release"].each do |configuration| expect(UI).to receive(:important).with("Set Team id to: G3KGXDXQL9 for target: demo for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Team id to: G3KGXDXQL9 for target: today for build configuration: #{configuration}") end result = Fastlane::FastFile.new.parse("lane :test do update_code_signing_settings(use_automatic_signing: false, path: '#{project_path}', team_id: 'G3KGXDXQL9') end").runner.execute(:test) expect(result).to eq(false) project = Xcodeproj::Project.open(project_path) project.targets.each do |target| target.build_configuration_list.get_setting("CODE_SIGN_STYLE").map do |build_config, value| expect(value).to eq("Manual") end end end it "sets code sign identity" do # G3KGXDXQL9 allow(UI).to receive(:success) expect(UI).to receive(:success).with("Successfully updated project settings to use Code Sign Style = 'Manual'") ["Debug", "Release"].each do |configuration| expect(UI).to receive(:important).with("Set Team id to: G3KGXDXQL9 for target: demo for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Team id to: G3KGXDXQL9 for target: today for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Code Sign identity to: iPhone Distribution for target: demo for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Code Sign identity to: iPhone Distribution for target: today for build configuration: #{configuration}") end result = Fastlane::FastFile.new.parse("lane :test do update_code_signing_settings(use_automatic_signing: false, path: '#{project_path}', team_id: 'G3KGXDXQL9', code_sign_identity: 'iPhone Distribution') end").runner.execute(:test) expect(result).to eq(false) project = Xcodeproj::Project.open(project_path) project.targets.each do |target| target.build_configuration_list.get_setting("CODE_SIGN_STYLE").map do |build_config, value| expect(value).to eq("Manual") end target.build_configuration_list.get_setting("CODE_SIGN_IDENTITY").map do |build_config, value| expect(value).to eq("iPhone Distribution") end end end it "sets code sign entitlements file" do # G3KGXDXQL9 allow(UI).to receive(:success) expect(UI).to receive(:success).with("Successfully updated project settings to use Code Sign Style = 'Manual'") ["Debug", "Release"].each do |configuration| expect(UI).to receive(:important).with("Set Team id to: G3KGXDXQL9 for target: demo for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Team id to: G3KGXDXQL9 for target: today for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Entitlements file path to: Test.entitlements for target: demo for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Entitlements file path to: Test.entitlements for target: today for build configuration: #{configuration}") end result = Fastlane::FastFile.new.parse("lane :test do update_code_signing_settings(use_automatic_signing: false, path: '#{project_path}', team_id: 'G3KGXDXQL9', entitlements_file_path: 'Test.entitlements') end").runner.execute(:test) expect(result).to eq(false) project = Xcodeproj::Project.open(project_path) project.targets.each do |target| target.build_configuration_list.get_setting("CODE_SIGN_STYLE").map do |build_config, value| expect(value).to eq("Manual") end target.build_configuration_list.get_setting("CODE_SIGN_ENTITLEMENTS").map do |build_config, value| expect(value).to eq("Test.entitlements") end end end it "sets profile name" do # G3KGXDXQL9 allow(UI).to receive(:success) expect(UI).to receive(:success).with("Successfully updated project settings to use Code Sign Style = 'Manual'") ["Debug", "Release"].each do |configuration| expect(UI).to receive(:important).with("Set Team id to: G3KGXDXQL9 for target: demo for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Team id to: G3KGXDXQL9 for target: today for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Provisioning Profile name to: Mindera for target: demo for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Provisioning Profile name to: Mindera for target: today for build configuration: #{configuration}") end result = Fastlane::FastFile.new.parse("lane :test do update_code_signing_settings(use_automatic_signing: false, path: '#{project_path}', team_id: 'G3KGXDXQL9', profile_name: 'Mindera') end").runner.execute(:test) expect(result).to eq(false) project = Xcodeproj::Project.open(project_path) project.targets.each do |target| target.build_configuration_list.get_setting("CODE_SIGN_STYLE").map do |build_config, value| expect(value).to eq("Manual") end target.build_configuration_list.get_setting("PROVISIONING_PROFILE_SPECIFIER").map do |build_config, value| expect(value).to eq("Mindera") end end end it "sets profile uuid" do # G3KGXDXQL9 allow(UI).to receive(:success) expect(UI).to receive(:success).with("Successfully updated project settings to use Code Sign Style = 'Manual'") ["Debug", "Release"].each do |configuration| expect(UI).to receive(:important).with("Set Team id to: G3KGXDXQL9 for target: demo for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Team id to: G3KGXDXQL9 for target: today for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Provisioning Profile UUID to: 1337 for target: demo for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Provisioning Profile UUID to: 1337 for target: today for build configuration: #{configuration}") end result = Fastlane::FastFile.new.parse("lane :test do update_code_signing_settings(use_automatic_signing: false, path: '#{project_path}', team_id: 'G3KGXDXQL9', profile_uuid: '1337') end").runner.execute(:test) expect(result).to eq(false) project = Xcodeproj::Project.open(project_path) project.targets.each do |target| target.build_configuration_list.get_setting("CODE_SIGN_STYLE").map do |build_config, value| expect(value).to eq("Manual") end target.build_configuration_list.get_setting("PROVISIONING_PROFILE").map do |build_config, value| expect(value).to eq("1337") end end end it "sets bundle identifier" do # G3KGXDXQL9 allow(UI).to receive(:success) expect(UI).to receive(:success).with("Successfully updated project settings to use Code Sign Style = 'Manual'") ["Debug", "Release"].each do |configuration| expect(UI).to receive(:important).with("Set Team id to: G3KGXDXQL9 for target: demo for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Team id to: G3KGXDXQL9 for target: today for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Bundle identifier to: com.fastlane.mindera.cosigner for target: demo for build configuration: #{configuration}") expect(UI).to receive(:important).with("Set Bundle identifier to: com.fastlane.mindera.cosigner for target: today for build configuration: #{configuration}") end result = Fastlane::FastFile.new.parse("lane :test do update_code_signing_settings(use_automatic_signing: false, path: '#{project_path}', team_id: 'G3KGXDXQL9', bundle_identifier: 'com.fastlane.mindera.cosigner') end").runner.execute(:test) expect(result).to eq(false) project = Xcodeproj::Project.open(project_path) project.targets.each do |target| target.build_configuration_list.get_setting("CODE_SIGN_STYLE").map do |build_config, value| expect(value).to eq("Manual") end target.build_configuration_list.get_setting("PRODUCT_BUNDLE_IDENTIFIER").map do |build_config, value| expect(value).to eq("com.fastlane.mindera.cosigner") end end end it "targets not found notice" do allow(UI).to receive(:important) expect(UI).to receive(:important).with("None of the specified targets has been modified") result = Fastlane::FastFile.new.parse("lane :test do update_code_signing_settings(use_automatic_signing: false, path: '#{project_path}', targets: ['not_found']) end").runner.execute(:test) expect(result).to eq(false) end it "raises exception on old projects" do expect(UI).to receive(:user_error!).with("Seems to be a very old project file format - please open your project file in a more recent version of Xcode") result = Fastlane::FastFile.new.parse("lane :test do update_code_signing_settings(use_automatic_signing: false, path: '#{project_path_old}') end").runner.execute(:test) expect(result).to eq(false) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/clipboard_spec.rb
fastlane/spec/actions_specs/clipboard_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Clipboard Integration" do if FastlaneCore::Helper.mac? it "properly stores the value in the clipboard" do str = "Some value: #{Time.now.to_i}" value = Fastlane::FastFile.new.parse("lane :test do clipboard(value: '#{str}') end").runner.execute(:test) expect(`pbpaste`).to eq(str) end end it "raises an error if the value is passed without a hash" do expect do Fastlane::FastFile.new.parse("lane :test do clipboard 'Some Value!' end").runner.execute(:test) end.to raise_error("You have to call the integration like `clipboard(key: \"value\")`. Run `fastlane action clipboard` for all available keys. Please check out the current documentation on GitHub.") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/update_keychain_access_groups_spec.rb
fastlane/spec/actions_specs/update_keychain_access_groups_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Update Info Plist Integration" do let(:test_path) { "/tmp/fastlane/tests/fastlane" } let(:entitlements_path) { "com.test.entitlements" } let(:new_keychain_access_groups) { 'keychain.access.groups.test' } before do # Set up example info.plist FileUtils.mkdir_p(test_path) File.write(File.join(test_path, entitlements_path), '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>keychain-access-groups</key><array><string>keychain.access.groups.test</string></array></dict></plist>') end it "updates the keychain access groups of the entitlements file" do result = Fastlane::FastFile.new.parse("lane :test do update_keychain_access_groups( entitlements_file: '#{File.join(test_path, entitlements_path)}', identifiers: ['#{new_keychain_access_groups}'] ) end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::KEYCHAIN_ACCESS_GROUPS]).to match([new_keychain_access_groups]) end it "throws an error when the entitlements file does not exist" do expect do Fastlane::FastFile.new.parse("lane :test do update_keychain_access_groups( entitlements_file: 'abc.#{File.join(test_path, entitlements_path)}', identifiers: ['#{new_keychain_access_groups}'] ) end").runner.execute(:test) end.to raise_error("Could not find entitlements file at path 'abc.#{File.join(test_path, entitlements_path)}'") end it "throws an error when the entitlements file is not parsable" do File.write(File.join(test_path, entitlements_path), '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>keychain-access-groups</key><array><string>keychain.access.groups.</array></dict></plist>') expect do Fastlane::FastFile.new.parse("lane :test do update_keychain_access_groups( entitlements_file: '#{File.join(test_path, entitlements_path)}', identifiers: ['#{new_keychain_access_groups}'] ) end").runner.execute(:test) end.to raise_error("Entitlements file at '#{File.join(test_path, entitlements_path)}' cannot be parsed.") end it "throws an error when the entitlements file doesn't contain keychain access groups" do File.write(File.join(test_path, entitlements_path), '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict></dict></plist>') expect do Fastlane::FastFile.new.parse("lane :test do update_keychain_access_groups( entitlements_file: '#{File.join(test_path, entitlements_path)}', identifiers: ['#{new_keychain_access_groups}'] ) end").runner.execute(:test) end.to raise_error("No existing keychain access groups field specified. Please specify an keychain access groups in the entitlements file.") end after do # Clean up files File.delete(File.join(test_path, entitlements_path)) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/mailgun_spec.rb
fastlane/spec/actions_specs/mailgun_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Mailgun Action" do before :each do ENV['MAILGUN_SANDBOX_POSTMASTER'] = 'fakepostmaster@fakesandboxtest.mailgun.org' ENV['MAILGUN_APIKEY'] = 'key-73827fakeapikey2329' ENV['MAILGUN_APP_LINK'] = 'http://www.anapplink.com' end it "raises an error if no mailgun sandbox postmaster is given" do ENV.delete('MAILGUN_SANDBOX_POSTMASTER') expect do Fastlane::FastFile.new.parse("lane :test do mailgun({ to: 'valid@gmail.com', message: 'A valid email text', subject: 'A valid subject' }) end").runner.execute(:test) end.to raise_exception("No value found for 'postmaster'") end it "raises an error if no mailgun apikey is given" do ENV.delete('MAILGUN_APIKEY') expect do Fastlane::FastFile.new.parse("lane :test do mailgun({ to: 'valid@gmail.com', message: 'A valid email text' }) end").runner.execute(:test) end.to raise_exception("No value found for 'apikey'") end it "raises an error if no mailgun to is given" do expect do Fastlane::FastFile.new.parse("lane :test do mailgun({ message: 'A valid email text' }) end").runner.execute(:test) end.to raise_exception("No value found for 'to'") end it "raises an error if no mailgun message is given" do expect do Fastlane::FastFile.new.parse("lane :test do mailgun({ to: 'valid@gmail.com' }) end").runner.execute(:test) end.to raise_exception("No value found for 'message'") end it "raises an error if no mailgun app_link is given" do ENV.delete('MAILGUN_APP_LINK') expect do Fastlane::FastFile.new.parse("lane :test do mailgun({ to: 'valid@gmail.com', message: 'A valid email text' }) end").runner.execute(:test) end.to raise_exception("No value found for 'app_link'") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/update_project_provisioning_spec.rb
fastlane/spec/actions_specs/update_project_provisioning_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Update Project Provisioning" do let(:fixtures_path) { "./fastlane/spec/fixtures" } let(:xcodeproj) { File.absolute_path(File.join(fixtures_path, 'xcodeproj', 'bundle.xcodeproj')) } let(:profile_path) { File.absolute_path(File.join(fixtures_path, 'profiles', 'test.mobileprovision')) } describe "target_filter" do before do allow(Fastlane::Actions::UpdateProjectProvisioningAction).to receive(:run) end context 'with String' do it 'should be valid' do expect do Fastlane::FastFile.new.parse("lane :test do update_project_provisioning ({ xcodeproj: '#{xcodeproj}', profile: '#{profile_path}', target_filter: 'Name' }) end").runner.execute(:test) end.not_to(raise_error) end end context 'with Regexp' do it 'should be valid' do expect do Fastlane::FastFile.new.parse("lane :test do update_project_provisioning ({ xcodeproj: '#{xcodeproj}', profile: '#{profile_path}', target_filter: /Name/ }) end").runner.execute(:test) end.not_to(raise_error) end end context 'with other type' do it 'should be invalid' do expect do Fastlane::FastFile.new.parse("lane :test do update_project_provisioning ({ xcodeproj: '#{xcodeproj}', profile: '#{profile_path}', target_filter: 1 }) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError) end end end describe "build_configuration" do before do allow(Fastlane::Actions::UpdateProjectProvisioningAction).to receive(:run) end context 'with String' do it 'should be valid' do expect do Fastlane::FastFile.new.parse("lane :test do update_project_provisioning ({ xcodeproj: '#{xcodeproj}', profile: '#{profile_path}', build_configuration: 'Debug' }) end").runner.execute(:test) end.not_to(raise_error) end end context 'with Regexp' do it 'should be valid' do expect do Fastlane::FastFile.new.parse("lane :test do update_project_provisioning ({ xcodeproj: '#{xcodeproj}', profile: '#{profile_path}', build_configuration: /Debug/ }) end").runner.execute(:test) end.not_to(raise_error) end end context 'with other type' do it 'should be invalid' do expect do Fastlane::FastFile.new.parse("lane :test do update_project_provisioning ({ xcodeproj: '#{xcodeproj}', profile: '#{profile_path}', build_configuration: 1 }) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError) end end end describe "check_verify" do let(:p7) { double('p7') } context 'pass' do it 'has data and nil error_string' do allow(p7).to receive(:data).and_return("data") allow(p7).to receive(:error_string).and_return(nil) Fastlane::Actions::UpdateProjectProvisioningAction.check_verify!(p7) end it 'has data and empty error_string' do allow(p7).to receive(:data).and_return("data") allow(p7).to receive(:error_string).and_return("") Fastlane::Actions::UpdateProjectProvisioningAction.check_verify!(p7) end end context 'fail' do it 'has no data' do allow(p7).to receive(:data).and_return(nil) allow(p7).to receive(:error_string).and_return("Some error") expect do Fastlane::Actions::UpdateProjectProvisioningAction.check_verify!(p7) end.to raise_error(FastlaneCore::Interface::FastlaneCrash) end it 'has empty data' do allow(p7).to receive(:data).and_return("") allow(p7).to receive(:error_string).and_return("Some error") expect do Fastlane::Actions::UpdateProjectProvisioningAction.check_verify!(p7) end.to raise_error(FastlaneCore::Interface::FastlaneCrash) end end end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/get_build_number_repository_spec.rb
fastlane/spec/actions_specs/get_build_number_repository_spec.rb
describe Fastlane do describe Fastlane::FastFile do context "SVN repository" do before do expect(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_svn?).and_return(true) allow(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_git_svn?).and_return(false) allow(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_git?).and_return(false) allow(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_hg?).and_return(false) end it "get SVN build number" do result = Fastlane::FastFile.new.parse("lane :test do get_build_number_repository end").runner.execute(:test) expect(result).to eq('svn info | grep Revision | egrep -o "[0-9]+"') expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER_REPOSITORY]).to eq('svn info | grep Revision | egrep -o "[0-9]+"') end end context "GIT-SVN repository" do before do allow(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_svn?).and_return(false) expect(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_git_svn?).and_return(true) allow(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_git?).and_return(false) allow(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_hg?).and_return(false) end it "get GIT-SVN build number" do result = Fastlane::FastFile.new.parse("lane :test do get_build_number_repository end").runner.execute(:test) expect(result).to eq('git svn info | grep Revision | egrep -o "[0-9]+"') expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER_REPOSITORY]).to eq('git svn info | grep Revision | egrep -o "[0-9]+"') end end context "GIT repository" do before do allow(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_svn?).and_return(false) allow(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_git_svn?).and_return(false) expect(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_git?).and_return(true) allow(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_hg?).and_return(false) end it "get GIT build number" do result = Fastlane::FastFile.new.parse("lane :test do get_build_number_repository end").runner.execute(:test) expect(result).to eq('git rev-parse --short HEAD') expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER_REPOSITORY]).to eq('git rev-parse --short HEAD') end end context "Mercurial repository" do before do allow(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_svn?).and_return(false) allow(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_git_svn?).and_return(false) allow(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_git?).and_return(false) expect(Fastlane::Actions::GetBuildNumberRepositoryAction).to receive(:is_hg?).and_return(true) end it "get HG build number" do result = Fastlane::FastFile.new.parse("lane :test do get_build_number_repository end").runner.execute(:test) expect(result).to eq('hg parent --template "{node|short}"') expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER_REPOSITORY]).to eq('hg parent --template "{node|short}"') end it "get HG revision number" do result = Fastlane::FastFile.new.parse("lane :test do get_build_number_repository( use_hg_revision_number: true ) end").runner.execute(:test) expect(result).to eq('hg parent --template {rev}') expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::BUILD_NUMBER_REPOSITORY]).to eq('hg parent --template {rev}') end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/get_version_number_action_spec.rb
fastlane/spec/actions_specs/get_version_number_action_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Get Version Number Integration" do require 'shellwords' xcodeproj_dir = File.absolute_path("./fastlane/spec/fixtures/actions/get_version_number/") xcodeproj_filename = "get_version_number.xcodeproj" it "gets the correct version number for 'TargetA'", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetA') end").runner.execute(:test) expect(result).to eq("4.3.2") end it "gets the correct version number for 'TargetA' using xcodeproj_filename with extension", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{File.join(xcodeproj_dir, xcodeproj_filename)}', target: 'TargetA') end").runner.execute(:test) expect(result).to eq("4.3.2") end context "Target Settings" do it "gets the correct version number for AggTarget without INFO_PLIST build option", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{File.join(xcodeproj_dir, xcodeproj_filename)}', target: 'AggTarget') end").runner.execute(:test) expect(result).to eq("7.6.6") end it "gets the correct version number for 'TargetVariableParentheses'", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetVariableParentheses') end").runner.execute(:test) expect(result).to eq("4.3.2") end it "gets the correct version number for 'TargetVariableCurlyBraces'", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetVariableCurlyBraces') end").runner.execute(:test) expect(result).to eq("4.3.2") end end context "Project Settings" do it "gets the correct version number for 'TargetVariableParenthesesBuildSettings'", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetVariableParenthesesBuildSettings') end").runner.execute(:test) expect(result).to eq("7.6.5") end it "gets the correct version number for 'TargetVariableCurlyBracesBuildSettings'", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetVariableCurlyBracesBuildSettings') end").runner.execute(:test) expect(result).to eq("7.6.5") end end context "xcconfig defined version" do it "gets the correct version number for 'TargetConfigVersion'", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetConfigVersion') end").runner.execute(:test) expect(result).to eq("4.2.1") end end it "gets the correct version number for 'TargetATests'", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetATests') end").runner.execute(:test) expect(result).to eq("4.3.2") end it "gets the correct version number for 'TargetB'", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetB') end").runner.execute(:test) expect(result).to eq("5.4.3") end it "gets the correct version number for 'TargetBTests'", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetBTests') end").runner.execute(:test) expect(result).to eq("5.4.3") end it "gets the correct version number for 'TargetC_internal'", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetC_internal') end").runner.execute(:test) expect(result).to eq("7.5.2") end it "gets the correct version number for 'TargetC_production'", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetC_production') end").runner.execute(:test) expect(result).to eq("6.4.9") end it "gets the correct version number for 'SampleProject_tests'", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'SampleProject_tests') end").runner.execute(:test) expect(result).to eq("1.0") end it "gets the correct version number with no target specified (and one target)", requires_xcodeproj: true do allow_any_instance_of(Xcodeproj::Project).to receive(:targets).and_wrap_original do |m, *args| [m.call(*args).first] end result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}') end").runner.execute(:test) expect(result).to eq("4.3.2") end it "gets the correct version number with no target specified (and one target and multiple test targets)", requires_xcodeproj: true do allow_any_instance_of(Xcodeproj::Project).to receive(:targets).and_wrap_original do |m, *args| targets = m.call(*args) targets.select do |target| target.name == "TargetA" || target.name == "TargetATests" || target.name == "TargetBTests" end end result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}') end").runner.execute(:test) expect(result).to eq("4.3.2") end it "gets the correct version with $(SRCROOT)", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetSRC') end").runner.execute(:test) expect(result).to eq("1.5.9") end it "gets the correct version when info-plist is relative path", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetRelativePath') end").runner.execute(:test) expect(result).to eq("3.37.0") end it "gets the correct version when info-plist is absolute path", requires_xcodeproj: true do begin # given # copy TargetAbsolutePath-Info.plist to /tmp/fastlane_get_version_number_action_spec/ info_plist = File.absolute_path("./fastlane/spec/fixtures/actions/get_version_number/TargetAbsolutePath-Info.plist") temp_folder_for_test = "/tmp/fastlane_get_version_number_action_spec/" FileUtils.mkdir_p(temp_folder_for_test) FileUtils.cp_r(info_plist, temp_folder_for_test) temp_info_plist = File.path(temp_folder_for_test + "TargetAbsolutePath-Info.plist") expect(File.file?(temp_info_plist)).not_to(be false) # when result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetAbsolutePath') end").runner.execute(:test) # then expect(result).to eq("3.37.4") ensure # after # remove /tmp/fastlane_get_version_number_action_spec/ FileUtils.rm_r(temp_folder_for_test) expect(File.file?(temp_info_plist)).to be false end end it "raises if one target and specified wrong target name", requires_xcodeproj: true do allow_any_instance_of(Xcodeproj::Project).to receive(:targets).and_wrap_original do |m, *args| [m.call(*args).first] end expect do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'ThisIsNotATarget') end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError, "Cannot find target named 'ThisIsNotATarget'") end it "raises if in non-interactive mode with no target", requires_xcodeproj: true do expect do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}') end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneCrash, /non-interactive mode/) end it "raises if in non-interactive mode if cannot infer configuration", requires_xcodeproj: true do expect do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetDifferentConfigurations') end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneCrash, /non-interactive mode/) end it "gets correct version for different configurations", requires_xcodeproj: true do result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetDifferentConfigurations', configuration: 'Debug') end").runner.execute(:test) expect(result).to eq("1.2.3") result = Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{xcodeproj_dir}', target: 'TargetDifferentConfigurations', configuration: 'Release') end").runner.execute(:test) expect(result).to eq("3.2.1") end it "raises an exception when user passes workspace as the xcodeproj" do expect do Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: 'project.xcworkspace') end").runner.execute(:test) end.to raise_error("Please pass the path to the project or its containing directory, not the workspace path") end it "raises an exception when user passes nonexistent directory" do expect do Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '/path/to/random/directory') end").runner.execute(:test) end.to raise_error(/Could not find file or directory at path/) end it "raises an exception when user passes existent directory with no Xcode project inside" do expect do Fastlane::FastFile.new.parse("lane :test do get_version_number(xcodeproj: '#{File.dirname(xcodeproj_dir)}') end").runner.execute(:test) end.to raise_error(/Could not find Xcode project in directory at path/) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/lane_context_spec.rb
fastlane/spec/actions_specs/lane_context_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Lane Context Quick Access" do it "allows you easily access the lane context" do result = Fastlane::FastFile.new.parse("lane :my_lane_name do lane_context[SharedValues::LANE_NAME] end").runner.execute(:my_lane_name) expect(result).to eq("my_lane_name") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/xcodes_spec.rb
fastlane/spec/actions_specs/xcodes_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "xcodes" do let(:xcode_path) { "/valid/path/to/xcode.app" } let(:xcode_developer_path) { "#{xcode_path}/Contents/Developer" } let(:xcodes_binary_path) { "/path/to/bin/xcodes" } let(:valid_xcodes_version) { "1.1.0" } let(:outdated_xcodes_version) { "1.0.0" } before(:each) do allow(Fastlane::Helper::XcodesHelper).to receive(:find_xcodes_binary_path).and_return(xcodes_binary_path) allow(File).to receive(:exist?).and_call_original allow(File).to receive(:exist?).with(xcodes_binary_path).and_return(true) allow(Fastlane::Actions).to receive(:sh).and_call_original allow(Fastlane::Actions).to receive(:sh).with("#{xcodes_binary_path} installed '14'").and_return(xcode_path) allow(Fastlane::Actions).to receive(:sh).with("#{xcodes_binary_path} version", { log: false }).and_return(valid_xcodes_version) end after(:each) do ENV.delete("DEVELOPER_DIR") end describe "update_list argument" do it "invokes update command when true" do expect(Fastlane::Actions).to receive(:sh).with(/--update/) Fastlane::FastFile.new.parse("lane :test do xcodes(version: '14', update_list: true) end").runner.execute(:test) end it "doesn't invoke update command when false" do expect(Fastlane::Actions).to receive(:sh).with("#{xcodes_binary_path} install '14' --select") expect(Fastlane::Actions).to_not(receive(:sh).with(/--update/)) Fastlane::FastFile.new.parse("lane :test do xcodes(version: '14', update_list: false) end").runner.execute(:test) end end context "when select_for_current_build_only is true" do it "doesn't invoke 'update' nor 'install'" do expect(Fastlane::Actions).to_not(receive(:sh).with(/--update|--install/)) expect(Fastlane::Actions).to receive(:sh).with(/installed/) Fastlane::FastFile.new.parse("lane :test do xcodes(version: '14', select_for_current_build_only: true) end").runner.execute(:test) end it "errors when there is no matching Xcode version" do # Note that this test is very tied to the code's implementation as it # relies on the action using `sh` with the block syntax. allow(Fastlane::Actions).to receive(:sh).with("#{xcodes_binary_path} installed '14'") do |_, _, &block| # Simulate the `xcodes installed` call failing fake_status = instance_double(Process::Status) allow(fake_status).to receive(:success?).and_return(false) allow(fake_status).to receive(:exitstatus).and_return('fake status') block.call(fake_status, 'fake result', 'fake command') end expect do Fastlane::FastFile.new.parse("lane :test do xcodes(version: '14', select_for_current_build_only: true) end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError, 'Command `fake command` failed with status fake status and message: fake result') end end it "passes any received string to the command if xcodes_args is passed" do random_string = "xcodes compiles pikachu into a mewtwo" expect(Fastlane::Actions).to receive(:sh).with("#{xcodes_binary_path} #{random_string}") Fastlane::FastFile.new.parse("lane :test do xcodes(version: '14', xcodes_args: '#{random_string}') end").runner.execute(:test) end it "invokes install command when xcodes_args is not passed" do expect(Fastlane::Actions).to receive(:sh).with("#{xcodes_binary_path} install '14' --update --select") expect(Fastlane::Actions).to receive(:sh).with("#{xcodes_binary_path} installed '14'") Fastlane::FastFile.new.parse("lane :test do xcodes(version: '14') end").runner.execute(:test) end context "when no params are passed" do describe ".xcode-version file is present" do before do allow(Fastlane::Helper::XcodesHelper).to receive(:read_xcode_version_file).and_return("14") end it "doesn't raise error" do expect(Fastlane::Actions).to receive(:sh).with("#{xcodes_binary_path} installed '14'") Fastlane::FastFile.new.parse("lane :test do xcodes end").runner.execute(:test) end end describe ".xcode-version file is not present" do before do allow(Fastlane::Helper::XcodesHelper).to receive(:read_xcode_version_file).and_return(nil) end it "raises error" do expect do Fastlane::FastFile.new.parse("lane :test do xcodes end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError, "Version must be specified") end end end it "sets the DEVELOPER_DIR environment variable" do Fastlane::FastFile.new.parse("lane :test do xcodes(version: '14') end").runner.execute(:test) expect(ENV["DEVELOPER_DIR"]).to eq(xcode_developer_path) end it "sets the SharedValues::XCODES_XCODE_PATH lane context" do Fastlane::FastFile.new.parse("lane :test do xcodes(version: '14') end").runner.execute(:test) expect(Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::XCODES_XCODE_PATH]).to eql(xcode_developer_path) end it "raises error when using an xcodes version earlier than v1.1.0" do allow(Fastlane::Actions).to receive(:sh).with("#{xcodes_binary_path} version", { log: false }).and_return(outdated_xcodes_version) expect do Fastlane::FastFile.new.parse("lane :test do xcodes(version: '14') end").runner.execute(:test) end.to raise_error(FastlaneCore::Interface::FastlaneError, /minimum version(?:.*)1.1.0(?:.*)please update(?:.*)brew upgrade xcodes/i) end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/push_git_to_remote_spec.rb
fastlane/spec/actions_specs/push_git_to_remote_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "Push To Git Remote Action" do it "works without passing any options" do result = Fastlane::FastFile.new.parse("lane :test do push_to_git_remote end").runner.execute(:test) expect(result).to include("git push origin") expect(result).to include("--tags") end it "works with options specified" do result = Fastlane::FastFile.new.parse("lane :test do push_to_git_remote( remote: 'origin', local_branch: 'develop', remote_branch: 'remote_branch', force: true, tags: false ) end").runner.execute(:test) expect(result).to eq("git push origin develop:remote_branch --force") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false
fastlane/fastlane
https://github.com/fastlane/fastlane/blob/d1f6eb6228644936997aae1956d8036ea62cd5b4/fastlane/spec/actions_specs/adb_spec.rb
fastlane/spec/actions_specs/adb_spec.rb
describe Fastlane do describe Fastlane::FastFile do describe "adb" do it "calls AdbHelper to trigger command" do expect_any_instance_of(Fastlane::Helper::AdbHelper) .to receive(:trigger) .with(command: "fake command", serial: "fake serial") .and_return("some stub adb response") result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'fake command', serial: 'fake serial') end").runner.execute(:test) expect(result).to eq("some stub adb response") end end describe "adb on non windows" do before(:each) do allow(FastlaneCore::Helper).to receive(:windows?).and_return(false) end it "generates a valid command" do result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test', adb_path: './README.md') end").runner.execute(:test) expect(result).to eq("#{File.expand_path('./fastlane/README.md')} test") end it "generates a valid command for commands with multiple parts" do result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test command with multiple parts', adb_path: './README.md') end").runner.execute(:test) expect(result).to eq("#{File.expand_path('./fastlane/README.md')} test command with multiple parts") end it "generates a valid command when a non-empty serial is passed" do result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test command with non-empty serial', adb_path: './README.md', serial: 'emulator-1234') end").runner.execute(:test) expect(result).to eq("ANDROID_SERIAL=emulator-1234 #{File.expand_path('./fastlane/README.md')} test command with non-empty serial") end it "generates a valid command when an empty serial is passed" do result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test command with empty serial', adb_path: './README.md', serial: '') end").runner.execute(:test) expect(result).to eq("#{File.expand_path('./fastlane/README.md')} test command with empty serial") end it "picks up path from ANDROID_HOME environment variable" do stub_const('ENV', { 'ANDROID_HOME' => '/usr/local/android-sdk' }) result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test') end").runner.execute(:test) expect(result).to eq("#{File.expand_path('/usr/local/android-sdk/platform-tools/adb')} test") end it "picks up path from ANDROID_HOME environment variable and handles path that has to be made safe" do stub_const('ENV', { 'ANDROID_HOME' => '/usr/local/android-sdk/with space' }) result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test') end").runner.execute(:test) path = File.expand_path("/usr/local/android-sdk/with space/platform-tools/adb").shellescape expect(result).to eq("#{path} test") end it "picks up path from ANDROID_SDK_ROOT environment variable" do stub_const('ENV', { 'ANDROID_SDK_ROOT' => '/usr/local/android-sdk' }) result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test') end").runner.execute(:test) expect(result).to eq("#{File.expand_path('/usr/local/android-sdk/platform-tools/adb')} test") end it "picks up path from ANDROID_SDK environment variable" do stub_const('ENV', { 'ANDROID_SDK' => '/usr/local/android-sdk' }) result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test') end").runner.execute(:test) expect(result).to eq("#{File.expand_path('/usr/local/android-sdk/platform-tools/adb')} test") end end describe "adb on Windows" do before(:each) do allow(FastlaneCore::Helper).to receive(:windows?).and_return(true) end it "generates a valid command" do result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test', adb_path: './README.md') end").runner.execute(:test) expect(result).to eq("#{File.expand_path('./fastlane/README.md').gsub('/', '\\')} test") end it "generates a valid command for commands with multiple parts" do result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test command with multiple parts', adb_path: './README.md') end").runner.execute(:test) expect(result).to eq("#{File.expand_path('./fastlane/README.md').gsub('/', '\\')} test command with multiple parts") end it "generates a valid command when a non-empty serial is passed" do result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test command with non-empty serial', adb_path: './README.md', serial: 'emulator-1234') end").runner.execute(:test) expect(result).to eq("ANDROID_SERIAL=emulator-1234 #{File.expand_path('./fastlane/README.md').gsub('/', '\\')} test command with non-empty serial") end it "generates a valid command when an empty serial is passed" do result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test command with empty serial', adb_path: './README.md', serial: '') end").runner.execute(:test) expect(result).to eq("#{File.expand_path('./fastlane/README.md').gsub('/', '\\')} test command with empty serial") end it "picks up path from ANDROID_HOME environment variable" do stub_const('ENV', { 'ANDROID_HOME' => '/Users\\SomeUser\\AppData\\Local\\Android\\Sdk' }) result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test') end").runner.execute(:test) expect(result).to eq("#{File.expand_path('/Users\\SomeUser\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb').gsub('/', '\\')} test") end it "picks up path from ANDROID_HOME environment variable and handles path that has to be made safe" do stub_const('ENV', { 'ANDROID_HOME' => '/Users\\Some User With Space\\AppData\\Local\\Android\\Sdk' }) result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test') end").runner.execute(:test) path = File.expand_path("/Users\\Some User With Space\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb").shellescape.gsub('/', '\\') expect(result).to eq("#{path} test") end it "picks up path from ANDROID_SDK_ROOT environment variable" do stub_const('ENV', { 'ANDROID_SDK_ROOT' => '/Users\\SomeUser\\AppData\\Local\\Android\\Sdk' }) result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test') end").runner.execute(:test) expect(result).to eq("#{File.expand_path('/Users\\SomeUser\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb').gsub('/', '\\')} test") end it "picks up path from ANDROID_SDK environment variable" do stub_const('ENV', { 'ANDROID_SDK' => '/Users\\SomeUser\\AppData\\Local\\Android\\Sdk' }) result = Fastlane::FastFile.new.parse("lane :test do adb(command: 'test') end").runner.execute(:test) expect(result).to eq("#{File.expand_path('/Users\\SomeUser\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb').gsub('/', '\\')} test") end end end end
ruby
MIT
d1f6eb6228644936997aae1956d8036ea62cd5b4
2026-01-04T15:37:27.371479Z
false