Sha256: 0cfaaf4e8ee8f2411e993eb2f68d0fc5f61f9e6a147810f9b42a726a07b142a5

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

require_relative "base_model_test"

class AplIdPrefixBuilderTest < BaseModelTest
  include AplIdPrefixBuilder
  
  context "get_apl_entity_prefix" do
    should "return default prefix for empty hash" do
      params = {}
      assert_equal Time.now().strftime('%Y%m%d'), get_apl_entity_prefix(params)
    end

    should "return default prefix for when type acronym is passed" do
      params = {:type_acronym => "ci"}
      assert_equal "ci" + Time.now().strftime('%Y%m%d'), get_apl_entity_prefix(params)
    end

    should "return default prefix for when type acronym and bu id is passed" do
      params = {:type_acronym => "ci", :bu_id => "test_bu"}
      assert_equal "test_bu" + "ci" + Time.now().strftime('%Y%m%d'), get_apl_entity_prefix(params)
    end

    should "return default prefix for when type acronym and bu id and date is passed" do
      time = Date.today - 3.day
      params = {:type_acronym => "ci", :bu_id => "test_bu", :time => time}
      assert_equal "test_bu" + "ci" + time.strftime('%Y%m%d'), get_apl_entity_prefix(params)
    end

    should "return default prefix for when type acronym and bu id and time and time format is passed" do
      time = Date.today - 3.day
      time_format = "%m%d"
      params = {:type_acronym => "ci", :bu_id => "test_bu", :time => time, :time_format => time_format}
      assert_equal "test_bu" + "ci" + time.strftime(time_format), get_apl_entity_prefix(params)
    end
  end

end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
apl-library-0.0.90 test/unit/apl_id_prefix_builder_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/test/unit/apl_id_prefix_builder_test.rb