Sha256: 8e6e7aa2df338c1628d4a735667bfcef6012fe86ed9e335657164b5849c3fded
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
require 'test_helper' class HelpersTest < Minitest::Test describe "Helper tests" do it "converts simple hash to array" do expected_array = ["xyz", "my_secret", "my template"].sort simple_hash = {'api_key'=> expected_array[0], 'secret'=> expected_array[1], 'template'=> expected_array[2]} converted_array = extract_param_values(simple_hash).sort assert_equal converted_array[0], expected_array[0] assert_equal converted_array[1], expected_array[1] assert_equal converted_array[2], expected_array[2] assert_equal converted_array.length, expected_array.length end it "converts nested hash to array" do nested_hash = {"name" => "Unix", "myvar" => [1111, 2], "api_key" => "363636avdsfdfd", "myvar2" => {"myvar3" => "hello", "myvar4" => ["hello", "world"]}} expected_array = ["Unix", "1111", "2", "363636avdsfdfd", "hello", "hello", "world"].sort converted_array = extract_param_values(nested_hash).sort assert((expected_array == converted_array)) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sailthru-client-4.0.1 | test/sailthru/helpers_test.rb |
sailthru-client-4.0.0 | test/sailthru/helpers_test.rb |
sailthru-client-3.0.0 | test/sailthru/helpers_test.rb |