repo_name
stringlengths 6
97
| path
stringlengths 3
341
| text
stringlengths 8
1.02M
|
|---|---|---|
ipublic/marketplace
|
app/models/dispatcher/tasks/notice_task.rb
|
class Dispatcher::Tasks::NoticeTask
include Mongoid::Document
end
|
ipublic/marketplace
|
spec/models/timespans/month_timespan_spec.rb
|
require 'rails_helper'
RSpec.describe Timespans::MonthTimespan, type: :model, dbclean: :after_each do
let(:year) { Date.today.year }
let(:month) { 6 }
let(:abbrev_month) { Date::ABBR_MONTHNAMES[month] }
let(:month_too_large) { 13 }
let(:month_too_small) { 0 }
let(:calendar_year_timespan) { FactoryBot.build(:timespans_calendar_year_timespan) }
let(:params) do
{
calendar_year_timespan: calendar_year_timespan,
year: year,
month: month,
}
end
describe "A new model instance" do
it { is_expected.to be_mongoid_document }
it { is_expected.to have_timestamps }
it { is_expected.to have_fields(:year, :month)}
context "with no arguments" do
subject { described_class.new }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
end
end
context "with no year" do
subject { described_class.new(params.except(:year)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:year].first).to match(/can't be blank/)
end
end
context "with no month" do
subject { described_class.new(params.except(:month)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:month].first).to match(/can't be blank/)
end
end
# context "with invalid month values" do
# subject { described_class.new(year: year, month: month_too_large) }
# it "should not be valid" do
# subject.validate
# expect(subject).to_not be_valid
# expect(subject.errors[:month]).to_not be_nil
# expect(subject.errors[:year]).to be_blank
# end
# subject { described_class.new(year: year, month: month_too_small) }
# it "should not be valid" do
# subject.validate
# expect(subject).to_not be_valid
# expect(subject.errors[:month]).to_not be_nil
# expect(subject.errors[:year]).to be_blank
# end
# end
context "with all required arguments" do
subject {described_class.new(params) }
it "should be valid" do
subject.validate
expect(subject).to be_valid
end
it "should compose a correct title" do
subject.validate
expect(subject.title).to eq "#{year} #{abbrev_month}"
end
context "and it is saved" do
it "should save" do
expect(subject.save).to eq true
end
context "it should be findable" do
before { subject.save! }
it "should return the instance" do
expect(described_class.find(subject.id.to_s)).to eq subject
end
end
end
end
end
end
|
ipublic/marketplace
|
spec/factories/parties_party_role_kinds.rb
|
<filename>spec/factories/parties_party_role_kinds.rb
FactoryBot.define do
factory :parties_party_role_kind, class: 'Parties::PartyRoleKind' do
end
end
|
ipublic/marketplace
|
app/models/integrations/register_employer.rb
|
class Integrations::RegisterEmployer
include Mongoid::Document
end
|
ipublic/marketplace
|
spec/factories/dispatcher_activities_group_update_activities.rb
|
<reponame>ipublic/marketplace
FactoryBot.define do
factory :dispatcher_activities_group_update_activity, class: 'Dispatcher::Activities::GroupUpdateActivity' do
end
end
|
ipublic/marketplace
|
app/models/fees/fee.rb
|
class Fees::Fee
include Mongoid::Document
end
|
ipublic/marketplace
|
app/models/products/individual_dental_insurance.rb
|
<filename>app/models/products/individual_dental_insurance.rb
class Products::IndividualDentalInsurance
include Mongoid::Document
end
|
ipublic/marketplace
|
app/models/parties/party.rb
|
<filename>app/models/parties/party.rb
module Parties
class Party
include Mongoid::Document
include Mongoid::Timestamps
field :party_id, type: Integer
field :registered_on, type: Date, default: ->{ TimeKeeper.date_of_record }
field :profile_source, type: Symbol, default: :self_serve
field :contact_method, type: Symbol, default: :only_electronic_communications
has_many :party_roles,
as: :role_castable,
class_name: "Parties::PartyRole"
embeds_many :documents, as: :documentable,
class_name: '::Document'
has_one :party_ledger,
class_name: "FinancialAccounts::PartyLedger"
has_many :party_ledger_account_balances,
class_name: "FinancialAccounts::PartyLedgerAccountBalance"
has_many :determinations,
class_name: "Determinations::Determination"
has_many :cases,
class_name: "Cases::Case"
has_many :notices,
class_name: "Notices::Notice"
embeds_many :addresses, as: :addressable, class_name: 'Address'
# embeds_many :phones, as: :phonable
# embeds_many :emails, as: :emailable
scope :associated_parties, ->{ where("party_roles.related_party_id": _id) }
scope :ui_group_sponsors, ->{ any_in(party_roles: [:unemployment_insurance_group_sponsor])}
scope :ui_tpas, ->{ any_in(party_roles: [:unemployment_insurance_tpa]) } # need to check end_date for active
scope :ui_tpa_agents, ->{ any_in(party_roles: [:unemployment_insurance_tpa_agent]) } # need to check end_date for active
scope :pfl_group_sponsors, ->{ any_in(party_roles: [:paid_family_leave_group_sponsor])}
scope :pfl_tpas, ->{ any_in(party_roles: [:paid_family_leave_tpa]) } # need to check end_date for active
scope :pfl_tpa_agents, ->{ any_in(party_roles: [:paid_family_leave_tpa_agent]) } # need to check end_date for active
scope :active_on, ->(compare_date){ where(:begin_on.lte => date, :end_on.gte => date) unless date.blank? }
scope :clients_for_tpa, ->(third_party_administrator){}
scope :employees_for_employer, ->(employer){}
index({ party_id: 1 })
index({"party_roles.party_role_kind_id": 1})
index({"party_roles.related_party_id": 1}, {sparse: true})
# TODO -- Protect from duplicate active keys
def add_party_role(role_kind_key)
party_role.build(role_kind_Key)
party_roles << new_role
party_roles
end
def active_party_role_keys
party_roles.reduce([]) { |active_list, role| active_list << role.key if role.is_active? }
end
def active_party_roles_by_key(role_key)
party_roles_by_key(role_key).reduce([]) { |active_list, role| active_list << role if role.is_active? }
end
# Find roles that match passed key
def party_roles_by_key(role_key)
party_roles.select { |party_role| party_role if party_role.key == role_key }
end
def active_party_roles_for(compare_role)
party_roles_for(compare_role).reduce([]) { |list, role| list << role if role.is_active? }
end
# Find both declaritive roles and roles with specific relationships
def party_roles_for(compare_role)
party_roles.select { |party_role| party_role if party_role == compare_role }
end
def has_relationship?(relationship_kind)
party_relationships.include?(relationship_kind)
end
def end_party_role(ended_role)
party_roles
end
def terminate_party_role(role_kind, end_date=Date.today)
end
def active_party_roles_by_kind(role_kind)
party_roles_by_kind(role_kind).reduce([]) { |list, role| list << role.kind if role.is_active? }
end
def party_roles_by_kind(role_kind)
party_roles.reduce([]) { |list, role| list << role.kind if role == role_kind }
end
def add_party_relationship(new_relationship)
party_relationships << new_relationship
end
def drop_party_relationship(dropped_relationship)
party_relationships
end
# Universal Roles a Party can assume
def self.all_party_roles
[]
end
end
end
|
ipublic/marketplace
|
app/models/determinations/ui_contribution_rate_determination.rb
|
<gh_stars>0
class Determinations::UiContributionRateDetermination
include Mongoid::Document
embedded_in :party,
class_name: "Parties::Party"
field :tax_rate, type: Float, default: 0.0
field :administration_fee, type: Float, default: 0.0
field :initial_tax_rate, type: Float, default: 0.0
field :variable_adjustment_factor, type: Float, default: 0.0
field :reserve_account_starting_balance, type: BigDecimal, default: 0.0
field :contribution_amount, type: BigDecimal, default: 0.0
field :interest_earned_amount, type: BigDecimal, default: 0.0
field :reserve_account_ending_balance, type: BigDecimal, default: 0.0
belongs_to :timespan,
class_name: 'Timespans::Timespan'
# Algorithm based on FL formula
def initialize(benefit_sponsor, next_calendar_year_period, determination_timespan = 3.years)
final_adjustment_factor = -0.0001
variable_adjustment_factor = next_calendar_year_period.adjustment_factor
calendar_year_period_id = next_calendar_year_period._id
administration_fee = next_calendar_year_period.administration_fee
initial_tax_rate = next_calendar_year_period.initial_tax_rate
maximum_tax_rate = next_calendar_year_period.maximum_tax_rate
tax_rate = [raw_tax_rate, maximum_tax_rate].min
reserve_account_starting_balance = benefit_sponsor.reserve_balance_on(prior_year_period.start_on - 1.day)
contribution_amount = benefit_sponsor.net_contribution_amount_for(prior_year_period)
interest_earned_amount = benefit_sponsor.interest_income_for(prior_year_period)
reserve_account_ending_balance = previous_reserve + interest_earned + benefit_contributions - benefits_charged
end
def raw_tax_rate
[benefit_ratio + variable_adjustment_factor + final_adjustment_factor, initial_tax_rate].max
end
def determination_period
(next_calendar_year_period.start_on - determination_timespan)..(next_calendar_year_period.start_on - 1.day)
end
def prior_year_period
(next_calendar_year_period.start_on - 1.year)..(next_calendar_year_period.start_on - 1.day)
end
def taxable_wages
benefit_sponsor.sum_taxable_wages_for(determination_period)
end
def benefit_charges
benefit_sponsor.sum_benefit_charges_for(determination_period)
end
def benefit_ratio
taxable_wages > 0 ? (benefit_charges / taxable_wages) : 0.0
end
end
|
ipublic/marketplace
|
spec/models/employers/employer_service_spec.rb
|
require 'rails_helper'
RSpec.describe Employers::EmployerService do
describe Employers::EmployerService do
end
end
|
ipublic/marketplace
|
app/models/integrations/post_priority_mail.rb
|
<gh_stars>0
class Integrations::PostPriorityMail
include Mongoid::Document
end
|
ipublic/marketplace
|
spec/factories/dispatcher_tasks_echo_tasks.rb
|
FactoryBot.define do
factory :dispatcher_tasks_echo_task, class: 'Dispatcher::Tasks::EchoTask' do
end
end
|
ipublic/marketplace
|
app/models/taxes/paid_family_leave_tax.rb
|
<filename>app/models/taxes/paid_family_leave_tax.rb
class Taxes::PaidFamilyLeaveTax
include Mongoid::Document
end
|
ipublic/marketplace
|
app/controllers/accounts_controller.rb
|
<filename>app/controllers/accounts_controller.rb
class AccountsController < ApplicationController
layout 'two_column'
before_action :authenticate_user!
def index
@organization = Parties::OrganizationParty.find(params[:employer_id])
@account = @organization.party_ledger.financial_accounts.last
@transactions = @account.financial_transactions
end
end
|
ipublic/marketplace
|
app/models/notices/ui_deferred_payment_contract_notice.rb
|
class Notices::UiDeferredPaymentContractNotice
include Mongoid::Document
end
|
ipublic/marketplace
|
app/models/integrations/assign_ui_bliocked_claim.rb
|
class Integrations::AssignUiBliockedClaim
include Mongoid::Document
end
|
ipublic/marketplace
|
app/models/wages/exempt_wage_entry.rb
|
module Wages
class ExemptWageEntry < Wage
end
end
|
ipublic/marketplace
|
spec/factories/dispatcher_activities_group_add_activities.rb
|
<gh_stars>0
FactoryBot.define do
factory :dispatcher_activities_group_add_activity, class: 'Dispatcher::Activities::GroupAddActivity' do
end
end
|
ipublic/marketplace
|
app/models/parties/naics_classification.rb
|
module Parties
class NaicsClassification
include Mongoid::Document
embedded_in :organization_party,
class_name: 'Parties::OrganizationParty'
field :code, type: String
field :title, type: String
field :year, type: Integer, default: 2017
field :description, type: String
end
end
|
ipublic/marketplace
|
spec/models/parties/party_relationship_spec.rb
|
require 'rails_helper'
RSpec.describe Parties::PartyRelationship, type: :model, dbclean: :after_each do
it { is_expected.to be_mongoid_document }
it { is_expected.to have_timestamps }
it { is_expected.to belong_to(:party_relationship_kind)}
it { is_expected.to have_many(:party_roles)}
it { is_expected.to have_fields(:start_date, :end_date)}
let(:title) { party_relationship_kind.title }
let(:key) { party_relationship_kind.key }
let(:hero_party_role_kind) { Parties::PartyRoleKind.create!(key: :hero) }
let(:evil_ex_party_role_kind) { Parties::PartyRoleKind.create!(key: :evil_ex) }
let(:party_role_kinds) { [hero_party_role_kind, evil_ex_party_role_kind] }
let(:hero_party_role) { Parties::PartyRole.new(party_role_kind: hero_party_role_kind) }
let(:evil_ex_party_role) { Parties::PartyRole.new(party_role_kind: evil_ex_party_role_kind) }
let(:party_relationship_kind_key) { :battle_opponents }
let(:party_relationship_kind) { Parties::PartyRelationshipKind.create!(key: party_relationship_kind_key, party_role_kinds: party_role_kinds) }
let(:scott_pilgrim_person_party) { Parties::PersonParty.new(current_first_name: 'Scott', current_last_name: 'Pilgrim', party_roles: [hero_party_role]) }
let(:matthew_patel_person_party) { Parties::PersonParty.new(current_first_name: 'Matthew', current_last_name: 'Patel', party_roles: [evil_ex_party_role]) }
let(:scott_pilgrim_party_role) { scott_pilgrim_person_party.party_roles.first }
let(:matthew_patel_party_role) { matthew_patel_person_party.party_roles.first }
let(:party_roles) { [scott_pilgrim_party_role, matthew_patel_party_role] }
let(:params) do
{
party_relationship_kind: party_relationship_kind,
party_roles: party_roles,
}
end
describe "A new model instance" do
context "with no arguments" do
subject { described_class.new }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
end
end
context "with no party_relationship_kind" do
subject { described_class.new(params.except(:party_relationship_kind)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:party_relationship_kind].first).to match(/can't be blank/)
end
end
context "with no party_roles" do
subject { described_class.new(params.except(:party_roles)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:party_roles].first).to match(/must provide a specific role pair/)
end
end
context "with all required arguments" do
subject {described_class.new(params) }
it "should be valid" do
subject.validate
expect(subject).to be_valid
end
it "should have access to delegated attributes" do
expect(subject.key).to eq key
expect(subject.title).to eq title
end
it "should be active" do
expect(subject.is_active?).to be_truthy
end
context "and it is saved" do
it "should save" do
expect(subject.save).to eq true
end
context "it should be findable" do
before { subject.save! }
it "should return the instance" do
expect(described_class.find(subject.id.to_s)).to eq subject
end
end
end
end
end
describe "Managing PartyRelationships" do
end
end
|
ipublic/marketplace
|
app/models/integrations/register_tpa.rb
|
<reponame>ipublic/marketplace
class Integrations::RegisterTpa
include Mongoid::Document
end
|
ipublic/marketplace
|
app/controllers/wage_entries_controller.rb
|
class WageEntriesController < ApplicationController
layout 'two_column'
before_action :authenticate_user!
def index
@organization = Parties::OrganizationParty.find(params[:employer_id])
# binding.pry
@all_quarters = @organization.wage_reports.map(&:timespans).flatten.uniq.sort{|a,b| b.begin_on - a.begin_on}
end
def show
end
def create
@report = Wages::WageReport.find(params[:id])
@report.wage_entries.create(params)
# @organization = Parties::OrganizationParty.find(params[:employer_id])
end
def update
@report = Wages::WageReport.find(params[:id])
wage = Wages::Wage.new
entry = @report.wage_entries.new(submission_kind: :ammended)
# require 'pry';
# binding.pry
end
end
|
ipublic/marketplace
|
app/models/dispatcher/tasks/echo_task.rb
|
<reponame>ipublic/marketplace<filename>app/models/dispatcher/tasks/echo_task.rb
require 'sneakers'
module Dispatcher
class Tasks::EchoTask
include Sneakers::Worker
from_queue 'downloads'
def work(message)
begin
puts "Message is: #{message}"
logger.info "Success: ECHOED <#{message}>"
# Send
publish("JSON-formatted w/instance ack for <#{message}>", :to_queue => 'ActionJob-supplied unique IE/Time stamped batch response queue')
ack!
rescue e
logger.info "Failure: unable to ECHO <#{message}>"
worker_trace "Failed to ECHO <#{message}>"
publish("JSON-formatted w/instance nak for <#{message}>", :to_queue => 'ActionJob-supplied unique ID/Time stamped batch response queue')
reject!
end
end
end
end
|
ipublic/marketplace
|
spec/factories/integrations_ui_iceasas.rb
|
<reponame>ipublic/marketplace
FactoryBot.define do
factory :integrations_ui_iceasa, class: 'Integrations::UiIceasa' do
end
end
|
ipublic/marketplace
|
spec/models/parties/person_party_spec.rb
|
<reponame>ipublic/marketplace
require 'rails_helper'
module Parties
RSpec.describe PersonParty, type: :model, dbclean: :after_each do
let(:current_first_name) { "Mary" }
let(:current_last_name) { "Poppins" }
let(:mary) { Party::PersonParty.new(current_first_name: current_first_name, current_last_name: current_last_name) }
let(:params) do
{
current_first_name: current_first_name,
current_last_name: current_last_name,
}
end
describe "A new model instance" do
it { is_expected.to be_mongoid_document }
it { is_expected.to have_fields(:party_id, :current_first_name, :current_last_name)}
it { is_expected.to embed_many(:person_names)}
context "with no arguments" do
subject { described_class.new }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
end
end
context "with no current_first_name" do
subject { described_class.new(params.except(:current_first_name)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:current_first_name].first).to match(/can't be blank/)
end
end
context "with no current_last_name" do
subject { described_class.new(params.except(:current_last_name)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:current_last_name].first).to match(/can't be blank/)
end
end
context "with all required arguments" do
subject {described_class.new(params) }
it "should be valid" do
subject.validate
expect(subject).to be_valid
end
context "and it is saved" do
it "should save" do
expect(subject.save).to eq true
end
context "it should be findable" do
before { subject.save! }
it "should return the instance" do
expect(described_class.find(subject.id.to_s)).to eq subject
end
end
end
end
end
describe "Managing PartyRelationships" do
let(:fein) { "987654321" }
let(:legal_name) { "ACME Widgets, Inc." }
let(:organization_party) { Parties::OrganizationParty.new(fein: fein, legal_name: legal_name) }
let(:employee_party_roles) { [] }
# let(:employee_party_role) { Parties::PartyRole.new(key: :employee, title: "Employee", start_date: Date.new(2003,1,1)) }
# let(:employee_party_role_kind) { employee_party_role.build(key: :employee, title: "Employee", is_published: true)}
let(:employment_relationship) { Parties::PartyRelationship.new(key: :employment, related_party: :organization_party, start_date: Date.new(2003,1,1), thru_date: Date.new(2016,1,1)) }
let(:employment_party_relationship_kind) { Parties::PartyRelationshipKind.new() }
let(:contact_relationship) { Parties::PartyRelationship.new(key: :organization_contact, related_party: :organization_party, start_date: Date.new(2003,1,1)) }
let(:contact_party_relationship_kind) { Parties::PartyRelationshipKind.new() }
# context "An Individual without any PartyRelationships" do
# let(:person_party) { described_class.new(params) }
# it "should have no PartyRelationships" do
# expect(person_party.party_relationships).to eq []
# end
# context "and a PartyRelationship is added" do
# it "should have the new PartyRelationship" do
# person_party.add_party_relationship(employment_relationship)
# expect(subject.party_relationships.size).to eq 1
# expect(subject.party_relationships.first).to eq employment_relationship
# end
# end
# end
context "An Individual without any PartyRoles" do
let(:person_party) { described_class.new(params) }
it "should have no PartyRoles" do
expect(person_party.party_roles).to eq []
end
context "and a PartyRole is added" do
it "should have the new PartyRole" do
# person_party.add_party_role(employee_party_role)
# expect(person_party.party_roles.size).to eq 1
# expect(person_party.party_roles.first).to eq employee_party_role
end
end
end
end
end
end
|
ipublic/marketplace
|
spec/factories/dispatcher_workers_workers.rb
|
FactoryBot.define do
factory :dispatcher_workers_worker, class: 'Dispatcher::Workers::Worker' do
end
end
|
ipublic/marketplace
|
spec/factories/determinations_ui_contribution_rate_determinations.rb
|
FactoryBot.define do
factory :determinations_ui_contribution_rate_determination, class: 'Determinations::UiContributionRateDetermination' do
end
end
|
ipublic/marketplace
|
app/serializers/echo_serializer.rb
|
class EchoSerializer # < ActiveModel::Serializer
include FastJsonapi::ObjectSerializer
attributes :id, :message, :time_stamp
attribute :time_stamp do |object|
Time.now
end
end
|
ipublic/marketplace
|
spec/models/subscriptions/subscribe_spec.rb
|
<reponame>ipublic/marketplace
require 'rails_helper'
RSpec.describe Subscriptions::Subscribe, type: :model, dbclean: :after_each do
context "A Tenant not subscribed to any features" do
let(:tenant) { Subscriptions::Tenant.create!(site_key: :dchbx, name: "DC HealthLink") }
it "should not have any subscribed features" do
expect(tenant.features.size).to eq 0
end
context "and a Feature is created" do
let(:feature_key) { :aca_shop_market }
let!(:aca_shop_market_feature) { Subscriptions::Feature.create!(
key: feature_key,
title: "ACA SHOP Market",
description: "ACA Small Business Health Options (SHOP) Portal"
)}
it "should be persisted" do
expect(Subscriptions::Feature.find_by(key: feature_key)).to eq aca_shop_market_feature
end
context "and the Tenant subscribes to an existing feature" do
let(:metadata) { { user_id: 12345 } }
let!(:subcribed_event) { Subscriptions::Subscribe.call(tenant_id: tenant._id,
feature_id: aca_shop_market_feature._id,
metadata: metadata) }
it "should have one subscription to the correct feature" do
expect(tenant.features.size).to eq 1
expect(tenant.features.first.key).to eq feature_key
end
end
end
end
end
|
ipublic/marketplace
|
spec/factories/integrations_assign_ui_bliocked_claims.rb
|
<reponame>ipublic/marketplace<gh_stars>0
FactoryBot.define do
factory :integrations_assign_ui_bliocked_claim, class: 'Integrations::AssignUiBliockedClaim' do
end
end
|
ipublic/marketplace
|
app/models/integrations/assign_ui_office_workflow.rb
|
<gh_stars>0
class Integrations::AssignUiOfficeWorkflow
include Mongoid::Document
end
|
ipublic/marketplace
|
spec/models/timespans/calendar_year_timespan_spec.rb
|
require 'rails_helper'
module Timespans
RSpec.describe CalendarYearTimespan, type: :model, dbclean: :after_each do
let(:year) { TimeKeeper.date_of_record.year }
let(:year_too_large) { Timespans::YEAR_MAXIMUM + 1 }
let(:year_too_small) { Timespans::YEAR_MINIMUM - 1 }
let(:params) do
{
year: year,
}
end
describe "A new model instance" do
it { is_expected.to be_mongoid_document }
it { is_expected.to have_timestamps }
it { is_expected.to have_fields(:year) }
it { should validate_numericality_of(:year).greater_than_or_equal_to(YEAR_MINIMUM).less_than_or_equal_to(YEAR_MAXIMUM) }
context "with no arguments" do
subject { described_class.new }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
end
end
context "with no year" do
subject { described_class.new(params.except(:year)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:year].first).to match(/can't be blank/)
end
end
context "with invalid year values" do
subject { described_class.new(year: year_too_large) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:year]).to_not be_nil
end
subject { described_class.new(year: year_too_small) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:year]).to_not be_nil
end
end
context "with all required arguments" do
subject {described_class.new(params) }
it "should compose a correct title" do
subject.validate
expect(subject.title).to eq "#{year}"
end
it "should create quarter year instances" do
subject.validate
expect(subject.quarter_year_timespans.size).to eq 4
end
it "should create month instances" do
subject.validate
expect(subject.month_timespans.size).to eq 12
end
it "should be valid" do
subject.validate
expect(subject).to be_valid
end
context "and it is saved" do
it "should save" do
expect(subject.save).to eq true
end
context "it should be findable" do
before { subject.save! }
it "should return the instance" do
expect(described_class.find(subject.id.to_s)).to eq subject
end
end
end
end
end
describe "Class methods" do
context ".find_on" do
let(:next_year) { year + 1 }
let(:next_begin_on) { Date.new(next_year, 1, 1) }
let(:next_end_on) { Date.new(next_year, 12, 31) }
let!(:match_timespan) { described_class.create!(year: year) }
let!(:next_match_timespan) { described_class.create!(year: next_year) }
context "seeded timespan collection" do
it "the collection should be loaded" do
expect(described_class.all.size).to be > 1
end
context "and a date with a matching record in the collection" do
it "should find timespan covered by date argument" do
expect( described_class.find_on(next_begin_on).entries.first.begin_on).to eq next_begin_on
end
end
context "and a date with no matching record in the collection"
it "should return nil for non-matching date", :aggregate_failures do
expect(described_class.find_on(match_timespan.begin_on - 1.day)).to eq []
end
end
end
end
describe "Instance methods" do
end
end
end
|
ipublic/marketplace
|
app/models/dispatcher/activities/activity.rb
|
class Dispatcher::Activities::Activity
include Mongoid::Document
end
|
ipublic/marketplace
|
spec/factories/integrations_file_liens.rb
|
<reponame>ipublic/marketplace<filename>spec/factories/integrations_file_liens.rb
FactoryBot.define do
factory :integrations_file_lien, class: 'Integrations::FileLien' do
end
end
|
ipublic/marketplace
|
app/models/fees/penalty_fee.rb
|
<reponame>ipublic/marketplace<gh_stars>0
class Fees::PenaltyFee
include Mongoid::Document
end
|
ipublic/marketplace
|
app/models/dispatcher/activities/group_update_activity.rb
|
class Dispatcher::Activities::GroupUpdateActivity
include Mongoid::Document
end
|
ipublic/marketplace
|
app/models/filter_token.rb
|
class FilterToken
include Mongoid::Document
field :name, type: String
field :granted, type: Mongoid::Boolean, default: false
end
|
ipublic/marketplace
|
spec/factories/integrations_import_wage_reports.rb
|
<gh_stars>0
FactoryBot.define do
factory :integrations_import_wage_report, class: 'Integrations::ImportWageReport' do
end
end
|
ipublic/marketplace
|
spec/factories/integrations_post_priority_mails.rb
|
FactoryBot.define do
factory :integrations_post_priority_mail, class: 'Integrations::PostPriorityMail' do
end
end
|
ipublic/marketplace
|
spec/factories/quanta_sequences.rb
|
FactoryBot.define do
factory :quanta_sequence, class: 'Quanta::Sequence' do
end
end
|
ipublic/marketplace
|
app/models/dispatcher/activities/group_renew_activity.rb
|
class Dispatcher::Activities::GroupRenewActivity
include Mongoid::Document
end
|
ipublic/marketplace
|
app/controllers/employers_controller.rb
|
<filename>app/controllers/employers_controller.rb
class EmployersController < ApplicationController
layout 'two_column', except: [:new]
before_action :authenticate_user!
def index
end
def new
@employer = Employers::EmployerForm.for_new
end
def show
@organization = Parties::OrganizationParty.find(params[:id])
@account = @organization.party_ledger.financial_accounts.last
render layout: 'two_column'
end
def get_employers
@orgs = Parties::OrganizationParty.all.order(created_at: :desc)
render json: { data: @orgs }
end
def create
@employer = Employers::EmployerForm.for_create(contact_info: JSON.parse(form_params[:contact_info]), employer_info: JSON.parse(form_params[:employer_info]), address_info: JSON.parse(form_params[:address_info]))
if @employer.save
render json: {code: 200, message: @employer.id.to_s}
else
render json: {code: 400, message: 'Unable to process this request.'}
end
end
private
def form_params
params.require(:employer).permit(:address_info, :contact_info, :employer_info)
end
end
|
ipublic/marketplace
|
app/models/subscriptions/unsubscribe.rb
|
class Subscriptions::Unsubscribe
include Mongoid::Document
end
|
ipublic/marketplace
|
app/models/parties/organization_party_service.rb
|
class Parties::OrganizationPartyService
include Mongoid::Document
end
|
ipublic/marketplace
|
spec/factories/timespans_month_timespans.rb
|
FactoryBot.define do
factory :timespans_month_timespan, class: 'Timespans::MonthTimespan' do
year { Date.today.year }
month { 6 }
end
end
|
ipublic/marketplace
|
spec/factories/bakery_cupcake_factories.rb
|
<filename>spec/factories/bakery_cupcake_factories.rb
FactoryBot.define do
factory :bakery_cupcake_factory, class: 'Bakery::CupcakeFactory' do
end
end
|
ipublic/marketplace
|
spec/models/wages/wage_report_spec.rb
|
<reponame>ipublic/marketplace<filename>spec/models/wages/wage_report_spec.rb
require 'rails_helper'
module Wages
RSpec.describe WageReport, type: :model, dbclean: :after_each do
it { is_expected.to be_mongoid_document }
it { is_expected.to have_timestamps }
it { is_expected.to belong_to(:organization_party)}
it { is_expected.to embed_many(:wage_entries)}
it { is_expected.to belong_to(:timespan)}
let(:organization_party) { Parties::OrganizationParty.new() }
let(:timespan) { Timespans::CalendarYearTimespan.new(year: TimeKeeper.date_of_record.year) }
let(:wage_entries) { Wages::WageEntry.new().to_a }
let(:submission_kind) { :original }
let(:filing_method_kind) { :upload }
let(:state_total_gross_wages) { 60_101.54 }
let(:total_wages) { 40_125.32 }
let(:excess_wages) { 5_125.11 }
let(:taxable_wages) { total_wages - excess_wages }
let(:params) do
{
organization_party: organization_party,
timespan: timespan,
wage_entries: wage_entries,
submission_kind: submission_kind,
filing_method_kind: filing_method_kind,
state_total_gross_wages: state_total_gross_wages,
}
end
describe "A new model instance" do
context "with no arguments" do
subject { described_class.new }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
end
end
context "with no state_total_gross_wages" do
subject { described_class.new(params.except(:state_total_gross_wages)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:state_total_gross_wages].first).to match(/can't be blank/)
end
end
context "with no filing_method_kind" do
subject { described_class.new(params.except(:filing_method_kind)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:filing_method_kind].first).to match(/can't be blank/)
end
end
context "with no submission_kind" do
subject { described_class.new(params.except(:submission_kind)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:submission_kind].first).to match(/can't be blank/)
end
end
context "with no organization_party" do
subject { described_class.new(params.except(:organization_party)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:organization_party].first).to match(/can't be blank/)
end
end
context "with all required arguments" do
subject {described_class.new(params) }
it "should be valid" do
subject.validate
expect(subject).to be_valid
end
# context "and it is saved" do
# it "should save" do
# expect(subject.save).to eq true
# end
# context "it should be findable" do
# before { subject.save! }
# it "should return the instance" do
# expect(described_class.find(subject.id.to_s)).to eq subject
# end
# end
# end
end
end
end
end
|
ipublic/marketplace
|
spec/factories/bakery_sprinkles.rb
|
FactoryBot.define do
factory :bakery_sprinkle, class: 'Bakery::Sprinkle' do
end
end
|
ipublic/marketplace
|
spec/models/wages/wage_spec.rb
|
require 'rails_helper'
module Wages
RSpec.describe Wage, type: :model, dbclean: :after_each do
let(:person_party) { Parties::PersonParty.create(current_first_name: "Mary", current_last_name: "Poppins") }
let(:state_total_wages) { 40_125.32 }
let(:state_excess_wages) { 5_125.11 }
let(:state_taxable_wages) { state_total_wages - state_excess_wages }
let(:timespan) { Timespans::CalendarYearTimespan.new(year: TimeKeeper.date_of_record.year) }
let(:params) do
{
person_party_id: person_party._id,
state_total_wages: state_total_wages,
state_excess_wages: state_excess_wages,
state_taxable_wages: state_taxable_wages,
timespan: timespan,
}
end
describe "A new model instance" do
it { is_expected.to be_mongoid_document }
it { is_expected.to have_timestamps }
it { is_expected.to have_fields(:person_party_id, :state_total_wages, :state_excess_wages, :state_taxable_wages)}
it { is_expected.to be_embedded_in(:wage_entry)}
context "with no arguments" do
subject { described_class.new }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
end
end
context "with no state_total_wages" do
subject { described_class.new(params.except(:state_total_wages)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:state_total_wages].first).to match(/can't be blank/)
end
end
context "with no state_excess_wages" do
subject { described_class.new(params.except(:state_excess_wages)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:state_excess_wages].first).to match(/can't be blank/)
end
end
context "with no state_taxable_wages" do
subject { described_class.new(params.except(:state_taxable_wages)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:state_taxable_wages].first).to match(/can't be blank/)
end
end
context "with no person_party_id" do
subject { described_class.new(params.except(:person_party_id)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:person_party_id].first).to match(/can't be blank/)
end
end
context "with all required arguments" do
subject {described_class.new(params) }
it "should be valid" do
subject.validate
expect(subject).to be_valid
end
# context "and it is saved" do
# it "should save" do
# expect(subject.save).to eq true
# end
# context "it should be findable" do
# before { subject.save! }
# it "should return the instance" do
# expect(described_class.find(subject.id.to_s)).to eq subject
# end
# end
# end
end
end
describe "A new Wage without an assigned PersonParty" do
let(:wage) { described_class.new(params.except(:person_party_id)) }
it "should not have an assigned PersonParty" do
expect(wage.person_party_id).to be_nil
expect(wage.person_party).to be_nil
end
context "and using an existing PersonParty instance" do
it "should find a PersonParty in database" do
expect(Parties::PersonParty.find(person_party._id)).to eq person_party
end
context "and the PersonParty is assigned to the Wage instance" do
it "the assignment should write the PersonParty ID to the Wage attribute" do
wage.person_party = person_party
expect(wage.person_party_id).to eq person_party.id
end
it "the getter should return the PersonParty instance" do
wage.person_party = person_party
expect(wage.person_party).to eq person_party
end
end
end
end
end
end
|
ipublic/marketplace
|
app/models/integrations/get_backruptcy_notice.rb
|
class Integrations::GetBackruptcyNotice
include Mongoid::Document
end
|
ipublic/marketplace
|
spec/factories/determinations_group_health_insurance_eligibility_determinations.rb
|
FactoryBot.define do
factory :determinations_group_health_insurance_eligibility_determination, class: 'Determinations::GroupHealthInsuranceEligibilityDetermination' do
end
end
|
ipublic/marketplace
|
spec/factories/products_paid_family_leaves.rb
|
<filename>spec/factories/products_paid_family_leaves.rb
FactoryBot.define do
factory :products_paid_family_leafe, class: 'Products::PaidFamilyLeave' do
end
end
|
ipublic/marketplace
|
spec/factories/quanta_durations.rb
|
<reponame>ipublic/marketplace<gh_stars>0
FactoryBot.define do
factory :quanta_duration, class: 'Quanta::Duration' do
end
end
|
ipublic/marketplace
|
spec/factories/wages_wage_entries.rb
|
<reponame>ipublic/marketplace
FactoryBot.define do
factory :wages_wage_entry, class: 'Wages::WageEntry' do
submission_kind { :original }
submitted_at { Time.now }
trait :original_submission do
submission_kind { :original }
end
trait :ammended_submission do
submission_kind { :ammended }
end
end
end
|
ipublic/marketplace
|
spec/factories/subscriptions_unsubscribes.rb
|
<reponame>ipublic/marketplace<filename>spec/factories/subscriptions_unsubscribes.rb
FactoryBot.define do
factory :subscriptions_unsubscribe, class: 'Subscriptions::Unsubscribe' do
end
end
|
ipublic/marketplace
|
app/models/wages/wage.rb
|
<gh_stars>0
module Wages
class Wage
include Mongoid::Document
include Mongoid::Timestamps
WAGE_KINDS = [:exempt, :nonexempt, :tip]
embedded_in :wage_entry,
class_name: 'Wages::WageEntry'
field :person_party_id, type: BSON::ObjectId
field :timespan_id, type: BSON::ObjectId
field :state_total_gross_wages, type: BigDecimal
field :state_total_wages, type: BigDecimal
field :state_excess_wages, type: BigDecimal
field :state_taxable_wages, type: BigDecimal
validates_presence_of :person_party_id, :timespan_id
index({ person_party_id: 1})
index({ timespan_id: 1})
def person_party=(new_person_party)
if new_person_party.nil?
write_attribute(:new_person_party, nil)
else
raise ArgumentError.new("expected Parties::PersonParty") unless new_person_party.is_a? Parties::PersonParty
write_attribute(:person_party_id, new_person_party._id)
end
@person_party = new_person_party
end
def person_party
return nil if person_party_id.blank?
return @person_party if defined? @person_party
@person_party = Parties::PersonParty.find(person_party_id)
end
def sum_taxable_wages(state_total_wages)
if state_total_wages.to_f > 9000
9000.to_d
else
state_total_wages.to_f
end
end
def sum_excess_wages(state_total_wages)
state_total_wages.to_f - 9000
end
def timespan=(new_timespan)
if new_timespan.nil?
write_attribute(:new_timespan, nil)
else
raise ArgumentError.new("expected Timespans::Timespan") unless new_timespan.is_a? Timespans::Timespan
write_attribute(:timespan_id, new_timespan._id)
end
@timespan = new_timespan
end
def timespan
return nil if timespan_id.blank?
return @timespan if defined? @timespan
@timespan = Timespans::Timespan.find(timespan_id)
end
end
end
|
ipublic/marketplace
|
spec/factories/fees_paid_family_leave_taxes.rb
|
<filename>spec/factories/fees_paid_family_leave_taxes.rb
FactoryBot.define do
factory :fees_paid_family_leave_tax, class: 'Fees::PaidFamilyLeaveTax' do
end
end
|
ipublic/marketplace
|
spec/factories/notices_ui_deferred_payment_contract_notices.rb
|
FactoryBot.define do
factory :notices_ui_deferred_payment_contract_notice, class: 'Notices::UiDeferredPaymentContractNotice' do
end
end
|
ipublic/marketplace
|
app/models/dispatcher/activities/group_add_activity.rb
|
class Dispatcher::Activities::GroupAddActivity
include Mongoid::Document
end
|
ipublic/marketplace
|
spec/factories/dispatcher_routing_slips.rb
|
<filename>spec/factories/dispatcher_routing_slips.rb
FactoryBot.define do
factory :dispatcher_routing_slip, class: 'Dispatcher::RoutingSlip' do
end
end
|
ipublic/marketplace
|
spec/factories/cases_ui_blocked_claim_cases.rb
|
<filename>spec/factories/cases_ui_blocked_claim_cases.rb
FactoryBot.define do
factory :cases_ui_blocked_claim_case, class: 'Cases::UiBlockedClaimCase' do
end
end
|
ipublic/marketplace
|
spec/factories/integrations_assign_ui_office_workflows.rb
|
FactoryBot.define do
factory :integrations_assign_ui_office_workflow, class: 'Integrations::AssignUiOfficeWorkflow' do
end
end
|
ipublic/marketplace
|
app/models/taxes/unemployment_insurance_tax.rb
|
<reponame>ipublic/marketplace
class Taxes::UnemploymentInsuranceTax
include Mongoid::Document
end
|
ipublic/marketplace
|
spec/factories/notices_ui_blocked_claim_ineligible_notices.rb
|
<reponame>ipublic/marketplace<filename>spec/factories/notices_ui_blocked_claim_ineligible_notices.rb
FactoryBot.define do
factory :notices_ui_blocked_claim_ineligible_notice, class: 'Notices::UiBlockedClaimIneligibleNotice' do
end
end
|
ipublic/marketplace
|
spec/factories/parties_party_relationship_kinds.rb
|
FactoryBot.define do
factory :parties_party_relationship_kind, class: 'Parties::PartyRelationshipKind' do
end
end
|
ipublic/marketplace
|
app/models/dispatcher/workers/worker.rb
|
<gh_stars>0
class Dispatcher::Workers::Worker
include Mongoid::Document
end
|
ipublic/marketplace
|
spec/factories/integrations_get_financial_transactions.rb
|
<reponame>ipublic/marketplace
FactoryBot.define do
factory :integrations_get_financial_transaction, class: 'Integrations::GetFinancialTransaction' do
end
end
|
ipublic/marketplace
|
app/serializers/cupcake_serializer.rb
|
<reponame>ipublic/marketplace
class CupcakeSerializer
include FastJsonapi::ObjectSerializer
attributes :cc_id, :cake, :frosting, :sprinkles, :created_at, :updated_at
# has_many :sprinkles, serializer: :sprinkle_serializer
# attribute :time_stamp do |object|
# Time.now
# end
end
|
ipublic/marketplace
|
spec/factories/products_group_dental_insurances.rb
|
FactoryBot.define do
factory :products_group_dental_insurance, class: 'Products::GroupDentalInsurance' do
end
end
|
ipublic/marketplace
|
spec/factories/dispatcher_tasks_edi_rx_tasks.rb
|
<filename>spec/factories/dispatcher_tasks_edi_rx_tasks.rb
FactoryBot.define do
factory :dispatcher_tasks_edi_rx_task, class: 'Dispatcher::Tasks::EdiRxTask' do
end
end
|
ipublic/marketplace
|
app/models/timespans/calendar_year_timespan.rb
|
<filename>app/models/timespans/calendar_year_timespan.rb
module Timespans
class CalendarYearTimespan < Timespan
attr_readonly :year, :begin_on, :end_on
field :year, type: Integer
has_many :quarter_year_timespans,
class_name: 'Timespans::QuarterYearTimespan',
autosave: true
has_many :month_timespans,
class_name: 'Timespans::MonthTimespan',
autosave: true
# index({ year: 1}, {unique: true})
index({ year: 1})
validates :year,
presence: true,
numericality: { only_integer: true,
greater_than_or_equal_to: YEAR_MINIMUM,
less_than_or_equal_to: YEAR_MAXIMUM
}
private
def initialize_timespan
if year.present?
initialize_calendar_year_timespan
initialize_quarter_year_timespans
initialize_month_timespans
initialize_title
end
end
def initialize_calendar_year_timespan
write_attribute(:begin_on, Date.new(year))
write_attribute(:end_on, Date.new(year).end_of_year)
end
def initialize_quarter_year_timespans
(1..4).map { |new_quarter| quarter_year_timespans.build(year: year, quarter: new_quarter) }
end
def initialize_month_timespans
(1..12).map { |new_month| month_timespans.build(year: year, month: new_month) }
end
def initialize_title
write_attribute(:title, "#{year}") if title.blank?
end
end
end
|
ipublic/marketplace
|
spec/models/subscriptions/tenant_spec.rb
|
<filename>spec/models/subscriptions/tenant_spec.rb
require 'rails_helper'
RSpec.describe Subscriptions::Tenant, type: :model, dbclean: :after_each do
let(:site_key) { :dchbx }
let(:name) { "DC HealthLink" }
let(:params) do
{
site_key: site_key,
name: name,
}
end
context "A new Tenant" do
context "with no params" do
subject { described_class.new }
it "should not be valid", :agreggate_errors do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:site_key].first).to match(/can't be blank/)
expect(subject.errors[:name].first).to match(/can't be blank/)
end
end
context "and all, valid params" do
subject { described_class.new(params) }
it "should be valid" do
subject.validate
expect(subject).to be_valid
end
it "should be findable" do
subject.save!
expect(described_class.find(subject.id)).to eq subject
end
end
end
end
|
ipublic/marketplace
|
app/serializers/dispatcher/tasks/echo_serializer.rb
|
<reponame>ipublic/marketplace
class Dispatcher::Tasks::EchoSerializer < ActiveModel::Serializer
attributes :id
end
|
ipublic/marketplace
|
spec/factories/parties_party_relationships.rb
|
FactoryBot.define do
factory :parties_party_relationship, class: 'Parties::PartyRelationship' do
end
end
|
ipublic/marketplace
|
spec/factories/eligibility_policies_eligibility_policies.rb
|
FactoryBot.define do
factory :eligibility_policies_eligibility_policy, class: 'EligibilityPolicies::EligibilityPolicy' do
end
end
|
ipublic/marketplace
|
spec/factories/financial_accounts_party_ledgers.rb
|
FactoryBot.define do
factory :financial_accounts_party_ledger, class: 'FinancialAccounts::PartyLedger' do
end
end
|
ipublic/marketplace
|
app/models/determinations/pfl_liability_determination.rb
|
class Determinations::PflLiabilityDetermination
include Mongoid::Document
end
|
ipublic/marketplace
|
app/models/dispatcher/tasks/edi_tx_task.rb
|
class Dispatcher::Tasks::EdiTxTask
include Mongoid::Document
end
|
ipublic/marketplace
|
app/models/integrations/release_lien.rb
|
<filename>app/models/integrations/release_lien.rb<gh_stars>0
class Integrations::ReleaseLien
include Mongoid::Document
end
|
ipublic/marketplace
|
spec/models/parties/party_role_spec.rb
|
<gh_stars>0
require 'rails_helper'
RSpec.describe Parties::PartyRole, type: :model, dbclean: :after_each do
it { is_expected.to be_mongoid_document }
it { is_expected.to have_timestamps }
# it { is_expected.to belong_to(:person_party)}
it { is_expected.to belong_to(:party_role_kind)}
it { is_expected.to belong_to(:role_castable)}
it { is_expected.to have_fields(:start_date, :end_date)}
let(:key) { :hero }
let(:title) { "Hero" }
let(:party_role_kind) { Parties::PartyRoleKind.create!(key: key) }
let(:scott_pilgrim_person_party) { Parties::PersonParty.new(current_first_name: 'Scott', current_last_name: 'Pilgrim') }
let(:params) do
{
party_role_kind: party_role_kind,
role_castable: scott_pilgrim_person_party,
}
end
describe "A new model instance" do
context "with no arguments" do
subject { described_class.new }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:party_role_kind].first).to match(/can't be blank/)
end
end
context "with no party_role_kind" do
subject { described_class.new(params.except(:party_role_kind)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:party_role_kind].first).to match(/can't be blank/)
end
end
context "with no polymorphic role_castable" do
subject { described_class.new(params.except(:role_castable)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:role_castable].first).to match(/can't be blank/)
end
end
context "with all required arguments" do
subject {described_class.new(params) }
it "should be valid" do
subject.validate
expect(subject).to be_valid
end
it "should have access to delegated attributes" do
expect(subject.key).to eq key
expect(subject.title).to eq title
end
it "should be active" do
expect(subject.is_active?).to be_truthy
end
end
end
end
|
ipublic/marketplace
|
app/models/notices/notice.rb
|
module Notices
class Notice
include Mongoid::Document
belongs_to :party,
class_name: 'PArties::Party'
end
end
|
ipublic/marketplace
|
app/models/subscriptions/subscription.rb
|
module Subscriptions
class Subscription
include Mongoid::Document
include Mongoid::Timestamps
field :code, type: String
field :subscribed_at, type: DateTime, default: ->{ TimeKeeper.datetime_of_record }
field :is_active, type: Boolean
validates_presence_of :tenant, :feature, :subscribed_at
belongs_to :tenant,
class_name: 'Subscriptions::Tenant'
belongs_to :feature,
class_name: 'Subscriptions::Feature'
has_many :events, as: :event_stream , class_name: 'EventSource::EventStream'
index({ tenant_id: 1 })
index({ feature_id: 1 })
def activate
is_active = true
end
def deactivate
is_active = false
end
end
end
|
ipublic/marketplace
|
spec/factories/dispatcher_tasks_edi_tx_tasks.rb
|
<filename>spec/factories/dispatcher_tasks_edi_tx_tasks.rb
FactoryBot.define do
factory :dispatcher_tasks_edi_tx_task, class: 'Dispatcher::Tasks::EdiTxTask' do
end
end
|
ipublic/marketplace
|
app/models/notices/ui_lien_notice.rb
|
class Notices::UiLienNotice
include Mongoid::Document
end
|
ipublic/marketplace
|
spec/models/employers/employer_factory_spec.rb
|
require 'rails_helper'
RSpec.describe Employers::EmployerFactory do
describe Employers::EmployerFactory do
end
end
|
ipublic/marketplace
|
spec/factories/wages_tip_wage_entries.rb
|
FactoryBot.define do
factory :wages_tip_wage_entry, class: 'Wages::TipWageEntry' do
end
end
|
ipublic/marketplace
|
config/initializers/mongoid.rb
|
<reponame>ipublic/marketplace
if defined?(Mongoid)
# GlobalID is used by ActiveJob (among other things)
# https://github.com/rails/globalid
Mongoid::Document.send(:include, GlobalID::Identification)
if Mongoid::VERSION.split('.').first.to_i < 7
Mongoid::Relations::Proxy.send(:include, GlobalID::Identification)
else
Mongoid::Association::Proxy.send(:include, GlobalID::Identification)
end
end
|
ipublic/marketplace
|
spec/factories/dispatcher_jobs.rb
|
FactoryBot.define do
factory :dispatcher_job, class: 'Dispatcher::Job' do
end
end
|
ipublic/marketplace
|
spec/models/timespans/quarter_year_timespan_spec.rb
|
<reponame>ipublic/marketplace<filename>spec/models/timespans/quarter_year_timespan_spec.rb
require 'rails_helper'
RSpec.describe Timespans::QuarterYearTimespan, type: :model, dbclean: :after_each do
let(:year) { Date.today.year }
let(:quarter) { 2 }
let(:quarter_too_large) { 5 }
let(:quarter_too_small) { 0 }
let(:calendar_year_timespan) { FactoryBot.build(:timespans_calendar_year_timespan) }
let(:params) do
{
calendar_year_timespan: calendar_year_timespan,
year: year,
quarter: quarter,
}
end
describe "A new model instance" do
it { is_expected.to be_mongoid_document }
it { is_expected.to have_timestamps }
it { is_expected.to have_fields(:year, :quarter)}
context "with no arguments" do
subject { described_class.new }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
end
end
context "with no year" do
subject { described_class.new(params.except(:year)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:year].first).to match(/can't be blank/)
end
end
context "with no quarter" do
subject { described_class.new(params.except(:quarter)) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:quarter].first).to match(/can't be blank/)
end
end
context "with invalid quarter values" do
subject { described_class.new(year: year, quarter: quarter_too_large) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:quarter]).to_not be_nil
expect(subject.errors[:year]).to be_blank
end
subject { described_class.new(year: year, quarter: quarter_too_small) }
it "should not be valid" do
subject.validate
expect(subject).to_not be_valid
expect(subject.errors[:quarter]).to_not be_nil
expect(subject.errors[:year]).to be_blank
end
end
context "with all required arguments" do
subject {described_class.new(params) }
it "should be valid" do
subject.validate
expect(subject).to be_valid
end
it "should compose a correct title" do
subject.validate
expect(subject.title).to eq "#{year} Q#{quarter}"
end
context "and it is saved" do
it "should save" do
expect(subject.save).to eq true
end
context "it should be findable" do
before { subject.save! }
it "should return the instance" do
expect(described_class.find(subject.id.to_s)).to eq subject
end
end
end
end
end
end
|
ipublic/marketplace
|
spec/factories/sagas_activities_activities.rb
|
FactoryBot.define do
factory :sagas_activities_activity, class: 'Sagas::Activities::Activity' do
end
end
|
ipublic/marketplace
|
app/models/bakery/billing_service.rb
|
module Bakery
class BillingService
def call(**options)
new(**options).statement
end
def initialize(**options)
@product = options[:product]
@customer = options[:customer]
@product_price = calculate_price
# update_customer_account
@statement = generate_statement
self
end
def calculate_price
SellCupcakeJob.perform_later
# BillingServiceJob.perform_now
end
def update_customer_account
end
def generate_statement
@statement = "statement object TBD"
end
def statement
@statement
end
end
end
|
ipublic/marketplace
|
spec/factories/subscriptions_subscriptions.rb
|
FactoryBot.define do
factory :subscriptions_subscription, class: 'Subscriptions::Subscription' do
end
end
|
ipublic/marketplace
|
spec/models/subscriptions/feature_spec.rb
|
require 'rails_helper'
RSpec.describe Subscriptions::Feature, type: :model do
describe "A new Applicatrion Feature", dbclean: :after_each do
let(:aca_shop_market_key) { :aca_shop_market }
let(:aca_shop_market_title) { "ACA SHOP Market" }
let(:aca_shop_market_description) { "ACA Small Business Health Options (SHOP) Portal" }
let(:fehb_market_key) { :fehb_market }
let(:fehb_market_title) { "Federal Employee Health Benefits Portal" }
let(:fehb_market_description) { "OPM sponsored benefits" }
let(:params) do
{
key: aca_shop_market_key,
title: aca_shop_market_title,
description: aca_shop_market_description,
}
end
let(:aca_shop_market_feature) { ApplicationFeature.new(params) }
it "should not be enabled" do
expect(Flipper.enabled?(aca_shop_market_key)).to be_falsey
end
context "and the Feature is enabled" do
before { Flipper.enable(aca_shop_market_key) }
it "should be available" do
expect(Flipper.enabled?(aca_shop_market_key)).to be_truthy
end
end
end
end
|
ipublic/marketplace
|
spec/factories/timespans_quarter_year_timespans.rb
|
<filename>spec/factories/timespans_quarter_year_timespans.rb
FactoryBot.define do
factory :timespans_quarter_year_timespan, class: 'Timespans::QuarterYearTimespan' do
year { Date.today.year }
quarter { 2 }
end
end
|
ipublic/marketplace
|
spec/factories/fees_taxes.rb
|
<gh_stars>0
FactoryBot.define do
factory :fees_tax, class: 'Fees::Tax' do
end
end
|
ipublic/marketplace
|
spec/factories/determinations_individual_health_insurance_eligibility_determinations.rb
|
<reponame>ipublic/marketplace
FactoryBot.define do
factory :determinations_individual_health_insurance_eligibility_determination, class: 'Determinations::IndividualHealthInsuranceEligibilityDetermination' do
end
end
|
ipublic/marketplace
|
spec/factories/products_group_health_insurances.rb
|
FactoryBot.define do
factory :products_group_health_insurance, class: 'Products::GroupHealthInsurance' do
end
end
|
ipublic/marketplace
|
spec/factories/bakery_cupcakes.rb
|
<filename>spec/factories/bakery_cupcakes.rb<gh_stars>0
FactoryBot.define do
factory :bakery_cupcake, class: 'Bakery::Cupcake' do
end
end
|
ipublic/marketplace
|
app/models/financial_accounts/group_insurance_financial_account.rb
|
class FinancialAccounts::GroupInsuranceFinancialAccount
include Mongoid::Document
end
|
ipublic/marketplace
|
app/models/integrations/generate_bill.rb
|
<reponame>ipublic/marketplace
class Integrations::GenerateBill
include Mongoid::Document
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.