Demonstrate benefits of dependency injection
- Install rbenv (Ruby version manager) using rbenv-installer (follow link for instructions).
- Run
rbenv init
and follow the instructions to configure your shell
- Run
- Install Ruby:
rbenv install 3.1.0
. - Install bundler:
gem install bundler
. - Install dependencies for auto-running tests:
brew install ag entr
- Clone repo
git clone [email protected]:connected-psobocinski/url-shortener-kata.git
- Install dependencies
bundle install
- Open working directory in your IDE of choice
code . # vs code
# Auto-run rspec tests
./rspec_autorun.sh
Run ruby code in terminal:
irb
You have inherited a URLShortener
. Two public methods exist on the class:
URLShortener.shorten(long_url)
- Given a full-length URL, it generates a shortened version of the URL and stores the original URL in the DB
URLShortener.retrieve(short_url)
- Given an existing shortened URL, retrieves the full-length URL from the DB
- Given a non-existent shortened URL, raises a "not found" error
The service needs to be extended in the following way:
- Use a better URL shortening algorithm
- Use a more scalable DB technology
The team has not yet decided on either of the above implementations. However, in preparation for the above, we wish to:
- Verify the behaviour works as documented above
- Redesign
URLShortener
so that it can be extended
Apply TDD to achieve the above two goals.