Add tests for `StaticController#linkfilter`

This commit is contained in:
Andreas Nedbal 2021-12-30 20:12:23 +01:00 committed by Andreas Nedbal
parent 5eb297136b
commit bc65b42b02
1 changed files with 20 additions and 0 deletions

View File

@ -18,4 +18,24 @@ describe StaticController, type: :controller do
expect(assigns(:users)).to eq(1) expect(assigns(:users)).to eq(1)
end end
end end
describe "#linkfilter" do
context "called without an url" do
subject { get :linkfilter }
it 'should redirect to the root page' do
subject
expect(response).to redirect_to(root_path)
end
end
context "called with an url" do
subject { get :linkfilter, params: { url: 'https://google.com' } }
it 'should show the passed url' do
subject
expect(assigns(:link)).to eq('https://google.com')
end
end
end
end end