Skip to content

Commit

Permalink
fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf committed Aug 8, 2023
1 parent 042ab05 commit 962058e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/models/identity_provider.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# frozen_string_literal: true

class IdentityProvider < ApplicationRecord
validates :name, presence: true
validates :provider, presence: true

mount_uploader :logo_image, LogoUploader

def parsed_options(rack_env = nil)
Expand Down
5 changes: 5 additions & 0 deletions spec/models/identity_provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
expect(subject).to be_valid
end

it 'is not valid without a name' do
subject.name = nil
expect(subject).not_to be_valid
end

it 'is not valid without a provider' do
subject.provider = nil
expect(subject).not_to be_valid
Expand Down
19 changes: 16 additions & 3 deletions spec/requests/single_signon_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@

RSpec.describe "SingleSignons", type: :request do
describe "GET single_signon#index" do
it "returns http success" do
get "/single_signon"
expect(response).to have_http_status(:success)
describe "with no IdentityProviders" do
it "redirects to sign in" do
get "/single_signon"
expect(response).to have_http_status(:redirect)
end
end

describe "with an IdentityProvider" do
before do
IdentityProvider.create(name: 'fake', provider: 'saml')
end

it "renders succes" do
get "/single_signon"
expect(response).to have_http_status(:success)
end
end
end
end

0 comments on commit 962058e

Please sign in to comment.