summaryrefslogtreecommitdiff
path: root/spec/finders/applications_finder_spec.rb
blob: 14d6b35cc276d3a3b3772ad4f08963ccdca1e44d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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