This repository has been archived by the owner on Jul 30, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
15 changed files
with
119 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class ClientAccountQuery | ||
attr_reader :relation | ||
|
||
def initialize(relation = ClientAccount.all) | ||
@relation = relation | ||
end | ||
|
||
def active | ||
relation.where(active: true) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddActiveToClientAccount < ActiveRecord::Migration | ||
def change | ||
add_column :client_accounts, :active, :boolean | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
Given(/^there is a client account to bill to$/) do | ||
@billable = FactoryGirl.create(:client_account) | ||
@billable = FactoryGirl.create(:client_account, live: true) | ||
end | ||
|
||
Given(/^there is a non\-live client account$/) do | ||
@non_live = FactoryGirl.create(:client_account, live: false) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
FactoryGirl.define do | ||
factory :client_account do | ||
name 'Client project' | ||
name { "#{Faker::Company.profession.capitalize} Pension Benefit Guaranty Corporation" } | ||
billable true | ||
tock_id 123 | ||
sequence(:tock_id) {|n| n} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'rails_helper' | ||
|
||
describe ClientAccountQuery do | ||
describe '#active' do | ||
it 'only returns active client accounts' do | ||
active = create(:client_account, active: true) | ||
_not_active = create(:client_account, active: false) | ||
|
||
client_accounts = ClientAccountQuery.new.active | ||
|
||
expect(client_accounts.length).to eq(1) | ||
expect(client_accounts.first.id).to eq(active.id) | ||
expect(client_accounts.first).to be_active | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,37 @@ | ||
{"count": 3, "next": null, "previous": null, "results": [ { "id": 120, "client":"General Services Administration - 18F (Non-Billable)", "name":"18F Branding", "description":"Working on branding for 18F—internal branding", "billable":false }, { "id":97, "client":"General Services Administration - 18F (Non-Billable)", "name":"18F EDU", "description":"Self-directed training materials and proctored workshops to develop the skill sets of 18F and our partners", "billable":false }, { "id":96, "client":"General Services Administration - 18F (Non-Billable)", "name":"18F Guides", "description":" Aims to disseminate software development and bureaucracy-hacking best practices across 18F and for our partners' digital service teams", "billable":false } ] } | ||
{ | ||
"count": 3, | ||
"next": null, | ||
"previous": null, | ||
"results": [ | ||
{ | ||
"id": 120, | ||
"client": "General Services Administration - 18F (Non-Billable)", | ||
"name": "18F Branding", | ||
"description": "Working on branding for 18F\u00e2\u20ac\u201dinternal branding", | ||
"billable": false, | ||
"start_date": null, | ||
"end_date": null, | ||
"active": true | ||
}, | ||
{ | ||
"id": 97, | ||
"client": "General Services Administration - 18F (Non-Billable)", | ||
"name": "18F EDU", | ||
"description": "Self-directed training materials and proctored workshops to develop the skill sets of 18F and our partners", | ||
"billable": false, | ||
"start_date": null, | ||
"end_date": null, | ||
"active": true | ||
}, | ||
{ | ||
"id": 96, | ||
"client": "General Services Administration - 18F (Non-Billable)", | ||
"name": "18F Guides", | ||
"description": " Aims to disseminate software development and bureaucracy-hacking best practices across 18F and for our partners' digital service teams", | ||
"billable": false, | ||
"start_date": null, | ||
"end_date": null, | ||
"active": false | ||
} | ||
] | ||
} |