]> cat aescling's git repositories - mastodon.git/commitdiff
Spec action verification of StreamEntryFinder (#3549)
authorAkihiko Odaki (@fn_aki@pawoo.net) <akihiko.odaki.4i@stu.hosei.ac.jp>
Sun, 4 Jun 2017 12:56:31 +0000 (21:56 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 4 Jun 2017 12:56:31 +0000 (14:56 +0200)
spec/lib/stream_entry_finder_spec.rb

index 88ba72b11518641f093b89dce651748d91342839..64e03c36af79d589c278f77d8da6bc69cc884465 100644 (file)
@@ -14,6 +14,14 @@ describe StreamEntryFinder do
       it 'finds the stream entry' do
         expect(subject.stream_entry).to eq(status.stream_entry)
       end
+
+      it 'raises an error if action is not :show' do
+        recognized = Rails.application.routes.recognize_path(url)
+        expect(recognized).to receive(:[]).with(:action).and_return(:create)
+        expect(Rails.application.routes).to receive(:recognize_path).with(url).and_return(recognized)
+
+        expect { subject.stream_entry }.to raise_error(ActiveRecord::RecordNotFound)
+      end
     end
 
     context 'with a stream entry url' do