Skip to content

Commit

Permalink
Merge branch 'master' into add_user_provides_to_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
digitaltom authored Feb 12, 2024
2 parents 4028a04 + e4ee2f3 commit 59fdebd
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ Style/FormatStringToken:

Style/OpenStructUse:
Enabled: false

RSpec/MessageChain:
Enabled: false
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM opensuse/leap:15.3

RUN zypper --non-interactive install --no-recommends \
timezone wget gcc-c++ libffi-devel git-core zlib-devel \
libxml2-devel libxslt-devel cron libmariadb-devel mariadb-client \
libxml2-devel libxslt-devel cron libmariadb-devel mariadb-client sqlite3-devel \
vim ruby2.5 ruby2.5-devel ruby2.5-rubygem-bundler SUSEConnect && \
zypper --non-interactive install -t pattern devel_basis && \
update-alternatives --install /usr/bin/bundle bundle /usr/bin/bundle.ruby2.5 5 && \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Please view our [guide](docs/installation.md) to assist you in the RMT installat

1. Install the system dependencies:
```
sudo zypper in libxml2-devel libxslt-devel libmariadb-devel gcc
sudo zypper in libxml2-devel libxslt-devel libmariadb-devel sqlite3-devel gcc
```
2. Install the ruby version specified in the `.ruby-version` [file](.ruby-version).
3. Install and setup the database:
Expand Down
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_08_14_105634) do
ActiveRecord::Schema.define(version: 2024_01_29_140413) do

create_table "activations", charset: "utf8", force: :cascade do |t|
t.bigint "service_id", null: false
Expand Down
5 changes: 4 additions & 1 deletion lib/rmt/lockfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ class RMT::Lockfile

class << self
def lock(lock_name = nil)
yield and return if ActiveRecord::Base.connection.adapter_name != 'Mysql2'
if ActiveRecord::Base.connection.adapter_name != 'Mysql2'
yield
return
end

lock_name = ['rmt-cli', lock_name].compact.join('-')

Expand Down
7 changes: 7 additions & 0 deletions spec/lib/rmt/lockfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,12 @@
)
end
end

context 'with sqlite backend' do
it 'yields block' do
allow(ActiveRecord::Base).to receive_message_chain(:connection, :adapter_name).and_return('sqlite3')
expect(lock).to eq nil
end
end
end
end
2 changes: 0 additions & 2 deletions spec/lib/suse/connect/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
end
end

# rubocop:disable RSpec/MessageChain
describe '#connect_api' do
subject(:method_call) { api_client.send(:connect_api) }

Expand Down Expand Up @@ -77,7 +76,6 @@
end
end
end
# rubocop:enable RSpec/MessageChain

context 'api requests' do
before do
Expand Down
4 changes: 4 additions & 0 deletions spec/support/cli_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ def silence_stdout
def file_human_size(size_in_bytes)
ActiveSupport::NumberHelper.number_to_human_size(size_in_bytes)
end

def running_mysql
ActiveRecord::Base.connection.adapter_name == 'Mysql2'
end
2 changes: 1 addition & 1 deletion spec/support/shared_examples/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
end

shared_examples 'handles lockfile exception' do
context 'with existing lockfile' do
context 'with existing lockfile', if: running_mysql do
before do
allow(RMT::Lockfile).to receive(:obtain_lock).and_return(false)
end
Expand Down

0 comments on commit 59fdebd

Please sign in to comment.