There are two ways to execute this file:
1. Cucumber as a plugin (by rake task):
cucumber features\test.feature It gives:gems/cucumber-0.1.12/bin/../lib/cucumber/tree/scenario.rb:70:in length': undefined methodjlength' for Scenario ng (NoMethodError)
from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/tree/scenario.rb:74:in `max_line_length'
from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/tree/scenario.rb:78:in `padding_length'
from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/formatters/pretty_formatter.rb:197:in `padding_spaces'
from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/formatters/pretty_formatter.rb:58:in `scenario_executing'
from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/broadcaster.rb:15:in `__send__'
from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/broadcaster.rb:15:in `method_missing'
from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/broadcaster.rb:13:in `each'
from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/broadcaster.rb:13:in `method_missing'
... 12 levels...
from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/cli.rb:11:in `execute'
from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/cucumber:6
from C:/ruby/bin/cucumber:19:in `load'
from C:/ruby/bin/cucumber:19
I found a workaround for this:
But for a better solution I am still working on issue #81
I read an interesting post today by David Chelimsky who wrote RSpec A case against a case against mocking and stubbing. Its about mocking in testing and isolated vs integrated tests. I liked it all but what I particularly liked is how it describes the process of outside-in development.
To quote:
In my projects I think I'm pretty good at following 3,4 &5 but I've struggled with steps 1 & 6. With the advent of cucumber I think now is the time to work on those other steps. I'll let you know how it goes in the New Year.
I read an interesting post today by David Chelimsky who wrote RSpec A case against a case against mocking and stubbing. Its about mocking in testing and isolated vs integrated tests. I liked it all but what I particularly liked is how it describes the process of outside-in development.
To quote:
In my projects I think I'm pretty good at following 3,4 &5 but I've struggled with steps 1 & 6. With the advent of cucumber I think now is the time to work on those other steps. I'll let you know how it goes in the New Year.
Je dukhaan wich hi tainu yaad karde haante har saa wich ik hauka de,de gyan te lai lai paavein jaanay khuda mainu vi sewa da ik mauka de...
I finally got around to upgrading my version of rspec-rails from one that's almost a year old and came across an issue with the way implicit module inclusion is handled.
If you have a handler that uses memoization to cache some information in instance variables such as this (I'm not sure if this is a smell but my project has some examples of it)
module UsersHelper
def all_users
@users ||= User.find(:all)
end
end
You would expect this spec to work
describe UsersHelper do
it "should find all users" do
User.expects(:find).with(:all).returns(result=mock)
helper.all_users.should == result
end
end
Sometimes it does but if any other spec has called helper.all_users previously it will fail as the memoized @users variable is not nil so the collection is reused.
I have submitted a lighthouse patch to rspec-rails that fixes the problem so hopefully they will agree to fix it soon. Until then patch is available on github in my fork or rspec-rails if you want to use it.
I often watch my specs run with the ........'s marching across my terminal and sometimes it seems to pause as it hits a particularly slow one. I figure there's some poorly written spec that's slowing my entire suite down and I should figure out what it is and fix it. But I rarely (if ever) take the time to track down the offender so never fix it. I just discovered that the clever folks writing rspec have taken away my excuse for laziness. I can tell it to report on the slowest specs by putting a line in my spec.opts file telling it to use the ProfileFormatter (see the first line below)
--format profile
--colour
--loadby mtime
--reverse
For example running the specs on my current project I get this output.
Profiling enabled.
........(a bunch more dots)
Top 10 slowest examples:
2.4908950 WikiContent should find all activity for a user
0.8061750 WikiContent should find recent activity for a user in last 15 days
0.2438460 WikiContent::Version should allow limit on results from finding recent activity
0.1821710 User should have a list of owned content
0.1700670 WikiContent should find results if access type is not same as role of the user but role of user is 'Leader'
0.1593900 ContentsController allows PUT request to 'update' action for 'member' role
0.1514150 Search::SearchResponse gets the wiki content id of an asset from the xml response
0.1470310 Content should always allow leaders to see all pages
0.1394920 Page should delete all comments when destroyed
0.1370330 ContentsController should save content and create the uploaded asset on successful POST to the 'create' action
Over the next few days I will find time to take a look at 'WikiContent find all activity' and 'WikiContent find recent activity' specs as they are the two clear outliers.
I now have no excuse to not optimize my slowest specs because I didn't know which they were!
I finally got around to upgrading my version of rspec-rails from one that's almost a year old and came across an issue with the way implicit module inclusion is handled.
If you have a handler that uses memoization to cache some information in instance variables such as this (I'm not sure if this is a smell but my project has some examples of it)
module UsersHelper
def all_users
@users ||= User.find(:all)
end
end
You would expect this spec to work
describe UsersHelper do
it "should find all users" do
User.expects(:find).with(:all).returns(result=mock)
helper.all_users.should == result
end
end
Sometimes it does but if any other spec has called helper.all_users previously it will fail as the memoized @users variable is not nil so the collection is reused.
I have submitted a lighthouse patch to rspec-rails that fixes the problem so hopefully they will agree to fix it soon. Until then patch is available on github in my fork or rspec-rails if you want to use it.
I often watch my specs run with the ........'s marching across my terminal and sometimes it seems to pause as it hits a particularly slow one. I figure there's some poorly written spec that's slowing my entire suite down and I should figure out what it is and fix it. But I rarely (if ever) take the time to track down the offender so never fix it. I just discovered that the clever folks writing rspec have taken away my excuse for laziness. I can tell it to report on the slowest specs by putting a line in my spec.opts file telling it to use the ProfileFormatter (see the first line below)
--format profile
--colour
--loadby mtime
--reverse
For example running the specs on my current project I get this output.
Profiling enabled.
........(a bunch more dots)
Top 10 slowest examples:
2.4908950 WikiContent should find all activity for a user
0.8061750 WikiContent should find recent activity for a user in last 15 days
0.2438460 WikiContent::Version should allow limit on results from finding recent activity
0.1821710 User should have a list of owned content
0.1700670 WikiContent should find results if access type is not same as role of the user but role of user is 'Leader'
0.1593900 ContentsController allows PUT request to 'update' action for 'member' role
0.1514150 Search::SearchResponse gets the wiki content id of an asset from the xml response
0.1470310 Content should always allow leaders to see all pages
0.1394920 Page should delete all comments when destroyed
0.1370330 ContentsController should save content and create the uploaded asset on successful POST to the 'create' action
Over the next few days I will find time to take a look at 'WikiContent find all activity' and 'WikiContent find recent activity' specs as they are the two clear outliers.
I now have no excuse to not optimize my slowest specs because I didn't know which they were!
Funny how it happens... you get up one morningand see...that life is not completefunny h ow it happensand you see......that the one who hurt you mostwas yourselffunny how it happenswhen you realize that the one thingthat you always wanted to go away...forever...will stay forever to remind youand that still you need it...funny how it happenedthat it took you to lose itto realize what you hadfunny
Well, there is so much happening to me at the moment, not that I am overwhelmed by it, in fact I am someone who likes to be immersed in her going arounds. You know, the busier it is, the happier I am, because then my stupid mind does not bring unnecessary thoughts to me. Anyway, currently I feel down, shattered, angry and frustrated like many of my Indian fellows not just because what happened in the last few days, but more because we still don’t see the much needed reform being brought in, we still don’t see the long-long slept conscience of our worthless politicians arising. Anyway, enough has already been and still being said. I only hope God gives them enough sense to implement theat. Please God, it will do even if it’s momentary, but LET THEE BE SENSIBLE.
Now this was from the nations side, but there is also a change happening from the personal front. I feel little scared of myself sometimes, because never ever in my life have I thought of what will happen to me in future, but this time I am, and this is scaring me, because its stupid to be worried about the future. It scares you, because you cant think that everything will be wonderful, because everything cant be wonderful, as life would have been perfect, and its not. So you will think about the bad things happening and that is bound to make you feel bad. So basically you will be sad about something that hasn’t happened at all!! So its very bad thinking about the future, its better to let things happen naturally, keep your head down, do your work, and leave the rest to God. Yesss..this is what I have got to do. Good that I got to it finally by writing here.
Humm..think that’s enough for today. Work Calling!!