Re: [rspec-users] Database.truncate_all
ISTR that "destroy_all" will instantiate each object, before destroying it. If you just want to clean the database, I think "delete_all" is the one you want (it just does a "delete from [table]", if memory serves), and should be a lot quicker. David 2008/12/6 Mark Wilden <[EMAIL PROTECTED]>: > On Fri, Dec 5, 2008 at 6:32 AM, Jeff Talbot <[EMAIL PROTECTED]> wrote: >> >> There is a seemingly very useful line of code in the cucumber wiki >> that I'd like to use: >> >> After do >># Scenario teardown >>Database.truncate_all >> end > > That's just an example of some code you might call in an After. A little > lower, you see > > TempFileManager.clean_up > > which also looks like non-Rails/Cucumber code. > > A simple way to achieve the former would be > > class Database > def self.truncate > TheModel.destroy_all > TheOtherModel.destroy_all > # etc > end > end > > destroy_all isn't exactly the same as SQL TRUNCATE, but it might serve your > purpose. > > ///ark > > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Cucumber and autospec do not work ?
> I have added th tickets for you and am working on fixes for them. > Although, I think the last one needs to be discussed more so please add > your thoughts to that ticket. > > http://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/117-cli-crashes-with-blank-cucumberyml > http://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/118-confusing-error-message-with-blank-default-profile-defined > http://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/119-not-using-default-profile-when-expected Thank you! Comment added to 119 Bye, Kero. ___ How can I change the world if I can't even change myself? -- Faithless, Salva Mea ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Autospec does not work w/ cucumber features?
Hi! And now for the second part of the subject of my previous mails :) $ cat cucumber.yml default: . autotest: -v . autotest-all: -v -f progress . $ cucumber -i . -f progress PP Pending Scenarios: 1) enlightenment (meditation) $ AUTOFEATURE=true autospec # bug! prompt returns immediately, ZenTest gem not a dependency? a warning that autotest was not found would be nice. $ sudo gem install ZenTest Successfully installed ZenTest-3.11.0 1 gem installed Installing ri documentation for ZenTest-3.11.0... Installing RDoc documentation for ZenTest-3.11.0... $ AUTOFEATURE=true autospec ^CInterrupt a second time to quit ^C it just does not do anything at all... and I haven't had any luck with earlier versions of cucumber, either. Nor does autospec become more active when I have implemented some features already. afaik I did everything mentioned in http://github.com/aslakhellesoy/cucumber/wikis/autotest-integration any ideas? NB: where to file the autospec/autotest warning missing bug; rspec plain? rspec-cucumber? Bye, Kero. ___ How can I change the world if I can't even change myself? -- Faithless, Salva Mea ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Indentation Conventions for Ruby and Cucumber
On Thu, Dec 4, 2008 at 1:27 AM, Andrew Premdas <[EMAIL PROTECTED]> wrote: > Oh but cucumber features so want to be idented on the I > > Scenario: Anonymous user can not duplicate a un-activated account >Given I am an anonymous user > And a registered user Fred exists > When I signup as Fred > Then I should see an error > > Really need to view above with a monspaced font - if its not coming out > that way in your mail reader. > The problem with that however is that it is not compliant with Internationalization standards... Not to mention it would then naturally bias someone toward using an enforced I. What if I didn't want to use an "I", but an "it" say, in terms of an API that is being talked to by another system... -- http://lindsaar.net/ Rails, RSpec and Life blog ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] RSpec and 1.9 Compatibility
OK... I am making a mail library that is taking advantage of the new things in 1.9, mainly encoding and the new regex goodness. However, RSpec is not jiggy with it right now on 1.9... so I'm going to try and scratch an itch here. Has anyone started on this? I've started in terms of getting RSpec and it's dependencies to run the specs working and it is proving fun :) If anyone has already trail-blazed some of this, it would be good to collaborate a bit so I can get a leg up. Otherwise, I'll start from scratch. Mikel -- http://lindsaar.net/ Rails, RSpec and Life blog ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] RSpec and 1.9 Compatibility
On Sat, Dec 6, 2008 at 6:28 AM, Mikel Lindsaar <[EMAIL PROTECTED]> wrote: > OK... I am making a mail library that is taking advantage of the new things > in 1.9, mainly encoding and the new regex goodness. > However, RSpec is not jiggy with it right now on 1.9... so I'm going to try > and scratch an itch here. > Has anyone started on this? I've started in terms of getting RSpec and it's > dependencies to run the specs working and it is proving fun :) If anyone > has already trail-blazed some of this, it would be good to collaborate a bit > so I can get a leg up. > Otherwise, I'll start from scratch. > > Mikel Check out http://rspec.lighthouseapp.com/projects/5645-rspec/tickets?q=tagged%3A%22ruby19%22+state%3Aopen&filter= There are a couple of open tickets including patches that haven't quite worked out yet. Cheers, and TIA, David > -- > http://lindsaar.net/ > Rails, RSpec and Life blog > > > > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Update RSpec but have a problem!
Hi people! I run rake spec ** Invoke spec (first_time, not_needed) and specs not started! What that's mean? Thanks! -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Database.truncate_all
On Sat, Dec 6, 2008 at 2:47 AM, David Salgado <[EMAIL PROTECTED]>wrote: > ISTR that "destroy_all" will instantiate each object, before > destroying it. If you just want to clean the database, I think > "delete_all" is the one you want (it just does a "delete from > [table]", if memory serves), and should be a lot quicker. > Yes, you're right. I always get those mixed up. ///ark ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Database.truncate_all
Jeff Talbot wrote: There is a seemingly very useful line of code in the cucumber wiki that I'd like to use: After do # Scenario teardown Database.truncate_all end (from http://github.com/aslakhellesoy/cucumber/wikis/migration-from-rspec-stories) But when I run this I get an uninitialized constant error for "Database". Anybody know if/how I can make this call? Is there something I need to require? Is there a different way of doing this now? I have a need to not use transactional_fixtures for a specific suite of tests and I want to clear out the database after every run so my tests are isolated. Thanks, Jeff As pointed out this was just an example. For ideas on how to implement such a method you can read this previous thread about it: http://www.mail-archive.com/rspec-users@rubyforge.org/msg06597.html -Ben ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] cucumber and autotest - running all features?
On Fri, Dec 5, 2008 at 4:47 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: > I'll have to give autospec another shot then I guess. I have given up on it > as it takes over 7 minutes to 'boot up' with our test suite, and I find it > misses too many things it should have run, such that I have to hit CTRL-C > and do a complete (7 minute) re-run far more often than I'd like. I also > don't trust it before a check-in - it seems to miss things that should have > been re-run. It certainly can take a while to boot up, but that's necessary: it really has to run the whole suite the first time to be sure everything is passing. It might be nice to have an option to skip that if you're sure everything passes when you start. You shouldn't be using Ctrl-C to restart autospec very often; at least, I almost never do. I find that the work I'm doing very rarely regresses other scenarios, and it's not a problem not to notice until the current features are finished and the whole suite runs. Typically, in my workflow, I have a branch which adds a new feature or scenario. I commit filling out a scenario and the step definitions to make them no longer pending in one commit. Then I commit spec examples and the come which makes them pass in logical chunks until the scenario passes. Once it passes, the whole suite runs again automatically, and I see if I've broken anything. If I have, I fix it then. When I get the "all green", I can fill out a new scenario and start the cycle again. I think of these as "micro-iterations", since I reevaluate the direction I'm going in between these iterations. A bunch of these micro-iterations together form an "iteration" in he Agile/XP sense, where I've built something I can show to the client/customer/boss again for feedback. At this point I can merge my branch into master or another longer-running branch. Because of this workflow, I'm ok with committing code with broken features, and even broken specs if they're not related to what I've been doing. At the end of a micro-iteration, though, everything needs to pass. > I guess this may more be due to our codebase being a bit badly organised so > that the conventions autospec relies on aren't always adhered to... Yeah, that can be a killer. If you have your own conventions, though (and you should), you can modify the mappings in your .autotest file to match. See the Autotest#add_mapping rdoc for more info. Peter ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Autospec does not work w/ cucumber features?
On Sat, Dec 6, 2008 at 7:04 AM, Kero van Gelder <[EMAIL PROTECTED]> wrote: > $ AUTOFEATURE=true autospec # bug! prompt returns immediately, ZenTest > gem not a dependency? a warning that autotest was not found would be nice. Huh. The autospec command comes from RSpec; do you have this issue without setting AUTOFEATURE=true? Peter ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Update RSpec but have a problem!
On Sat, Dec 6, 2008 at 12:00 PM, Antonio Faust45 <[EMAIL PROTECTED]> wrote: > rake spec > ** Invoke spec (first_time, not_needed) > and specs not started! Oh! I' having the same problem and I just solved it! Well, half-solved it. Rake, like make, operates on files. If you say "make somebinary" make will run certain command expecting that they will build the file "somebinary". It knows which source files that file depends on, so if "somebinary" exists and is newer than the files it depends on it won't bother to run the commands. It's already the newest version. Rake is usually used for bits of script, and not to build files. However, it can be used much like make. Here's what's going on. Rake doesn't know about a task named "spec". It *does* know about a *directory* named "spec" though, and it will try to "build" it. It doesn't seem to depend on anything, though, so the task is marked "not_needed". It's like trying to build "somebinary" when make knows it's already up-to-date. So that explains the silent treatment. But why don't you have a spec task? That, you'll have to figure out for yourself. Is this a Rails project? If so, look for a lib/tasks/rspec.rake file. If not, look in your Rakefile. If you don't have a :spec task defined in there, there's your problem! :) Peter ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Update RSpec but have a problem!
Thanks Pit! -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Autospec does not work w/ cucumber features?
> > $ AUTOFEATURE=true autospec # bug! prompt returns immediately, ZenTest > > gem not a dependency? a warning that autotest was not found would be nice. > > Huh. The autospec command comes from RSpec; do you have this issue > without setting AUTOFEATURE=true? Yup. But as I only have features, I would not expect it to do anything in that case ;) Bye, Kero. ___ How can I change the world if I can't even change myself? -- Faithless, Salva Mea ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Autospec does not work w/ cucumber features?
Kero van Gelder wrote: $ AUTOFEATURE=true autospec # bug! prompt returns immediately, ZenTest gem not a dependency? a warning that autotest was not found would be nice. Huh. The autospec command comes from RSpec; do you have this issue without setting AUTOFEATURE=true? Yup. But as I only have features, I would not expect it to do anything in that case ;) Bye, Kero. Perhaps the problem is related to that.. if you add a spec or two what happens? -Ben ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] 'And' step definition
Mark Wilden wrote: > Thanks for your replies, David and James. I figured as much, actually, > since > you wouldn't want to have some And steps in your definition file and > some > Given steps. > > I was led astray by "Inside a step_definitions.rb file, steps (which > strictly speaking should always be called step definitions) refers to > the * > matcher* methods, given exactly the same names (Given, When, Then, or > And), > each provided with a matcher regexp that corresponds to one or more > feature > steps" in James's backgrounder. Maybe I misunderstood it. > That aspect of cucumber, that Given == When == Then, is elaborated later in the article but I have added further clarification at that point as well. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] stepping across features
Yup, very much so IMO 2008/12/5 James Byrne <[EMAIL PROTECTED]> > Andrew Premdas wrote: > > Pretty hard for me to comment with so much stuff and so little context. > > However :) > > My messages are quite long enough as it is I am afraid. > > > about a work order to produce invoices. You have to do some design and > > thinking to produce good features. Challenge assumptions and try and see > > things from different view points. For example why can't I just do > > > > Given outstanding payments > > When I visit the make invoices page > > I should see a list of invoices I can create > > > > And then do some other little scenarios to create an invoice etc.. > > > > HTH > > It always helps to have another point of view. I am grappling with this > issue mentally before committing myself to a line of approach. This > project is, as you surmise, a conversion of an existing body of work > into a new form. It is also anticipated that the existing application > will be extended in many areas. The scope of the project encompasses > everything from General Ledger down to edi transmission of tax documents > to the federal government. > > I am trying to determine whether the way to control and document this > project while focusing programming activity is best served by using BDD > features or whether those objectives should be satisfied otherwise and > BDD features only used for specific implementation issues. Part of my > difficulty is my limited vocabulary for expressing this and part is my > want of experience with this form of design and development. My > previous experience was with much less sophisticated tools than I am > currently using and I am reluctant to turn a scalpel into a screwdriver > out of ignorance on my part. On the other hand, if a jack hammer is > needed then a scalpel is not of much use. > > So reworking my earlier effort: > > Feature: Bill chargeable work > In Order To generate income > A Billing Clerk > Should be able to create invoices > To Increase Revenue > > Scenario: Manual Invoice Release >Given billable charges >When I visit the create an invoice page >Then I should see a list of all billable charges > > Scenario: Manual Invoice Release by Client >Given billable charges >When I visit the create an invoice page > And I search for client "Y" >Then I should see a list of all billable charges only for client "Y" > > Is this getting closer to what my features should look like? > > -- > Posted via http://www.ruby-forum.com/. > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Indentation Conventions for Ruby and Cucumber
Original post was somewhat flippant :) To be more precise. This style is "aligning on the first letter of the second word" and basically is treating the first word as a label and the rest as content, and using indentation to differentiate (hopefully clearly) Andrew 2008/12/6 Mikel Lindsaar <[EMAIL PROTECTED]> > On Thu, Dec 4, 2008 at 1:27 AM, Andrew Premdas <[EMAIL PROTECTED]> wrote: > >> Oh but cucumber features so want to be idented on the I >> >> Scenario: Anonymous user can not duplicate a un-activated account >>Given I am an anonymous user >> And a registered user Fred exists >> When I signup as Fred >> Then I should see an error >> >> Really need to view above with a monspaced font - if its not coming out >> that way in your mail reader. >> > > The problem with that however is that it is not compliant with > Internationalization standards... > > Not to mention it would then naturally bias someone toward using an > enforced I. > > What if I didn't want to use an "I", but an "it" say, in terms of an API > that is being talked to by another system... > > -- > http://lindsaar.net/ > Rails, RSpec and Life blog > > > > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users