-
Notifications
You must be signed in to change notification settings - Fork 166
Add specs for ServiceProvider#live? #1161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,4 +94,40 @@ | |
| end | ||
| end | ||
| end | ||
|
|
||
| describe '#live?' do | ||
| context 'when the service provider is not approved' do | ||
| it 'returns false' do | ||
| sp = create(:service_provider, issuer: 'foo') | ||
|
|
||
| expect(sp.live?).to be false | ||
| end | ||
| end | ||
|
|
||
| context 'when the service provider is approved but not active' do | ||
| it 'returns false' do | ||
| sp = ServiceProvider.from_issuer('http://localhost:3000') | ||
| sp.update(active: false) | ||
|
|
||
| expect(sp.live?).to be false | ||
|
||
| end | ||
| end | ||
|
|
||
| context 'when the service provider is active and approved' do | ||
| it 'returns true' do | ||
| sp = ServiceProvider.from_issuer('http://localhost:3000') | ||
|
|
||
| expect(sp.live?).to be true | ||
| end | ||
| end | ||
|
|
||
| context 'when the service provider is active but not approved' do | ||
| it 'returns false' do | ||
| sp = ServiceProvider.from_issuer('http://localhost:3000') | ||
| sp.update(approved: false) | ||
|
|
||
| expect(sp.live?).to be false | ||
| end | ||
| end | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@monfresh what was the reason for making
approveda protected attribute here? I think this may have resulted in a bug where we can't create new approved SPs from the dashboard appThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zachmargolis is correct -- the
approvedflag should be a pass-through from the dashboard.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. I'm assuming the
approvedflag can only be set by admins on the dashboard, and that we prevent people from manually changing the form such that it submits theapprovedattribute?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes https://github.com/18F/identity-dashboard/blob/master/app/controllers/service_providers_controller.rb#L44
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR coming soon