spec/rack/jpmobile/emoticon_spec.rb in jpmobile-0.1.6 vs spec/rack/jpmobile/emoticon_spec.rb in jpmobile-1.0.0.pre
- old
+ new
@@ -2,10 +2,11 @@
require File.join(File.expand_path(File.dirname(__FILE__)), '../../rack_helper.rb')
describe "絵文字が" do
include Rack::Test::Methods
include Jpmobile::RackHelper
+ include Jpmobile::Util
before(:each) do
@docomo_cr = "";
@docomo_utf8 = [0xe63e].pack("U")
@docomo_docomopoint = ""
@@ -75,14 +76,11 @@
response = Jpmobile::Rack::MobileCarrier.new(Jpmobile::Rack::Filter.new(UnitApplication.new(@softbank_utf8))).call(@res)[2]
response_body(response).should == sjis("\xf8\x9f")
end
it "パラメータが変換されること" do
- query_string = "q=" + URI.encode(sjis("\xf8\x9f"))
- if query_string.respond_to?(:force_encoding)
- query_string.force_encoding("ASCII-8BIT")
- end
+ query_string = ascii_8bit("q=" + URI.encode(sjis("\xf8\x9f")))
res = Rack::MockRequest.env_for(
"/?#{query_string}",
"REQUEST_METHOD" => "GET",
'HTTP_USER_AGENT' => 'DoCoMo/2.0 SH906i(c100;TB;W24H16)',
@@ -125,13 +123,10 @@
response = Jpmobile::Rack::MobileCarrier.new(Jpmobile::Rack::Filter.new(UnitApplication.new(@softbank_utf8))).call(@res)[2]
response_body(response).should == sjis("\xf6\x60")
end
it "パラメータが変換されること" do
- query_string = "q=" + URI.encode(sjis("\xf6\x60"))
- if query_string.respond_to?(:force_encoding)
- query_string.force_encoding("ASCII-8BIT")
- end
+ query_string = ascii_8bit("q=" + URI.encode(sjis("\xf6\x60")))
res = Rack::MockRequest.env_for(
"/?#{query_string}",
"REQUEST_METHOD" => "GET",
'HTTP_USER_AGENT' => "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0",