mirror of https://github.com/mastodon/mastodon
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.2 KiB
Ruby
54 lines
1.2 KiB
Ruby
3 years ago
|
# frozen_string_literal: true
|
||
|
|
||
7 years ago
|
require 'rails_helper'
|
||
|
|
||
5 months ago
|
RSpec.describe 'Intents' do
|
||
7 years ago
|
let(:user) { Fabricate(:user) }
|
||
3 years ago
|
|
||
7 years ago
|
before { sign_in user, scope: :user }
|
||
|
|
||
5 months ago
|
describe 'GET /intent' do
|
||
|
subject { response }
|
||
|
|
||
|
before { get intent_path(uri: uri) }
|
||
7 years ago
|
|
||
|
context 'when schema is web+mastodon' do
|
||
|
context 'when host is follow' do
|
||
|
let(:uri) { 'web+mastodon://follow?uri=test' }
|
||
|
|
||
7 years ago
|
it { is_expected.to redirect_to authorize_interaction_path(uri: 'test') }
|
||
7 years ago
|
end
|
||
|
|
||
|
context 'when host is share' do
|
||
|
let(:uri) { 'web+mastodon://share?text=test' }
|
||
|
|
||
|
it { is_expected.to redirect_to share_path(text: 'test') }
|
||
|
end
|
||
|
|
||
|
context 'when host is none of the above' do
|
||
|
let(:uri) { 'web+mastodon://test' }
|
||
|
|
||
|
it { is_expected.to have_http_status 404 }
|
||
|
end
|
||
|
end
|
||
|
|
||
|
context 'when schema is not web+mastodon' do
|
||
|
let(:uri) { 'api+mastodon://test.com' }
|
||
|
|
||
|
it { is_expected.to have_http_status 404 }
|
||
|
end
|
||
|
|
||
|
context 'when uri param is blank' do
|
||
|
let(:uri) { '' }
|
||
|
|
||
|
it { is_expected.to have_http_status 404 }
|
||
|
end
|
||
|
|
||
|
context 'when uri is invalid' do
|
||
|
let(:uri) { 'invalid uri://test.com' }
|
||
|
|
||
|
it { is_expected.to have_http_status 404 }
|
||
|
end
|
||
|
end
|
||
|
end
|