Sha256: 12e92ce4a930b1e47e58fe811352493906641aec557e9620df6f96f7f3eef470

Contents?: true

Size: 951 Bytes

Versions: 64

Compression:

Stored size: 951 Bytes

Contents

require File.join(File.dirname(__FILE__), "..", "test_helper")
require 'mocha/pretty_parameters'

class PrettyParametersTest < Test::Unit::TestCase
  
  include Mocha

  def test_should_remove_outer_array_braces
    params = [1, 2, [3, 4]]
    parameters = PrettyParameters.new(params)
    assert_equal '1, 2, [3, 4]', parameters.pretty
  end
  
  def test_should_display_numeric_arguments_as_is
    params = [1, 2, 3]
    parameters = PrettyParameters.new(params)
    assert_equal '1, 2, 3', parameters.pretty
  end
  
  def test_should_remove_curly_braces_if_hash_is_only_argument
    params = [{:a => 1, :z => 2}]
    parameters = PrettyParameters.new(params)
    assert_match /^:[az] => [12], :[az] => [12]$/, parameters.pretty
  end
  
  def test_should_not_remove_curly_braces_if_hash_is_not_the_only_argument
    params = [1, {:a => 1}]
    parameters = PrettyParameters.new(params)
    assert_equal '1, {:a => 1}', parameters.pretty
  end

end

Version data entries

64 entries across 64 versions & 5 rubygems

Version Path
mocha-0.5.1 test/unit/pretty_parameters_test.rb
mocha-0.5.2 test/unit/pretty_parameters_test.rb
mocha-0.5.3 test/unit/pretty_parameters_test.rb
mocha-0.5.4 test/unit/pretty_parameters_test.rb