Blob of spec/helpers/users_helper_spec.rb (raw blob data)

1 require File.dirname(__FILE__) + '/../spec_helper'
2
3 describe UsersHelper do
4 it "should encode email" do
5 message = %{
6 mail_to_encoded passes :replace_at and :replace_dot
7 values to mail_to (a rails helper), which should
8 obfuscate the email address, but it apparently does
9 NOT do that if :encode => 'javascript'
10
11 Need to investigate if this is a Rails bug and
12 either fix it there or let go of obfuscation.
13 }
14 pending(message) do
15 email = "aAT@NOSPAM@bDOTcom"
16 encoded = (0...email.length).inject("") do |result, index|
17 result << sprintf("%%%x",email[index])
18 end
19 helper.encoded_mail_to("a@b.com").should match(/#{encoded}/)
20 end
21 end
22 end