Sha256: 715fcdf0d11d45a0a329038826b142992955815c2f825c5e92645163df837c04
Contents?: true
Size: 1.73 KB
Versions: 1
Compression:
Stored size: 1.73 KB
Contents
require "spec_helper" require "fakefs/spec_helpers" describe SequelRails::Migrations do let!(:db) { ::Sequel::Model.db } [:migrate_up!, :migrate_down!].each do |migration_method| describe ".#{migration_method}" do let(:result) { mock :result } context "with no version specified" do let(:opts) { {} } it "runs migrations using Sequel::Migrator" do ::Sequel::Migrator.should_receive(:run).with( db, "db/migrate", opts ).and_return result described_class.send(migration_method).should be result end end context "with version specified" do let(:opts) { {target: 1} } it "runs migrations using Sequel::Migrator" do ::Sequel::Migrator.should_receive(:run).with( db, "db/migrate", opts ).and_return result described_class.send(migration_method, 1).should be result end end end end describe ".pending_migrations?" do include FakeFS::SpecHelpers let(:path) { "db/migrate" } it "returns false if no db/migrate directory exists" do described_class.pending_migrations?.should == false end context "when db/migrate directory exists" do before { FileUtils.mkdir_p path } it "returns true if any pending migration" do ::Sequel::Migrator.should_receive(:is_current?).with( db, "db/migrate" ).and_return false described_class.pending_migrations?.should == true end it "returns false if no pending migration" do ::Sequel::Migrator.should_receive(:is_current?).with( db, "db/migrate" ).and_return true described_class.pending_migrations?.should == false end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sequel-rails-0.4.0 | spec/lib/sequel_rails/migrations_spec.rb |