Sha256: a5dfb88447c82af976f3395e002df663087b08b31770994745f7fc8d8a01117d

Contents?: true

Size: 1.95 KB

Versions: 7

Compression:

Stored size: 1.95 KB

Contents

require 'spec_helper'
require 'minitest/rails/active_support'
require 'draper/test/minitest_integration'

describe "minitest-rails spec_type Lookup Integration" do
  context "ProductDecorator" do
    it "resolves constants" do
      klass = MiniTest::Spec.spec_type(ProductDecorator)
      klass.should == MiniTest::Rails::ActiveSupport::TestCase
    end

    it "resolves strings" do
      klass = MiniTest::Spec.spec_type("ProductDecorator")
      klass.should == MiniTest::Rails::ActiveSupport::TestCase
    end
  end

  context "WidgetDecorator" do
    it "resolves constants" do
      klass = MiniTest::Spec.spec_type(WidgetDecorator)
      klass.should == MiniTest::Rails::ActiveSupport::TestCase
    end

    it "resolves strings" do
      klass = MiniTest::Spec.spec_type("WidgetDecorator")
      klass.should == MiniTest::Rails::ActiveSupport::TestCase
    end
  end

  context "decorator strings" do
    it "resolves DoesNotExistDecorator" do
      klass = MiniTest::Spec.spec_type("DoesNotExistDecorator")
      klass.should == MiniTest::Rails::ActiveSupport::TestCase
    end

    it "resolves DoesNotExistDecoratorTest" do
      klass = MiniTest::Spec.spec_type("DoesNotExistDecoratorTest")
      klass.should == MiniTest::Rails::ActiveSupport::TestCase
    end

    it "resolves Does Not Exist Decorator" do
      klass = MiniTest::Spec.spec_type("Does Not Exist Decorator")
      klass.should == MiniTest::Rails::ActiveSupport::TestCase
    end

    it "resolves Does Not Exist Decorator Test" do
      klass = MiniTest::Spec.spec_type("Does Not Exist Decorator Test")
      klass.should == MiniTest::Rails::ActiveSupport::TestCase
    end
  end

  context "non-decorators" do
    it "doesn't resolve constants" do
      klass = MiniTest::Spec.spec_type(Draper::HelperSupport)
      klass.should == MiniTest::Spec
    end

    it "doesn't resolve strings" do
      klass = MiniTest::Spec.spec_type("Nothing to see here...")
      klass.should == MiniTest::Spec
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
draper-1.0.0.beta6 spec/minitest-rails/spec_type_spec.rb
draper-1.0.0.beta5 spec/minitest-rails/spec_type_spec.rb
draper-1.0.0.beta4 spec/minitest-rails/spec_type_spec.rb
draper-1.0.0.beta3 spec/minitest-rails/spec_type_spec.rb
draper-1.0.0.beta2 spec/minitest-rails/spec_type_spec.rb
draper-1.0.0.beta1 spec/minitest-rails/spec_type_spec.rb
draper-0.18.0 spec/minitest-rails/spec_type_spec.rb