Skip to content

Instantly share code, notes, and snippets.

@jccarbonfive
Last active December 11, 2015 01:58
Show Gist options
  • Save jccarbonfive/4526742 to your computer and use it in GitHub Desktop.
Save jccarbonfive/4526742 to your computer and use it in GitHub Desktop.
$ 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)
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
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
$ 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
require 'igpay_atinlay'
module Translator
class PigLatin
def self.translate(english)
english
.each_line
.map(&:to_pig_latin)
.reduce(&:concat)
end
end
end
$ rspec spec/pig_latin_spec.rb
.
Finished in 0.0005 seconds
1 example, 0 failures
$ 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