Test ApplicationsFinder !22296

This commit is contained in:
JB Vasseur 2018-10-18 09:33:46 +09:00
parent 1ae9aefe55
commit 84b69a95bb
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
# frozen_string_literal: true
require 'spec_helper'
describe ApplicationsFinder do
let(:application1) { create(:application, name: 'some_application', owner: nil, redirect_uri: 'http://some_application.url', scopes: '') }
let(:application2) { create(:application, name: 'another_application', owner: nil, redirect_uri: 'http://other_application.url', scopes: '') }
describe '#execute' do
it 'returns an array of applications' do
found = described_class.new.execute
expect(found).to match_array([application1,application2])
end
it 'returns the application by id' do
params = { id: application1.id }
found = described_class.new(params).execute
expect(found).to match(application1)
end
end
end