Sha256: a58d1e4b9ab33df6ac8a331b81cdfe466417e0e6d8c2ce69e1f0fec2e11ad79c

Contents?: true

Size: 993 Bytes

Versions: 16

Compression:

Stored size: 993 Bytes

Contents

require 'spec_helper'

module StandaloneMigrations

  describe "Callbacks" do

    describe ".on_loaded" do

      it "responds to on_loaded" do
        expect(StandaloneMigrations).to respond_to :on_loaded
      end

      it "responds to run_on_load_callbacks" do
        expect(StandaloneMigrations).to respond_to :run_on_load_callbacks
      end

      it "can pass a block do on_loaded" do
        callback_was_called = false

        StandaloneMigrations.on_loaded do
          callback_was_called = true
        end

        # invoke the callbacks
        StandaloneMigrations.run_on_load_callbacks

        expect(callback_was_called).to be true
      end

      it "can pass multiple blocks to on_loaded" do
        callback_count = 0

        for i in 1..4
          StandaloneMigrations.on_loaded do
            callback_count += 1
          end
        end

        StandaloneMigrations.run_on_load_callbacks

        expect(callback_count).to eq(4)
      end

    end

  end

end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
standalone_migrations-8.0.0 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-7.2.0 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-7.1.3 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-7.1.2 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-7.1.1 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations_sp-7.1.1 spec/standalone_migrations/callbacks_spec.rb
cairn-7.1.1 spec/standalone_migrations/callbacks_spec.rb
cairn-7.1.0 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-7.1.0 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-6.1.0 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-6.0.0 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-5.2.7 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-5.2.6 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-5.2.5 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-5.2.4 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-5.2.3 spec/standalone_migrations/callbacks_spec.rb