Skip to content

Commit

Permalink
chore: fix gh ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ssa-wtag committed Nov 18, 2024
1 parent 82e82cf commit cf942c3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
push:
branches: [ "*" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read
Expand Down
25 changes: 20 additions & 5 deletions spec/xapian_db/railtie_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../../lib/xapian_db/railtie.rb')

RSpec.describe 'test' do
class Railtie
def self.configure_from(env_config)
@database_path = env_config["database"] || ":memory:"
@adapter = env_config["adapter"] || :active_record
@writer = env_config["writer"] || :direct
@beanstalk_daemon_url = env_config["beanstalk_daemon"]
@resque_queue = env_config["resque_queue"]
@sidekiq_queue = env_config["sidekiq_queue"]
@language = env_config["language"]
@term_min_length = env_config["term_min_length"]
@enable_phrase_search = env_config["enable_phrase_search"] == true
@term_splitter_count = env_config["term_splitter_count"] || 0
@set_max_expansion = env_config["set_max_expansion"]
@sidekiq_retry = env_config["sidekiq_retry"]
end
end
let(:yaml_content_with_erb) do
<<-YAML
development:
Expand Down Expand Up @@ -32,9 +47,9 @@
YAML.safe_load(ERB.new(File.read(@config_file_path)).result, aliases: true)
end

XapianDb::Railtie.configure_from(db_config['development'])
Railtie.configure_from(db_config['development'])

expect(XapianDb::Railtie.instance_variable_get(:@adapter)).to eq('generic')
expect(Railtie.instance_variable_get(:@adapter)).to eq('generic')
end

it 'loads the xapian adapter based on direct value' do
Expand All @@ -44,9 +59,9 @@
YAML.safe_load(ERB.new(IO.read(@config_file_path)).result, aliases: true)
end

XapianDb::Railtie.configure_from(db_config['test'])
Railtie.configure_from(db_config['test'])

expect(XapianDb::Railtie.instance_variable_get(:@adapter)).to eq('xapian')
expect(Railtie.instance_variable_get(:@adapter)).to eq('xapian')
end
end
end

0 comments on commit cf942c3

Please sign in to comment.