Skip to content

Commit

Permalink
Merge pull request #40 from barkibu/fake/add_breeds_fake_helper
Browse files Browse the repository at this point in the history
Add Breeds Fake helper
  • Loading branch information
malkovro authored Jul 5, 2021
2 parents 80599f3 + 41d6aed commit 26b23e8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.5]
- Breeds - Add server endpoint for tests on fake gem

## [0.4.4]
- Breeds - Adjust fields definition to petfamily domain ones

Expand Down Expand Up @@ -76,7 +79,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.1.1] - 2020-01-12
- Init Version: Breeds and limited PetParents/Consultations

[Unreleased]: https://github.com/barkibu/kb-ruby/compare/v0.4.4...HEAD
[Unreleased]: https://github.com/barkibu/kb-ruby/compare/v0.4.5...HEAD
[0.4.5]: https://github.com/barkibu/kb-ruby/compare/v0.4.4...v0.4.5
[0.4.4]: https://github.com/barkibu/kb-ruby/compare/v0.4.3...v0.4.4
[0.4.3]: https://github.com/barkibu/kb-ruby/compare/v0.4.2...v0.4.3
[0.4.2]: https://github.com/barkibu/kb-ruby/compare/v0.4.1...v0.4.2
Expand Down
10 changes: 7 additions & 3 deletions lib/kb/fake/api.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
require 'kb/fake/bounded_context/pet_family/breeds'
require 'kb/fake/bounded_context/pet_family/pet_parents'
require 'kb/fake/bounded_context/pet_family/pets'
require 'kb/fake/bounded_context/pet_family/pet_contracts'

module KB
module Fake
class ApiState
attr_accessor :petparents, :pets, :consultations, :petcontracts, :plans
attr_accessor :petparents, :pets, :consultations, :petcontracts, :plans, :breeds

def initialize(petparents: [], pets: [], consultations: [], petcontracts: [], plans: [])
def initialize(petparents: [], pets: [], consultations: [], petcontracts: [], plans: [], breeds: []) # rubocop:disable Metrics/ParameterLists
@petparents = petparents
@pets = pets
@consultations = consultations
@petcontracts = petcontracts
@plans = plans
@breeds = breeds
end

def to_snapshot
Expand All @@ -21,12 +23,14 @@ def to_snapshot
petparents: @petparents.clone,
consultations: @consultations.clone,
petcontracts: @petcontracts.clone,
plans: @plans.clone
plans: @plans.clone,
breeds: @breeds.clone
}
end
end

class Api < Sinatra::Base
include BoundedContext::PetFamily::Breeds
include BoundedContext::PetFamily::Pets
include BoundedContext::PetFamily::PetParents
include BoundedContext::PetFamily::PetContracts
Expand Down
15 changes: 15 additions & 0 deletions lib/kb/fake/bounded_context/pet_family/breeds.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'kb/fake/bounded_context/rest_resource'

module BoundedContext
module PetFamily
module Breeds
extend ActiveSupport::Concern

included do
include RestResource

listen_on_index :breeds, :v1
end
end
end
end
2 changes: 1 addition & 1 deletion lib/kb/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module KB
VERSION = '0.4.4'.freeze
VERSION = '0.4.5'.freeze
end

0 comments on commit 26b23e8

Please sign in to comment.