Namespace
Methods
A
S
T
Instance Public methods
assert_not_verified(message)
# File activesupport/test/message_verifier_test.rb, line 59
def assert_not_verified(message)
  assert_raise(ActiveSupport::MessageVerifier::InvalidSignature) do
    @verifier.verify(message)
  end
end
setup()
# File activesupport/test/message_verifier_test.rb, line 25
def setup
  @verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!")
  @data = { :some => "data", :now => Time.local(2010) }
end
test_alternative_serialization_method()
# File activesupport/test/message_verifier_test.rb, line 47
def test_alternative_serialization_method
  verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!", :serializer => JSONSerializer.new)
  message = verifier.generate({ :foo => 123, 'bar' => Time.utc(2010) })
  assert_equal verifier.verify(message), { "foo" => 123, "bar" => "2010-01-01T00:00:00Z" }
end
test_digest_algorithm_as_second_parameter_deprecation()
# File activesupport/test/message_verifier_test.rb, line 53
def test_digest_algorithm_as_second_parameter_deprecation
  assert_deprecated(/options hash/) do
    ActiveSupport::MessageVerifier.new("secret", "SHA1")
  end
end
test_missing_signature_raises()
# File activesupport/test/message_verifier_test.rb, line 35
def test_missing_signature_raises
  assert_not_verified(nil)
  assert_not_verified("")
end
test_simple_round_tripping()
# File activesupport/test/message_verifier_test.rb, line 30
def test_simple_round_tripping
  message = @verifier.generate(@data)
  assert_equal @data, @verifier.verify(message)
end
test_tampered_data_raises()
# File activesupport/test/message_verifier_test.rb, line 40
def test_tampered_data_raises
  data, hash = @verifier.generate(@data).split("--")
  assert_not_verified("#{data.reverse}--#{hash}")
  assert_not_verified("#{data}--#{hash.reverse}")
  assert_not_verified("purejunk")
end