Last active
December 11, 2015 01:58
-
-
Save jccarbonfive/4526742 to your computer and use it in GitHub Desktop.
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
$ cucumber features/pig_latin.feature | |
Using the default profile... | |
.F- | |
(::) failed steps (::) | |
Exit status was 1 but expected it to be 0. Output: | |
/Users/jared/Projects/translator/lib/translator.rb:12:in `initialize': wrong number of arguments (0 for 1) (ArgumentError) |
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 'translator/version' | |
require 'pig_latin' | |
module Translator | |
def self.pig_latin(request, response) | |
pig_latin = PigLatin.translate request | |
view = PigLatinView.new pig_latin | |
view.render_on response | |
end | |
class PigLatinView | |
# same code as above | |
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
require 'spec_helper' | |
module Translator | |
describe PigLatin do | |
describe 'translating' do | |
context 'given some English text' do | |
before do | |
english = 'hello world' | |
@pig_latin = PigLatin.translate english | |
end | |
it 'returns it translated to Pig Latin' do | |
@pig_latin.should == 'ellohay orldway' | |
end | |
end | |
end | |
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
$ rspec spec/pig_latin_spec.rb rbenv:1.9.3-p194 | |
F | |
Failures: | |
1) Translator::PigLatin translating given some English text returns it translated to Pig Latin | |
Failure/Error: @pig_latin = PigLatin.translate english | |
NoMethodError: undefined method `translate' for Translator::PigLatin:Class |
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 'igpay_atinlay' | |
module Translator | |
class PigLatin | |
def self.translate(english) | |
english | |
.each_line | |
.map(&:to_pig_latin) | |
.reduce(&:concat) | |
end | |
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
$ rspec spec/pig_latin_spec.rb | |
. | |
Finished in 0.0005 seconds | |
1 example, 0 failures |
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
$ cucumber features/pig_latin.feature | |
Using the default profile... | |
... | |
1 scenario (1 passed) | |
3 steps (3 passed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment