Sha256: 200a85f6a0b5309427f0142ab045619f7f63906e3a6f1aadd7a2d858decde1e8

Contents?: true

Size: 975 Bytes

Versions: 9

Compression:

Stored size: 975 Bytes

Contents

require 'spec_helper'

module StandaloneMigrations

  describe "Callbacks" do

    describe ".on_loaded" do

      it "responds to on_loaded" do
        StandaloneMigrations.should respond_to :on_loaded
      end

      it "responds to run_on_load_callbacks" do
        StandaloneMigrations.should 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

        callback_was_called.should 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

        callback_count.should == 4
      end

    end

  end

end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
standalone_migrations-5.0.0 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-4.0.5 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-4.0.4 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-4.0.3 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-4.0.2 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-4.0.1 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-4.0.0 spec/standalone_migrations/callbacks_spec.rb
standalone_migrations-2.1.5 spec/standalone_migrations/callbacks_spec.rb
ejhayes_standalone_migrations-2.2.0 spec/standalone_migrations/callbacks_spec.rb