spec/integration/schema/inferrer/sqlite_spec.rb in rom-sql-1.0.1 vs spec/integration/schema/inferrer/sqlite_spec.rb in rom-sql-1.0.2

- old
+ new

@@ -1,38 +1,37 @@ RSpec.describe 'ROM::SQL::Schema::SqliteInferrer', :sqlite do include_context 'database setup' before do - conn.drop_table?(:test_inferrence) + inferrable_relations.concat %i(test_inferrence) + end + before do conn.create_table :test_inferrence do tinyint :tiny int8 :big + bigint :long column :dummy, nil + boolean :flag, null: false end end - after do - conn.drop_table?(:test_inferrence) - end - - let(:dataset) { :test_inferrence } - - let(:schema) { container.relations[dataset].schema } - before do - dataset = self.dataset - conf.relation(dataset) do - schema(dataset, infer: true) + conf.relation(:test_inferrence) do + schema(infer: true) end end - it 'can infer attributes for dataset' do - source = container.relations[:test_inferrence].name + let(:schema) { container.relations[:test_inferrence].schema } + let(:source) { container.relations[:test_inferrence].name } - expect(schema.to_h).to eql( - tiny: ROM::SQL::Types::Int.optional.meta(name: :tiny, source: source), - big: ROM::SQL::Types::Int.optional.meta(name: :big, source: source), - dummy: ROM::SQL::Types::SQLite::Object.optional.meta(name: :dummy, source: source) - ) + it 'can infer attributes for dataset' do + expect(schema.to_h). + to eql( + tiny: ROM::SQL::Types::Int.optional.meta(name: :tiny, source: source), + big: ROM::SQL::Types::Int.optional.meta(name: :big, source: source), + long: ROM::SQL::Types::Int.optional.meta(name: :long, source: source), + dummy: ROM::SQL::Types::SQLite::Object.optional.meta(name: :dummy, source: source), + flag: ROM::SQL::Types::Bool.meta(name: :flag, source: source) + ) end end