Sha256: cc35e55906a99e122370d05bcf00b82a5b0bd059ec1471b946d2586f545cb1b6

Contents?: true

Size: 923 Bytes

Versions: 45

Compression:

Stored size: 923 Bytes

Contents

require_relative "spec_helper"

describe "freeze_datasets extension" do
  before do
    @db = Sequel.mock.extension(:freeze_datasets)
  end

  it "should freeze datasets by default" do
    @db.dataset.frozen?.must_equal true
    @db.fetch('SQL').frozen?.must_equal true
    @db.from(:table).frozen?.must_equal true
    @db[:table].frozen?.must_equal true
  end

  it "should have dataset#dup return frozen dataset" do
    @db.dataset.dup.frozen?.must_equal true
  end

  it "should cache Database#from calls with single symbol tables" do
    @db.from(:foo).must_be_same_as @db.from(:foo)
    @db.from(Sequel[:foo]).wont_be_same_as @db.from(Sequel[:foo])
  end

  it "should clear Database#from cache when modifying the schema" do
    ds = @db.from(:foo)
    ds.columns(:foo, :bar)
    @db[:foo].columns.must_equal [:foo, :bar]
    @db.create_table!(:foo){Integer :x}
    @db[:foo].columns.wont_equal [:foo, :bar]
  end
end

Version data entries

45 entries across 41 versions & 2 rubygems

Version Path
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/sequel-5.26.0/spec/extensions/freeze_datasets_spec.rb
tdiary-5.1.1 vendor/bundle/ruby/2.7.0/gems/sequel-5.29.0/spec/extensions/freeze_datasets_spec.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/sequel-5.26.0/spec/extensions/freeze_datasets_spec.rb
sequel-5.29.0 spec/extensions/freeze_datasets_spec.rb
sequel-5.28.0 spec/extensions/freeze_datasets_spec.rb
sequel-5.27.0 spec/extensions/freeze_datasets_spec.rb
tdiary-5.1.0 vendor/bundle/gems/sequel-5.26.0/spec/extensions/freeze_datasets_spec.rb
sequel-5.26.0 spec/extensions/freeze_datasets_spec.rb
sequel-5.25.0 spec/extensions/freeze_datasets_spec.rb
sequel-5.24.0 spec/extensions/freeze_datasets_spec.rb
sequel-5.23.0 spec/extensions/freeze_datasets_spec.rb
sequel-5.22.0 spec/extensions/freeze_datasets_spec.rb
sequel-5.21.0 spec/extensions/freeze_datasets_spec.rb
sequel-5.20.0 spec/extensions/freeze_datasets_spec.rb
tdiary-5.0.13 vendor/bundle/gems/sequel-5.18.0/spec/extensions/freeze_datasets_spec.rb
sequel-5.19.0 spec/extensions/freeze_datasets_spec.rb
tdiary-5.0.12.1 vendor/bundle/gems/sequel-5.18.0/spec/extensions/freeze_datasets_spec.rb
sequel-5.18.0 spec/extensions/freeze_datasets_spec.rb
sequel-5.17.0 spec/extensions/freeze_datasets_spec.rb
sequel-5.16.0 spec/extensions/freeze_datasets_spec.rb