Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
Needs true random tests. The current "random" tests just consists of different values of the same route.
Also needs more fixed tests. There is only ever 1 route hash tested for the kata.
The methological and design of the kata is incorrect: segments refer to URL segments, which is the path of the URL further delimited by dashes. Hence a method named
.segments
should not return the named hash, it should return an array of the URL segments. The named segments would be the params captured by the route.Even then, storing the params in the object as a mutable state on
Router
is insane design, because it doesn't belong toRouter
, but specific to a request itself. Instead of returning["CommentsController", :edit]
and storing{ slug: "test-post", id: "12" }
into.segments
the method should really return["CommentsController", :edit, { slug: "test-post", id: "12" }]
(with empty hash ornil
as the third element when no named segments exist). Every MVC framework does this so the action will actually get the params as it is invoked by the framework.Test.expect
should not be used.could add
FUNDAMENTALS
tagHow about
/
? is it cheating too?Node 12 should be enabled (Refer this and this for more info)
Ruby 3.0 should be enabled (Refer this & this for more detail)
Ruby 3.0 should be enabled (Refer this & this for more detail)
Duplicate.
No fixed tests.
The example in the description is wrong.
Missing tests with cyclic replacements (like
Test.assert_equals({a: 1, b: 2}.replace_keys({a: :b, b: :a}), {a: 2, b: 1})
). Incorrect solution: https://www.codewars.com/kata/reviews/5e42e6a624428a0001b2cd43/groups/5e42e6a624428a0001b2cd45Missing tests with falsy values. Incorrect solution: https://www.codewars.com/kata/reviews/5e42e6a624428a0001b2cd43/groups/5e42e88d24428a0001b2cd74
This should probably include an explicit test which checks for the solution's precision. I tried submitting a solution with 2 decimal digit precision and it passed all random tests on the 4th try.
No random tests.
Loading more items...