Sha256: 79d30dcf0a05c0fbce88b7289267962ebee8b8da38a20588689ff76436686ece
Contents?: true
Size: 1.65 KB
Versions: 2
Compression:
Stored size: 1.65 KB
Contents
RSpec.shared_context :sequel do def mysql_uri database=nil database ||= mysql_database1 if defined?(JRUBY_VERSION) "jdbc:mysql://localhost/#{database}?user=#{mysql_username}&useSSL=false" else "mysql2://#{mysql_username}:@localhost/#{database}" end end def sqlite_uri file_name "#{defined?(JRUBY_VERSION) && 'jdbc:'}sqlite://" + File.join(tempdir, file_name) end def postgres_options database=nil database ||= postgres_database1 if defined?(JRUBY_VERSION) {db: "jdbc:postgresql://localhost/#{database}?user=#{postgres_username}"} else { db: "postgres://localhost/#{database}", user: postgres_username } end end def postgres_hstore_options database=nil postgres_options(database).merge \ table: 'hstore_table1', hstore: 'row' end def h2_uri "jdbc:h2:" + tempdir end end RSpec.shared_examples :adapter_sequel do |specs, optimize: true| shared_examples :each_key_server do context "with each_key server" do let(:opts) do base_opts.merge( servers: {each_key: {}}, each_key_server: :each_key ) end moneta_specs specs end context "without each_key server" do let(:opts) { base_opts } moneta_specs specs end end if optimize context 'with backend optimizations' do let(:base_opts) { {table: "adapter_sequel"} } include_examples :each_key_server end end context 'without backend optimizations' do let(:base_opts) do { table: "adapter_sequel", optimize: false } end include_examples :each_key_server end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
moneta-1.4.1 | spec/moneta/adapters/sequel/helper.rb |
moneta-1.4.0 | spec/moneta/adapters/sequel/helper.rb |