mini-update
Posted by jacqui maher on January 30, 2008 at 11:12 AM
I have been really busy lately, and this blog has been awfully quiet. However! I am working on stuff.
Like what?
- testunits2rspec converter gem released by the end of the week.
- decision on wtf to do with my nelson mock creation automation framework, as there’s only so much one can do automagically in a dynamically-typed language
- hopefully will be releasing my fixtures2factory plugin (or maybe a gem) next week
- fixtures2mocks to follow
In the meantime, the awesome artist Shephard Fairey has made two posters recently that I like. I’m starting to consider voting for Obama, now that I finally have allowed myself to read what he stands for and compare it to what Clinton stands for. Mostly it’s their voting records that have me more in favor of Obama. Plus he’s a new face and I think that, more than anything, is what America needs to regain footing with the rest of the world. Because really, in the end, I don’t think any one politician that could get elected into the office of the president of the US can be that much different than another one.
So… come on people, at least, you american people reading this who are 18 and older:
… perhaps even vote for:
but no matter what you vote for, do vote.
damn, people love nostalgia
Posted by jacqui maher on January 12, 2008 at 05:46 PM
TechCrunch reports that AOL is discontinuing Netscape Browser Development.
Check out all the comments on this. Close to 100 people remember the “good ole days” of using Netscape Navigator. I’m a total geek, and I remember when Marc Andreesen and company came out with Netscape. In fact I even hung out at the Netscape offices down in Mountain View a bit; I had friends working there.
However!! the amount of nostalgia displayed on the TechCrunch post is kind of gross.
Plus, this is news? I was actually more surprised to read that AOL was doing *any* development on the Netscape browser at all.
Nostalgia is death. Let’s move on.
getting things done
Posted by jacqui maher on January 09, 2008 at 11:54 PM
As a sometime contributor to the open source project Tracks - a Ruby on Rails application that helps you follow the GTD philosophy of managing your life - you’d think I wouldn’t get overwhelmed very often.
Not so much.
Today I found myself doing the following tasks all at once:
1. installing thrudb
2. setting up config files for the new mysql slave server in puppet
3. installing innodb hot backup, reading the docs on it
4. chatting with my friend mike - a rockstar dba - about best practice in mysql replication
5. fixing one of our scrapers at streeteasy
6. reading about earthclassmail.com
7. rsync’ing master db data and schema dumps to the new slave server
8. responding to someone in an irc channel
9. remembering to make a payment on my credit card
10. reserving a table at les halles.
11. reading my email (streeteasy)
12. reading my email (brighter)
13. trying to remember to open NNW to see if it really was free
14. trying to remember to look up docs on couchdb
15. instead remembering a great line in the book I was reading on the subway this morning - Life Is Elsewhere by Milan Kundera - and posting it to my tumblog.
It was while I was flipping between opentable.com, developers.facebook.com/thrift/, my IM client, my IRC client, my mail client, and so on and so forth that I found myself staring at an empty google search box wondering wtf I was doing.
I realized I was getting overwhelmed and trying to do too much at once. Of course us humans are generally smart and able to juggling lots of things at once, and of course I was actually juggling a lot more than listed above in the 15 points. This doesn’t make me a genius or anything like that - ok, a little ambitious sure - in fact, I’ve found that it’s making me more scatter-brained and distracted than anything else.
In trying to be good at everything one ends up being only “alright” in general. Who wants to be so blandly ordinary and dull?
My next thought was that I should go check out what tips the blog lifehacker.com has for managing one’s time and productivity…
.. when I realized that was just yet another item to add to the list, and that wouldn’t help me.
So to my fellow multi-tasking information hunting and new application writing programmers and friends: how the hell do you get so much done every day?
Sincerely,
me.
Learning StoryRunner
Posted by jacqui maher on January 06, 2008 at 02:53 PM
in which I try to get done with my mockamator already by writing stories describing what it should do, learning how to work with Story Runner in RSpec along the way.
references:
* What’s in a Story by Dan North
* Great step by step example driven tutorial for Rspec on story runner
* RSpec docs on mock objects
This is my first attempt at a story. I already find this helpful as it forces me to make decisions and figure out what it is, exactly, that I’m trying to accomplish. And how.
The Nelson plugin should automagically create mocks (valid or invalid) for any given controller
Narrative:
As a developerI want to easily write controller specs
So that I’m not spending hours on hundreds of LOC making mocks with the right expectations
Acceptance Criteria:
Scenario 1: writing a new controller specGiven the UserController
And that I want to use valid mocks that won’t throw errors
When calling Nelson.generate_mocks(UserController, {:valid => true})
Then a site instance object should be mocked out
And a get request, for example, on the signup form should not raise an error
Ok, so that’s my story and it’s useful in that it’s already helped me get a better idea of what I’m doing… but how do I translate this into Ruby code that can be run through rspec?
One of the tutorials I’m following gives an example of a story, so I am just going to copy and paste it and change it to be appropriate for my narrative:
1 Story "The Nelson plugin", %{
2 should automagically create mocks
3 that are valid or invalid
4 for any given controller
5 }, :type => RailsStory do
6
7 Scenario "in the before block of a controller spec" do
8 When "calling Nelson.generate_mocks" do
9 Nelson.generate_mocks(UserController, {:valid => true})
10 end
11
12 Then "a site mock should be generated" do
13 @site.should_not be_nil
14 @site.should be_a_kind_of(Site)
15 end
16
17 When "I request the UserController signup action in a get request" do
18 get '/user/signup'
19 end
20
21 Then "response should be successful" do
22 response.should be_success
23 end
24 end
25 end
That was my first attempt. While writing this a few questions came up, namely…
- does the context get preserved between different When events? that is, will instance variables that are created in one event be accessible in a subsequent event context?
- am i breaking up my tasks correctly?
- what’s up with that array of phrases in the Story block anyway?
- does the When have to be mapped to a controller request?
(from the vaporbase.com tutorial: “The “When” clause is the meat of the scenario. It is a controller action, and its spec gets done next… “)
Only one way to find out: time to run this through the story runner. I foresee some errors… :)
1 jm:~/se/app/workspace (master) $ ruby stories/nelson_should_create_mocks.rb
2 Running 1 scenarios
3
4 Story: The Nelson plugin
5
6
7 should automagically create mocks
8 that are valid or invalid
9 for any given controller
10
11
12 Scenario: in the before block of a controller spec
13
14 When calling Nelson.generate_mocks (FAILED)
15
16 Then a site mock should be generated (SKIPPED)
17
18 When I request the UserController signup action in a get request
19
20 Then response should be successful
21
22 1 scenarios: 0 succeeded, 1 failed, 0 pending
23
24 FAILURES:
25 1) The Nelson plugin (in the before block of a controller spec) FAILED
26 NoMethodError: undefined method `generate_mocks' for Nelson:Class
27 stories/nelson_should_create_mocks.rb:28:in `calling Nelson.generate_mocks'
28 stories/nelson_should_create_mocks.rb:27
29 stories/nelson_should_create_mocks.rb:20
Whoa! That actually went a lot better than I expected. I haven’t written the method “generate_mocks” in my plugin yet, so naturally it would fail.
I love the output of the Story Runner. I think I might be sold. Time to write the methods in my Nelson plugin that will generate the mocks, I guess.
I’ll be posting my stories - when they’re closer to being finalized - here as examples for other people to reference.
In the meantime, here are some:
* from pastie
* from evang.eli.st (scroll down)
* plain text stories from david chelimsky’s blog