Created
January 26, 2018 12:05
-
-
Save detomastah/6940bb3dfad4a8b37f595354cb8aaf02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Utwórz repozytorium na Github (o nazwie nie wskazującej, że jest to zadanie z Kodologii). W pierwszym commicie dodaj poniższe pliki, nie zmieniając ich. | |
Twoim zadaniem jest: | |
1) Napisanie modułu Validator (validator.rb), który po dołączeniu do klasy `User` sprawi, że ta klasa będzie działać poprawnie. | |
2) Napisanie w Rspec testu modułu validator i klasy User. | |
Kod powinien zawierać wszystkie elementy, dzięki którym, po pobraniu go na mój komputer będę mógł go uruchomić, wpisując polecenie rspec | |
Link do repozytorium z rozwiązaniem wyślij mi mailem. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
include Validator | |
attr_accessor :name | |
# Ta metoda musi zostać zaimplementowana w module | |
validate :name, LengthValidation.new(between: [5,10]) | |
def save! | |
validate! # Ta metoda musi zostać zaimplementowana w module | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment