about summary refs log tree commit diff
path: root/spec/lib
diff options
context:
space:
mode:
authorAkihiko Odaki (@fn_aki@pawoo.net) <akihiko.odaki.4i@stu.hosei.ac.jp>2017-06-04 21:56:31 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-06-04 14:56:31 +0200
commit00e61d6807acad2a09dfceb1b9441848ffbcbbfd (patch)
tree1f04fa369fdc544c6e5490ed59cd27ea0181e033 /spec/lib
parent19084d3c6cb435ca669ea06daf29c213ebdc149c (diff)
Spec action verification of StreamEntryFinder (#3549)
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/stream_entry_finder_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/lib/stream_entry_finder_spec.rb b/spec/lib/stream_entry_finder_spec.rb
index 88ba72b11..64e03c36a 100644
--- a/spec/lib/stream_entry_finder_spec.rb
+++ b/spec/lib/stream_entry_finder_spec.rb
@@ -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