Skip to content

Commit 10e292f

Browse files
aridlehooverFito
andcommitted
Adds interface for building objects with Replicator
Co-authored-by: Fito von Zastrow <adolfovon@gmail.com>
1 parent a26cda1 commit 10e292f

File tree

6 files changed

+34
-8
lines changed

6 files changed

+34
-8
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Adds interface for building objects with Replicator

shard.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ authors:
88
crystal: 1.6.2
99

1010
license: MIT
11+
12+
development_dependencies:
13+
spectator:
14+
gitlab: arctic-fox/spectator
15+
version: = 0.10.6

spec/replicator_spec.cr

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
require "./spec_helper"
22

3-
describe Replicator do
4-
# TODO: Write tests
3+
class Galaxy; extend Replicator::Replicable; end
54

6-
it "works" do
7-
true.should eq(true)
5+
Spectator.describe Replicator do
6+
describe ".build" do
7+
it "returns an empty array when an unregistered class is provided" do
8+
replicas = Galaxy.build(:iks_buruk)
9+
expect(replicas.size).to eq(0)
10+
end
811
end
912
end

spec/spec_helper.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
require "spec"
1+
require "spectator"
22
require "../src/replicator"

src/replicator.cr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# TODO: Write documentation for `Replicator`
1+
require "./replicator/replicable"
2+
23
module Replicator
34
VERSION = "0.1.0"
4-
5-
# TODO: Put your code here
65
end

src/replicator/replicable.cr

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module Replicator
2+
module Replicable
3+
def build(key)
4+
Array(String).new
5+
end
6+
end
7+
end

0 commit comments

Comments
 (0)