Skip to content
This repository has been archived by the owner on Jun 15, 2020. It is now read-only.

Commit

Permalink
Replace kata and Kata with duck_testing and DuckTesting respectively
Browse files Browse the repository at this point in the history
  • Loading branch information
yuku committed Aug 30, 2015
1 parent a1d35d0 commit 4f285c3
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Simple data type testing tool

## Usage

Suppose there are a class and corresponding _kata_ module:
Suppose there are a class and corresponding _duck_testing_ module:

```rb
require "duck_testing"
Expand All @@ -19,7 +19,7 @@ class Foo
end
end

module FooKata
module FooDuckTesting
def double(x)
tester = DuckTesting::Tester.new(self, "double")
tester.test_param(x, [
Expand All @@ -34,15 +34,15 @@ module FooKata
end
```

Now you can activate type testing by prepending _kata_ module into the class:
Now you can activate type testing by prepending _duck_testing_ module into the class:

```rb
before = Foo.new

before.double("2")
# => "22"

Foo.send(:prepend, FooKata)
Foo.send(:prepend, FooDuckTesting)

after = Foo.new

Expand All @@ -58,5 +58,5 @@ after.double("2")

## TODO

- Generate _kata_ module by YARD document.
- Generate _duck_testing_ module by YARD document.
- RSpec integration.
8 changes: 4 additions & 4 deletions spec/class_type_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
end

before do
klass.send(:prepend, kata_module)
klass.send(:prepend, duck_testing_module)
end

let(:instance) { klass.new }
Expand All @@ -22,7 +22,7 @@ def double(number)
context "when expected parameter and return are given" do
let(:param) { 1 }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def double(number)
tester = DuckTesting::Tester.new(self, "double")
Expand Down Expand Up @@ -50,7 +50,7 @@ def double(number)
context "when unexpected parameter is given" do
let(:param) { "string" }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def double(number)
tester = DuckTesting::Tester.new(self, "double")
Expand All @@ -75,7 +75,7 @@ def double(number)
context "when unexpected result is given" do
let(:param) { 1 }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def double(number)
tester = DuckTesting::Tester.new(self, "double")
Expand Down
8 changes: 4 additions & 4 deletions spec/constant_type_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
end

before do
klass.send(:prepend, kata_module)
klass.send(:prepend, duck_testing_module)
end

let(:instance) { klass.new }
Expand All @@ -22,7 +22,7 @@ def not(a)
context "when expected parameter and return are given" do
let(:param) { true }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def not(a)
tester = DuckTesting::Tester.new(self, "not")
Expand Down Expand Up @@ -50,7 +50,7 @@ def not(a)
context "when unexpected parameter is given" do
let(:param) { "string" }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def not(a)
tester = DuckTesting::Tester.new(self, "not")
Expand All @@ -71,7 +71,7 @@ def not(a)
context "when unexpected result is given" do
let(:param) { true }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def not(a)
tester = DuckTesting::Tester.new(self, "not")
Expand Down
8 changes: 4 additions & 4 deletions spec/duck_type_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
end

before do
klass.send(:prepend, kata_module)
klass.send(:prepend, duck_testing_module)
end

let(:instance) { klass.new }
Expand All @@ -24,7 +24,7 @@ def read(io)
context "when expected parameter and return are given" do
let(:param) { StringIO.new }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def read(io)
tester = DuckTesting::Tester.new(self, "read")
Expand All @@ -50,7 +50,7 @@ def read(io)
context "when unexpected parameter is given" do
let(:param) { "string" }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def read(io)
tester = DuckTesting::Tester.new(self, "read")
Expand All @@ -70,7 +70,7 @@ def read(io)
context "when unexpected result is given" do
let(:param) { "string" }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def read(io)
tester = DuckTesting::Tester.new(self, "read")
Expand Down
8 changes: 4 additions & 4 deletions spec/hash_type_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
end

before do
klass.send(:prepend, kata_module)
klass.send(:prepend, duck_testing_module)
end

let(:instance) { klass.new }
Expand All @@ -24,7 +24,7 @@ def get(hash, key, default = nil)
context "when expected parameter and return are given" do
let(:params) { [{ a: 1, b: 2 }, :b, "hello"] }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def get(hash, key, default = nil)
tester = DuckTesting::Tester.new(self, "get")
Expand Down Expand Up @@ -58,7 +58,7 @@ def get(hash, key, default = nil)
context "when unexpected parameter is given" do
let(:params) { [{ "a" => 1 }, "a"] }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def get(hash, _key, _default = nil)
tester = DuckTesting::Tester.new(self, "get")
Expand All @@ -81,7 +81,7 @@ def get(hash, _key, _default = nil)
context "when unexpected result is given" do
let(:params) { [{ a: 1, b: 2 }, :b, "hello"] }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def get(hash, key, default = nil)
tester = DuckTesting::Tester.new(self, "get")
Expand Down
8 changes: 4 additions & 4 deletions spec/order_dependent_array_type_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
end

before do
klass.send(:prepend, kata_module)
klass.send(:prepend, duck_testing_module)
end

let(:instance) { klass.new }
Expand All @@ -26,7 +26,7 @@ def find(keylist, key)
context "when expected parameter and return are given" do
let(:params) { [[[:a, 1], [:b, 2]], :b] }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def find(keylist, key)
tester = DuckTesting::Tester.new(self, "find")
Expand Down Expand Up @@ -60,7 +60,7 @@ def find(keylist, key)
context "when unexpected parameter is given" do
let(:params) { [[["a", 1], ["b", 2]], "b"] }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def find(keylist, key)
tester = DuckTesting::Tester.new(self, "find")
Expand Down Expand Up @@ -91,7 +91,7 @@ def find(keylist, key)
context "when unexpected result is given" do
let(:params) { [[[:a, 1], [:b, 2]], :b] }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def find(keylist, key)
tester = DuckTesting::Tester.new(self, "find")
Expand Down
8 changes: 4 additions & 4 deletions spec/order_independent_array_type_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
end

before do
klass.send(:prepend, kata_module)
klass.send(:prepend, duck_testing_module)
end

let(:instance) { klass.new }
Expand All @@ -22,7 +22,7 @@ def sum(array)
context "when expected parameter and return are given" do
let(:param) { [1, 0.1] }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def sum(array)
tester = DuckTesting::Tester.new(self, "sum")
Expand Down Expand Up @@ -52,7 +52,7 @@ def sum(array)
context "when unexpected parameter is given" do
let(:param) { "string" }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def sum(array)
tester = DuckTesting::Tester.new(self, "sum")
Expand All @@ -79,7 +79,7 @@ def sum(array)
context "when unexpected result is given" do
let(:param) { [1, 0.1] }

let(:kata_module) do
let(:duck_testing_module) do
Module.new do
def sum(array)
tester = DuckTesting::Tester.new(self, "sum")
Expand Down

0 comments on commit 4f285c3

Please sign in to comment.