Error in README.md #97

Closed
nfedyashev opened this Issue May 25, 2011 · 1 comment

Comments

Projects
None yet
1 participant

That is what we have in README.md:

stub_request(:get, "www.example.com").
    to_return({:body => "abc"}).then.  #then() is just a syntactic sugar
    to_return({:body => "def"}).then.
    to_raise(MyException)
Net::HTTP.get('www.example.com', '/')    # ===> "abc\n"
Net::HTTP.get('www.example.com', '/')    # ===> "def\n"
Net::HTTP.get('www.example.com', '/')    # ===> MyException raised

But this is how it works in IRB:

ruby-1.8.7-p330 :018 > stub_request(:get, "www.example.com").
ruby-1.8.7-p330 :019 >       to_return({:body => "abc"}).then.  #then() is just a syntactic sugar
ruby-1.8.7-p330 :020 >       to_return({:body => "def"}).then.
ruby-1.8.7-p330 :021 >       to_raise(MyException)
NameError: uninitialized constant MyException
    from (irb):21
ruby-1.8.7-p330 :022 > Net::HTTP.get('www.example.com', '/')    # ===> "abc\n"
 => "abc" 
ruby-1.8.7-p330 :023 > Net::HTTP.get('www.example.com', '/')    # ===> "def\n"
 => "def" 
ruby-1.8.7-p330 :024 > Net::HTTP.get('www.example.com', '/')    # ===> MyException raised
 => "def" 

nfedyashev closed this May 25, 2011

nevermind, my mistake :)
sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment