Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ruby 3 #21531

Merged
merged 8 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
matrix:
ruby-version:
- '2.7'
- '3.0'
test-suite:
- vmdb
- security
Expand Down
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
raise "Ruby versions < 2.6.0 are unsupported!" if RUBY_VERSION < "2.6.0"
raise "Ruby versions >= 3.0.0 are unsupported!" if RUBY_VERSION >= "3.0.0"
raise "Ruby versions < 2.7.0 are unsupported!" if RUBY_VERSION < "2.7.0"
raise "Ruby versions >= 3.1.0 are unsupported!" if RUBY_VERSION >= "3.1.0"
Copy link
Member Author

@jrafanie jrafanie Sep 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.7 minimum and 3.0.x maximum


source 'https://rubygems.org'

Expand Down Expand Up @@ -72,6 +72,7 @@ gem "ripper_ruby_parser", "~>1.5.1", :require => false
gem "ruby-progressbar", "~>1.7.0", :require => false
gem "rubyzip", "~>2.0.0", :require => false
gem "rugged", "~>1.5.0", :require => false
gem "ruport", "~>1.8.0"
gem "snmp", "~>1.2.0", :require => false
gem "sprockets", "~>3.7.2", :require => false
gem "sync", "~>0.5", :require => false
Expand All @@ -85,7 +86,6 @@ gem "mime-types", "~>3.0", :require => false,

# Modified gems (forked on Github)
gem "handsoap", "=0.2.5.5", :require => false, :source => "https://rubygems.manageiq.org" # for manageiq-gems-pending only
gem "ruport", "=1.7.0.3", :source => "https://rubygems.manageiq.org"

# In 1.9.3: Time.parse uses british version dd/mm/yyyy instead of american version mm/dd/yyyy
# american_date fixes this to be compatible with 1.8.7 until all callers can be converted to the 1.9.3 format prior to parsing.
Expand Down Expand Up @@ -257,7 +257,7 @@ group :ui_dependencies do # Added to Bundler.require in config/application.rb
manageiq_plugin "manageiq-decorators"
manageiq_plugin "manageiq-ui-classic"
# Modified gems (forked on Github)
gem "jquery-rjs", "=0.1.1.2", :source => "https://rubygems.manageiq.org"
gem "jquery-rjs", "=0.1.1.3", :source => "https://rubygems.manageiq.org"
end

group :web_server, :manageiq_default do
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/acts_as_ar_model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
end

it "supports where (as an example)" do
expect(base_class).to receive(:find).with(:all, :conditions => {:id => 5}).and_return([])
expect(base_class).to receive(:find).with(:all, {:conditions => {:id => 5}}).and_return([])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️ These expect...to receive(...).with changes are needed because rspec-mocks started supporting ruby 3.0 format for mocking with for kwargs. Once they did that, we're forced to be explicit when we're expecting a hash in the args. See the rspec-mock commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thanks for the details.

expect(base_class.all.where(:id => 5).to_a).to eq([])
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/rbac/filterer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ def combine_filtered_ids(user_filtered_ids, belongsto_filtered_ids, managed_filt
end

it "includes references" do
expect(subject).to receive(:include_references).with(anything, ::Vm, nil, :host => {})
expect(subject).to receive(:include_references).with(anything, ::Vm, nil, {:host => {}})
.and_call_original
expect(subject).to receive(:warn).never
results
Expand Down Expand Up @@ -2482,7 +2482,7 @@ def get_rbac_results_for_and_expect_objects(klass, expected_objects)
end

it "support aaarm object" do
expect(VimPerformanceTrend).to receive(:find).with(:all, :include => {:a => {}}).and_return([:good])
expect(VimPerformanceTrend).to receive(:find).with(:all, {:include => {:a => {}}}).and_return([:good])
expect(described_class.filtered(VimPerformanceTrend, :include_for_find => {:a => {}}).to_a).to match_array([:good])
end

Expand Down
60 changes: 30 additions & 30 deletions spec/models/authenticator/database_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ def authenticate
end

it "records two successful audit entries" do
expect(AuditEvent).to receive(:success).with(
:event => 'authenticate_database',
:userid => 'alice',
:message => "User alice successfully validated by EVM",
)
expect(AuditEvent).to receive(:success).with(
:event => 'authenticate_database',
:userid => 'alice',
:message => "Authentication successful for user alice",
)
expect(AuditEvent).to receive(:success).with({
:event => 'authenticate_database',
:userid => 'alice',
:message => "User alice successfully validated by EVM",
})
expect(AuditEvent).to receive(:success).with({
:event => 'authenticate_database',
:userid => 'alice',
:message => "Authentication successful for user alice",
})
expect(AuditEvent).not_to receive(:failure)
authenticate
end
Expand Down Expand Up @@ -92,11 +92,11 @@ def authenticate
end

it "records one failing audit entry" do
expect(AuditEvent).to receive(:failure).with(
:event => 'authenticate_database',
:userid => 'alice',
:message => "Authentication failed for userid alice",
)
expect(AuditEvent).to receive(:failure).with({
:event => 'authenticate_database',
:userid => 'alice',
:message => "Authentication failed for userid alice",
})
expect(AuditEvent).not_to receive(:success)
authenticate rescue nil
end
Expand All @@ -122,11 +122,11 @@ def authenticate
end

it "records one failing audit entry" do
expect(AuditEvent).to receive(:failure).with(
:event => 'authenticate_database',
:userid => 'bob',
:message => "Authentication failed for userid bob",
)
expect(AuditEvent).to receive(:failure).with({
:event => 'authenticate_database',
:userid => 'bob',
:message => "Authentication failed for userid bob",
})
expect(AuditEvent).not_to receive(:success)
authenticate rescue nil
end
Expand All @@ -146,16 +146,16 @@ def authenticate
end

it "records two successful audit entries" do
expect(AuditEvent).to receive(:success).with(
:event => 'authenticate_database',
:userid => 'vincent',
:message => "User vincent successfully validated by EVM",
)
expect(AuditEvent).to receive(:success).with(
:event => 'authenticate_database',
:userid => 'vincent',
:message => "Authentication successful for user vincent",
)
expect(AuditEvent).to receive(:success).with({
:event => 'authenticate_database',
:userid => 'vincent',
:message => "User vincent successfully validated by EVM",
})
expect(AuditEvent).to receive(:success).with({
:event => 'authenticate_database',
:userid => 'vincent',
:message => "Authentication successful for user vincent",
})
expect(AuditEvent).not_to receive(:failure)
authenticate
end
Expand Down
Loading