Created
March 24, 2009 14:03
-
-
Save nicolasblanco/84099 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
#[email protected] | |
[13:59] slainer68: My question : i've got in my class a "case my_object ... when String ... when Array ...". How should I test this with a mock ? | |
[13:59] slainer68: I've tested with my_object = mock("my_object", :class => String) but that does not work. | |
[13:59] pd: slainer68: i wouldn't mock at all, pass a real string or a real array | |
[14:00] slainer68: pd: that would be okay with a simple class, but in my case i need to use a mock because i'm testing a Net::HTTP class | |
[14:00] slainer68: my class got : case http_response when Net::HTTPSuccess ... | |
[14:01] pd: i see | |
[14:04] pd: slainer68: so mock('foo', :class => String) will change the .class response, but String===that_obj still doesn't work | |
[14:04] pd: uhh i don't see any good way around that | |
[14:04] pd: besides changing implementation to care about interface instead of class | |
[14:05] slainer68: pd: i see | |
[14:06] nevans a rejoint le canal. | |
[14:07] pd: slainer68: meh, i guess checking response.code instead of by class, but it eliminates the pretty names | |
[14:10] slainer68: thanks pd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment