testing...
This file contains hidden or 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 Game | |
| XN = 100 | |
| YN = 100 | |
| def initialize | |
| @cells = {} | |
| end | |
| def add(x, y) | |
| @cells["#{x}-#{y}"] = 1 |
This file contains hidden or 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 Context | |
| def initialize(*listeners) | |
| @listeners = listeners | |
| end | |
| def signal(method, *args) | |
| @listeners.each do |listener| | |
| listener.send method, *args | |
| end | |
| end |
This file contains hidden or 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
| describe 'Notifier' do | |
| before do | |
| SMS.stub(:deliver) | |
| Expense.stub(:create) | |
| @user = double 'user', mobile_number: '1234' | |
| @message = 'hello' | |
| Notifier.notify(@user, @message) | |
| end |
This file contains hidden or 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
| # the point is to run the costly operation just once yet still be able to use | |
| # convenient "should change by" syntax. | |
| def transform | |
| # sleep 2 | |
| $x = 11 | |
| $y = 22 | |
| $z = 33 | |
| end |
This file contains hidden or 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
| require 'meatloaf' | |
| require 'steps' | |
| Feature "Eat candies" do | |
| Scenario "Eat a candy from a jar full of them" do | |
| Given "I have a jar with candies", candies: 10 | |
| When "I eat one candy" | |
| Then "the jar won't be empty" | |
| end |
This file contains hidden or 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
| require 'RMagick' | |
| require 'capybara' | |
| require 'launchy' | |
| module Capybara::Recording | |
| def start_recording | |
| system "rm -f tmp/*" | |
| end | |
| def save_recording |
This file contains hidden or 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
| # POC "Inline" contract tests with MiniTest | |
| # | |
| # The idea is to run a contract test immediately after a mock object is created. | |
| # | |
| # Example: | |
| # | |
| # Say a `Registration` uses `Payment` (which uses `PaymentGateway`) | |
| # | |
| # def test_successfull_payment | |
| # payment = double |
This file contains hidden or 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
| (set -e; | |
| git rev-list --reverse origin/master..master | | |
| while read rev; do | |
| echo "Checking out: $(git log --oneline -1 $rev)"; | |
| git checkout -q $rev; | |
| python runtests.py; | |
| done) |