about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
authorabcang <abcang1015@gmail.com>2017-07-05 21:54:21 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-07-05 14:54:21 +0200
commit5e6acf960183aea9440ce0d9e28c86f043e88c54 (patch)
tree145946d82afd2ee204e3bfc9e7dcb5d5069eb45f /spec/services
parentb52a5e6bd60be3f9548cf59eb313b1e6c2f5920e (diff)
Fix Nokogiri::HTML at FetchLinkCardService (#4072)
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/fetch_link_card_service_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/services/fetch_link_card_service_spec.rb b/spec/services/fetch_link_card_service_spec.rb
index 9df41cf55..7d7f8e748 100644
--- a/spec/services/fetch_link_card_service_spec.rb
+++ b/spec/services/fetch_link_card_service_spec.rb
@@ -6,6 +6,8 @@ RSpec.describe FetchLinkCardService do
   before do
     stub_request(:head, 'http://example.xn--fiqs8s/').to_return(status: 200, headers: { 'Content-Type' => 'text/html' })
     stub_request(:get, 'http://example.xn--fiqs8s/').to_return(request_fixture('idn.txt'))
+    stub_request(:head, 'http://example.com/sjis').to_return(status: 200, headers: { 'Content-Type' => 'text/html' })
+    stub_request(:get, 'http://example.com/sjis').to_return(request_fixture('sjis.txt'))
     stub_request(:head, 'https://github.com/qbi/WannaCry').to_return(status: 404)
 
     subject.call(status)
@@ -19,6 +21,14 @@ RSpec.describe FetchLinkCardService do
         expect(a_request(:get, 'http://example.xn--fiqs8s/')).to have_been_made.at_least_once
       end
     end
+
+    context do
+      let(:status) { Fabricate(:status, text: 'Check out http://example.com/sjis') }
+
+      it 'works with SJIS' do
+        expect(a_request(:get, 'http://example.com/sjis')).to have_been_made.at_least_once
+      end
+    end
   end
 
   context 'in a remote status' do