Skip to content

Commit

Permalink
Activate ruby 3.2.2 on circle, adjust tests (fastlane#21664)
Browse files Browse the repository at this point in the history
* Activate ruby 3.2.2 on circlea

* circle doc

* Update rspec and webmock to pass tests on ruby 3.2+

* require SyntaxError content changed in ruby 3.2

* circle: Run tests on latest xcode version

* rubocop

* webmock 3.19.1 breaks tests

* Find a version of webmock that works, and make the tests pass by passing the expected hash instead of keywords

* Better document the difference between ruby 3.1 and 3.2
  • Loading branch information
lacostej authored and SubhrajyotiSen committed Jan 17, 2024
1 parent c84dae7 commit 86933a1
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 45 deletions.
19 changes: 17 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,25 @@ workflows:
ruby_version: '3.1.4'
ruby_opt: -W:deprecated
- tests_macos:
name: 'Execute tests on macOS (Xcode 15.0.0, Ruby 3.1)'
xcode_version: '15.0.0'
name: 'Execute tests on macOS (Xcode 15.0.1, Ruby 3.1)'
xcode_version: '15.0.1'
ruby_version: '3.1.4'
ruby_opt: -W:deprecated
- tests_macos:
name: 'Execute tests on macOS (Xcode 13.4.1, Ruby 3.2)'
xcode_version: '13.4.1'
ruby_version: '3.2.2'
ruby_opt: -W:deprecated
- tests_macos:
name: 'Execute tests on macOS (Xcode 14.3.1, Ruby 3.2)'
xcode_version: '14.3.1'
ruby_version: '3.2.2'
ruby_opt: -W:deprecated
- tests_macos:
name: 'Execute tests on macOS (Xcode 15.0.1, Ruby 3.2)'
xcode_version: '15.0.1'
ruby_version: '3.2.2'
ruby_opt: -W:deprecated
- tests_ubuntu:
name: 'Execute tests on Ubuntu'
ruby_version: 'fastlanetools/ci:0.3.0'
Expand Down
36 changes: 18 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ GEM
specs:
CFPropertyList (3.0.6)
rexml
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
artifactory (3.0.15)
ast (2.4.2)
atomos (0.1.3)
Expand Down Expand Up @@ -111,7 +111,7 @@ GEM
ox (~> 2.0)
debug_inspector (1.0.0)
declarative (0.0.20)
diff-lcs (1.4.4)
diff-lcs (1.5.0)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
docile (1.3.5)
Expand Down Expand Up @@ -235,7 +235,7 @@ GEM
pry-stack_explorer (0.4.12)
binding_of_caller (~> 0.7)
pry (~> 0.13)
public_suffix (4.0.6)
public_suffix (5.0.4)
racc (1.7.1)
rack (2.2.3.1)
rack-protection (2.0.8.1)
Expand All @@ -257,19 +257,19 @@ GEM
retriable (3.1.2)
rexml (3.2.6)
rouge (2.0.7)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.50.2)
Expand Down Expand Up @@ -335,8 +335,8 @@ GEM
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (2.4.2)
webmock (3.12.1)
addressable (>= 2.3.6)
webmock (3.18.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.8.1)
Expand Down Expand Up @@ -390,7 +390,7 @@ DEPENDENCIES
rubocop-performance
rubocop-require_tools
sinatra (~> 2.0.8)
webmock (~> 3.8)
webmock (~> 3.18)
xcode-install (>= 2.6.7)
xcov (~> 1.4.1)
yard (~> 0.9.11)
Expand Down
2 changes: 1 addition & 1 deletion fastlane.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency('rubocop-require_tools')
spec.add_development_dependency('rubocop', Fastlane::RUBOCOP_REQUIREMENT)
spec.add_development_dependency('sinatra', '~> 2.0.8') # Used for mock servers
spec.add_development_dependency('webmock', '~> 3.8')
spec.add_development_dependency('webmock', '~> 3.18')
spec.add_development_dependency('xcov', '~> 1.4.1') # Used for xcov's parameters generation: https://github.com/fastlane/fastlane/pull/12416
spec.add_development_dependency('yard', '~> 0.9.11')
end
7 changes: 5 additions & 2 deletions fastlane/spec/actions_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@

it "throws errors when syntax is incorrect" do
content = File.read('./fastlane/spec/fixtures/broken_files/broken_file.rb', encoding: 'utf-8')
expect(UI).to receive(:content_error).with(content, '7')
expect(UI).to receive(:content_error).with(content, '8')
expect(UI).to receive(:content_error).with(content, '7') # syntax error, unexpected ':', expecting '}'
# in ruby < 3.2, the SyntaxError string representation contains a second error
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.2')
expect(UI).to receive(:content_error).with(content, '8') # syntax error, unexpected ':', expecting `end'
end
expect(UI).to receive(:user_error!).with("Syntax error in broken_file.rb")
Fastlane::Actions.load_external_actions("./fastlane/spec/fixtures/broken_files")
end
Expand Down
4 changes: 2 additions & 2 deletions fastlane/spec/helper/s3_client_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
end

it 'passes region if given' do
expect(Aws::S3::Client).to receive(:new).with(region: 'aws-region').and_return(s3_client)
expect(Aws::S3::Client).to receive(:new).with({ region: 'aws-region' }).and_return(s3_client)
described_class.new(region: 'aws-region').list_buckets
end

it 'creates credentials if access_key and secret are given' do
expect(Aws::S3::Client).to receive(:new).with(credentials: s3_credentials).and_return(s3_client)
expect(Aws::S3::Client).to receive(:new).with({ credentials: s3_credentials }).and_return(s3_client)
described_class.new(access_key: 'access_key', secret_access_key: 'secret_access_key').list_buckets
end

Expand Down
4 changes: 2 additions & 2 deletions fastlane/spec/plugins_specs/plugin_update_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

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,
expect(Terminal::Table).to receive(:new).with({ title: "Plugin updates available".yellow,
headings: headings,
rows: rows)
rows: rows })

Fastlane::PluginUpdateManager.show_update_status
end
Expand Down
4 changes: 2 additions & 2 deletions match/spec/change_password_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
repo_dir = Dir.mktmpdir

fake_storage = "fake_storage"
expect(Match::Storage::GitStorage).to receive(:configure).with(
expect(Match::Storage::GitStorage).to receive(:configure).with({
git_url: git_url,
shallow_clone: true,
skip_docs: false,
Expand All @@ -31,7 +31,7 @@
git_private_key: nil,
type: config[:type],
platform: config[:platform]
).and_return(fake_storage)
}).and_return(fake_storage)

allow(fake_storage).to receive(:download)
allow(fake_storage).to receive(:working_directory).and_return(repo_dir)
Expand Down
4 changes: 2 additions & 2 deletions match/spec/importer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def developer_id_test_values
end

def setup_fake_storage(repo_dir, config)
expect(Match::Storage::GitStorage).to receive(:configure).with(
expect(Match::Storage::GitStorage).to receive(:configure).with({
git_url: config[:git_url],
shallow_clone: true,
skip_docs: false,
Expand All @@ -136,7 +136,7 @@ def setup_fake_storage(repo_dir, config)
clone_branch_directly: false,
type: config[:type],
platform: config[:platform]
).and_return(fake_storage)
}).and_return(fake_storage)

expect(fake_storage).to receive(:download).and_return(nil)
allow(fake_storage).to receive(:working_directory).and_return(repo_dir)
Expand Down
8 changes: 4 additions & 4 deletions match/spec/migrate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
repo_dir = Dir.mktmpdir

fake_google_cloud_storage = "fake_google_cloud_storage"
expect(Match::Storage::GoogleCloudStorage).to receive(:configure).with(
expect(Match::Storage::GoogleCloudStorage).to receive(:configure).with({
type: nil,
platform: nil,
google_cloud_bucket_name: nil,
Expand All @@ -31,14 +31,14 @@
api_key_path: nil,
api_key: nil,
skip_google_cloud_account_confirmation: nil
).and_return(fake_google_cloud_storage)
}).and_return(fake_google_cloud_storage)

allow(fake_google_cloud_storage).to receive(:download)
allow(fake_google_cloud_storage).to receive(:save_changes!)
allow(fake_google_cloud_storage).to receive(:bucket_name).and_return("")

fake_git_storage = "fake_git_storage"
expect(Match::Storage::GitStorage).to receive(:configure).with(
expect(Match::Storage::GitStorage).to receive(:configure).with({
type: nil,
platform: nil,
git_url: git_url,
Expand All @@ -51,7 +51,7 @@
git_basic_authorization: nil,
git_bearer_authorization: nil,
git_private_key: nil
).and_return(fake_git_storage)
}).and_return(fake_git_storage)

allow(fake_git_storage).to receive(:download)
allow(fake_git_storage).to receive(:working_directory).and_return(repo_dir)
Expand Down
4 changes: 2 additions & 2 deletions match/spec/nuke_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
repo_dir = Dir.mktmpdir

fake_storage = "fake_storage"
expect(Match::Storage::GitStorage).to receive(:configure).with(
expect(Match::Storage::GitStorage).to receive(:configure).with({
git_url: git_url,
shallow_clone: true,
skip_docs: false,
Expand All @@ -39,7 +39,7 @@

type: config[:type],
platform: config[:platform]
).and_return(fake_storage)
}).and_return(fake_storage)

allow(fake_storage).to receive(:download)
allow(fake_storage).to receive(:working_directory).and_return(repo_dir)
Expand Down
16 changes: 8 additions & 8 deletions match/spec/runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
destination = File.expand_path("~/Library/MobileDevice/Provisioning Profiles/98264c6b-5151-4349-8d0f-66691e48ae35.mobileprovision")

fake_storage = "fake_storage"
expect(Match::Storage::GitStorage).to receive(:configure).with(
expect(Match::Storage::GitStorage).to receive(:configure).with({
git_url: git_url,
shallow_clone: true,
skip_docs: false,
Expand All @@ -53,7 +53,7 @@
git_private_key: nil,
type: config[:type],
platform: config[:platform]
).and_return(fake_storage)
}).and_return(fake_storage)

expect(fake_storage).to receive(:download).and_return(nil)
expect(fake_storage).to receive(:clear_changes).and_return(nil)
Expand Down Expand Up @@ -113,7 +113,7 @@
key_path = "./match/spec/fixtures/existing/certs/distribution/E7P4EE896K.p12"

fake_storage = "fake_storage"
expect(Match::Storage::GitStorage).to receive(:configure).with(
expect(Match::Storage::GitStorage).to receive(:configure).with({
git_url: git_url,
shallow_clone: false,
skip_docs: false,
Expand All @@ -126,7 +126,7 @@
git_private_key: nil,
type: config[:type],
platform: config[:platform]
).and_return(fake_storage)
}).and_return(fake_storage)

expect(fake_storage).to receive(:download).and_return(nil)
expect(fake_storage).to receive(:clear_changes).and_return(nil)
Expand Down Expand Up @@ -186,7 +186,7 @@
key_path = "./match/spec/fixtures/existing/certs/distribution/E7P4EE896K.p12"

fake_storage = "fake_storage"
expect(Match::Storage::GitStorage).to receive(:configure).with(
expect(Match::Storage::GitStorage).to receive(:configure).with({
git_url: git_url,
shallow_clone: false,
skip_docs: false,
Expand All @@ -199,7 +199,7 @@
git_private_key: nil,
type: config[:type],
platform: config[:platform]
).and_return(fake_storage)
}).and_return(fake_storage)

expect(fake_storage).to receive(:download).and_return(nil)
expect(fake_storage).to receive(:clear_changes).and_return(nil)
Expand Down Expand Up @@ -241,7 +241,7 @@
destination = File.expand_path("~/Library/MobileDevice/Provisioning Profiles/98264c6b-5151-4349-8d0f-66691e48ae35.mobileprovision")

fake_storage = "fake_storage"
expect(Match::Storage::GitStorage).to receive(:configure).with(
expect(Match::Storage::GitStorage).to receive(:configure).with({
git_url: git_url,
shallow_clone: true,
skip_docs: false,
Expand All @@ -254,7 +254,7 @@
git_private_key: nil,
type: config[:type],
platform: config[:platform]
).and_return(fake_storage)
}).and_return(fake_storage)

expect(fake_storage).to receive(:download).and_return(nil)
expect(fake_storage).to receive(:clear_changes).and_return(nil)
Expand Down

0 comments on commit 86933a1

Please sign in to comment.