Timeline for Refactoring a Delimiter
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 23, 2017 at 12:40 | history | edited | Community Bot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Feb 24, 2014 at 4:43 | comment | added | Uri Agassi |
Since all your methods should be class methods (def self.add(expression) , you don't need to include the module, simply call the method is your test (expect(StringCalculator.add(...)).to ... )
|
|
Feb 23, 2014 at 23:34 | comment | added | user27606 | One last question, how do I test this with rspec? Do I just include the module when describing StringCalculator? I can't find an example that just tests a module. | |
Feb 23, 2014 at 19:02 | comment | added | user27606 | Got it, thanks for the insight. This problem was trivial at first and then I lost control flow as I started moving down on the specs. | |
Feb 23, 2014 at 19:01 | vote | accept | Community Bot | ||
Feb 23, 2014 at 19:00 | comment | added | Uri Agassi | It won't be object-oriented, but for simple code like this, you doesn't have to be. If a requirement will come, which will require state - you could refactor it then, according to the new requirement. | |
Feb 23, 2014 at 18:58 | comment | added | user27606 | It returned six. So it did in fact parse goat into zero. By converting this into a module, this would be all procedural, correct? | |
Feb 23, 2014 at 18:54 | comment | added | Uri Agassi |
What would your code return if I called calc.add('1,2,goat,3') ? Is this what you expect it to return?
|
|
Feb 23, 2014 at 18:52 | comment | added | user27606 |
I thought about making this procedural after realizing that when my tests broke after calling add twice. So I'm assuming a module would just include methods without being object-oriented (which is what you're saying about the object state.) What exactly are you saying about to_i . Did I do something wrong?
|
|
Feb 23, 2014 at 18:44 | history | edited | Uri Agassi | CC BY-SA 3.0 |
added 1243 characters in body
|
Feb 23, 2014 at 17:29 | comment | added | user27606 | I'll update this with how I append numbers. Sorry about that. Give me just a second, don't go anywhere! | |
Feb 23, 2014 at 17:16 | history | answered | Uri Agassi | CC BY-SA 3.0 |