Sha256: 589504f18375e431cec7f9e1ffd0b36ebe20703b02ec77b878c8e0c7786cc24c

Contents?: true

Size: 1.12 KB

Versions: 27

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe RSpec::Rails::SetupAndTeardownAdapter do
  describe "::setup" do
    it "registers before hooks in the order setup is received" do
      klass = Class.new do
        include RSpec::Rails::SetupAndTeardownAdapter
        def self.foo; "foo"; end
        def self.bar; "bar"; end
      end
      klass.should_receive(:before).ordered { |&block| block.call.should eq "foo" }
      klass.should_receive(:before).ordered { |&block| block.call.should eq "bar" }

      klass.setup :foo
      klass.setup :bar
    end

    it "registers prepend_before hooks for the Rails' setup methods" do
      klass = Class.new do
        include RSpec::Rails::SetupAndTeardownAdapter
        def self.setup_fixtures; "setup fixtures"  end
        def self.setup_controller_request_and_response; "setup controller"  end
      end

      klass.should_receive(:prepend_before) { |&block| block.call.should eq "setup fixtures" }
      klass.should_receive(:prepend_before) { |&block| block.call.should eq "setup controller" }

      klass.setup :setup_fixtures
      klass.setup :setup_controller_request_and_response
    end
  end
end

Version data entries

27 entries across 22 versions & 5 rubygems

Version Path
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-rails-2.13.0/spec/rspec/rails/setup_and_teardown_adapter_spec.rb
rspec-rails-2.14.1 spec/rspec/rails/setup_and_teardown_adapter_spec.rb
rspec-rails-3.0.0.beta1 spec/rspec/rails/setup_and_teardown_adapter_spec.rb
rspec-rails-2.99.0.beta1 spec/rspec/rails/setup_and_teardown_adapter_spec.rb
rspec-rails-2.14.0 spec/rspec/rails/setup_and_teardown_adapter_spec.rb
rspec-rails-2.13.1 spec/rspec/rails/setup_and_teardown_adapter_spec.rb
rspec-rails-2.13.0 spec/rspec/rails/setup_and_teardown_adapter_spec.rb
rspec-rails-2.12.2 spec/rspec/rails/setup_and_teardown_adapter_spec.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/setup_and_teardown_adapter_spec.rb
rspec-rails-2.12.1 spec/rspec/rails/setup_and_teardown_adapter_spec.rb
rspec-rails-2.12.0 spec/rspec/rails/setup_and_teardown_adapter_spec.rb
rspec-rails-2.11.4 spec/rspec/rails/setup_and_teardown_adapter_spec.rb
gem_repackager-0.1.0 support/gems/rspec-rails-2.11.0/spec/rspec/rails/setup_and_teardown_adapter_spec.rb
rspec-rails-2.11.0 spec/rspec/rails/setup_and_teardown_adapter_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/setup_and_teardown_adapter_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/setup_and_teardown_adapter_spec.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/setup_and_teardown_adapter_spec.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/setup_and_teardown_adapter_spec.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/setup_and_teardown_adapter_spec.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.10.1/spec/rspec/rails/setup_and_teardown_adapter_spec.rb