Sha256: 715b1e312f5c9f05f3a2b7a4c125c344827fd1925768d061aba740a082fe8f5d
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
require './test/test_helper' class ExtractionStrategyTest < ActiveSupport::TestCase test "execute is required for a strategy" do assert_raise(Exception) do VersionCake::ExtractionStrategy.new.execute("request") end end test "extract will convert the result to integer" do class TestStrategy < VersionCake::ExtractionStrategy def execute(request); "123"; end end assert_equal 123, TestStrategy.new.extract("request") end test "it can lookup a strategy" do strategy = VersionCake::ExtractionStrategy.lookup(:query_parameter) assert_equal VersionCake::QueryParameterStrategy, strategy.class end test "it creates a custom strategy for a proc" do strategy = VersionCake::ExtractionStrategy.lookup(lambda{|req|}) assert_equal VersionCake::CustomStrategy, strategy.class end test "it fails to create a custom strategy for a proc with no parameters" do assert_raise(Exception) do VersionCake::ExtractionStrategy.lookup(lambda{}) end end test "it raises error when no strategy is found" do assert_raise(Exception) do VersionCake::ExtractionStrategy.lookup(:fake_extraction) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
versioncake-2.1.0 | test/unit/strategies/extraction_strategy_test.rb |
versioncake-2.0.0 | test/unit/strategies/extraction_strategy_test.rb |