[rspec-users] Testing Generators

2008-10-07 Thread Pau Cor
Hi, I have started writing my own generators, and I was wondering if anyone had any suggestions for testing them. I know I could just run the generator in a dummy application; write my tests; and then copy the tests back into the generator. But that seems backwards. Any ideas? Thanks -- Posted

Re: [rspec-users] Testing Generators

2008-10-07 Thread Pau Cor
Scott Taylor wrote: > Why don't you generate the specs when you generate the code? That's what I thought I'd have to do. The reason I'm reluctant to do it is that either I need to write the real code first (and not tests first). Or I need to rerun my generator every time I write a new test (or

[rspec-users] Cucumber changes between 0.1.8 and edge

2008-10-31 Thread Pau Cor
When I run `rake features` after adding cucumber v0.1.8 to my rails app (as a plugin), I get success. But when I upgrade to edge, I get this error: " |/home/paul/sc/ror/cebu_heroku/vendor/plugins/cucumber/bin/../lib/cucumber/formatters/pretty_formatter.rb:205:in `ljust': no implicit conversion f

Re: [rspec-users] Cucumber changes between 0.1.8 and edge

2008-11-01 Thread Pau Cor
Barry Mitchelson wrote: > This sounds like the issue I had here > http://rspec.lighthouseapp.com/projects/16211/tickets/60-patch-next_column_index-not-resetting-after-large-tables. > Is there a feature running before this one with a scenario table with > at > least 2 more columns than the one in th

Re: [rspec-users] Caboosers drop RSpec

2008-11-05 Thread Pau Cor
Alex Satrapa wrote: > I can't understand why people who are serious about production > environment stability would install multiple applications in the same > environment. It's not healthy. One very nice way to do this is to run each app with its own user, then have a ~/.gems directory. Then you

Re: [rspec-users] Sharing the little dialects we write in Cucumber

2008-11-08 Thread Pau Cor
Matt Wynne wrote: > What do people think? Is this stuff so trivially easy to other people > that they prefer just to write it from scratch? I think that sharing these will be a really good way to help people learning Cucumber write better features and steps. Writing cucumber features that pass i

Re: [rspec-users] More Examples

2008-11-17 Thread Pau Cor
James Byrne wrote: > This is what I see in the console: The underlining didn't come through in you post, so that doesn't help us. If you post your step matchers, then we can tell you what your columns need to be. Essentially, for every (.*) in your step matchers, you need a column. And they hav

[rspec-users] specifying which button webrat should press

2008-11-19 Thread Pau Cor
I was writing a feature in which I had webrat push a button. However, there are many buttons on this page with the same text. I wanted to specify which one would be push in as close a way I could to the way a person would describe which one he was pushing. Here is what I ended up with: #custom_web

Re: [rspec-users] specifying which button webrat should press

2008-11-19 Thread Pau Cor
aslak hellesoy wrote: > give buttons unique dom ids and pass the id to #clicks_button ? Of course that's the easy way to do it :) I was hoping to keep my stories a bit closer to English. Plus then I'd need some extra instance variable so that step can calculate the dom_id. Here is an example o

Re: [rspec-users] specifying which button webrat should press

2008-11-20 Thread Pau Cor
Andrew Premdas wrote: > And I accept Fred's invite > scans better than > And I push "accept" near "Fred" That definitely is better. I guess I was trying to be too broad. My original goal was to write a match that would work on any page with multiple links/buttons (of the same name). It see

Re: [rspec-users] Just trying out cucumber

2008-11-24 Thread Pau Cor
Shane Mingins wrote: > Hi > > Just giving cucumber a trial with a Rails application and was wanting > some feedback on what I did for my project token that is a system > generated value > >Scenario: Register new project > Given I am logged in > And I am on the new project page

Re: [rspec-users] Spec'ing via features

2008-11-24 Thread Pau Cor
Pat Maddox wrote: > Here's my latest Theory of Testing, in a nutshell: I really understand what you are getting at. However, as I less experienced developer (my degree is actually in business) I have found that having more unit tests (for models and controllers) helps ensure that I write better

Re: [rspec-users] Just trying out cucumber

2008-11-24 Thread Pau Cor
Shane Mingins wrote: > I'm not an expert at regexpr the output on screen is: I'm no regex expert, but it is such a useful skill I'm always trying to improve. This might do it for you: /\\s*\Token\:\<\/b\>\s*[a-f0-9]{40}\s*\<\/p\>/m Cheers, Paul -- Posted via http://www.ruby-forum.com/. _

Re: [rspec-users] Just trying out cucumber

2008-11-24 Thread Pau Cor
Pau Cor wrote: > /\\s*\Token\:\<\/b\>\s*[a-f0-9]{40}\s*\<\/p\>/m On second thought, you might want to make that regex more generic. When you refactor your view code (i.e. insert divs, add ids/classes, and get rid of the tags--which are evil) then your test won't break. The

[rspec-users] matcher to see if radio button is selected at page load

2008-11-25 Thread Pau Cor
Hi. I'm trying to write a matcher to make sure a radio button is selected when the page loads. I got this at the moment: When /^I leave "(.*)" selected$/ do |label| field = field_labeled label unless field.instance_variable_get("@element")['checked'] && field.instance_variable_get("@element")

Re: [rspec-users] matcher to see if radio button is selected at page load

2008-11-25 Thread Pau Cor
Zach Dennis wrote: > response.should > have_tag("input[type=radio][checked=checked][name=?][valued=?]", > "your[button]", "foo") Wouldn't that require me to do this: My label My validator is saying that is not valid XHTML. Thanks for the suggestion. I definitely haven't looked into the power of

Re: [rspec-users] could one scenario depend on another in cucumber?

2008-11-26 Thread Pau Cor
Newman Huang wrote: > I think it is a common test case you would meet. For example, you want > to test a user registry scenario. You write: > > Scenario: User Registry >When I dosth >Then I dosth >... > > And now business has some changes. Register should have to activate his > accoun

Re: [rspec-users] could one scenario depend on another in cucumber?

2008-11-27 Thread Pau Cor
Matt Wynne wrote: > I think I might be right in saying that technique is likely to be > deprecated in the future. I don't think it's recommended anymore. See > my earlier response. Thanks Matt. That is good to know. Paul -- Posted via http://www.ruby-forum.com/. _

[rspec-users] Sample App - TDD with Cucumber and RSpec

2008-12-01 Thread Pau Cor
Hi, I just posted a tiny app that I put together for a presentation on Cucumber. http://github.com/thoughtless/cuc_demo/tree/master This essentially mirrors the workflow that I strive towards. (The README explains more.) I don't want to put myself out there as the standard to immitate, but I thin

Re: [rspec-users] Sample App - TDD with Cucumber and RSpec

2008-12-02 Thread Pau Cor
Fernando García Samblas wrote: > IMHO it would be nice to have instead a "context_definitions.rb" with > common "givens" (similar to navigation_definitions.rb) and there a more > general definition, like for instance: ... > Given /^there are no (.*)$/ do |thing| I really like that. It will make

[rspec-users] calling multiline steps from other steps

2008-12-04 Thread Pau Cor
What is the syntax for calling multiline steps from other steps? I'd like to do something like this: Given /^I have filled in the form$/ do |details| details.hashes.each |pair| When "I fill in #{pair['field']} with #{pair['value']}" end end Given /^(.*) has filled in the form$/ do |user,

Re: [rspec-users] calling multiline steps from other steps

2008-12-04 Thread Pau Cor
Ben Mabey wrote: > you will just have to > experiment and see. Thanks for the reply! So far all my experiments have failed :/ Anyone else have any ideas? Paul -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge

Re: [rspec-users] calling multiline steps from other steps

2008-12-22 Thread Pau Cor
Aslak Hellesøy wrote: > And please link to this thread in the ticket. Nabble or somesuch. I am sorry for taking so long to post the ticket: http://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/144-call-multiline-steps-from-other-steps -- Posted via http://www.ruby-forum.com/. _

Re: [rspec-users] understanding "within"

2008-12-23 Thread Pau Cor
Sarah Allen wrote: > What if I wanted to destroy the lorry with "name 3" instead of the 3rd > lorry? I was trying to solve a similar problem a few weeks ago. You might be interested in the response I got: http://www.ruby-forum.com/topic/171269 HTH Paul -- Posted via http://www.ruby-forum.com/.

Re: [rspec-users] [Cucumber, Webrat] I should see behaves strangely with html

2009-01-18 Thread Pau Cor
Can you please post the contents of your step definition? -- 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] [Cucumber, Webrat] I should see behaves strangely with html

2009-01-19 Thread Pau Cor
Fernando Perez wrote: > However yesterday I looked in the code of a project (mephistoblog was > it?), and I noticed that they have: config.gem 'nokogiri' in > environement.rb. I don't have it, is it compulsory for correctly parsing > the response body? I don't have config.gem 'nokogiri' in envi

Re: [rspec-users] testing javascript-heavy websites

2009-01-23 Thread Pau Cor
> I have had some trouble > with ajax-heavy stuff but never took the time to sort it out. I had some trouble too at first. Some things that seem like they _should_ work just don't. But I seem to have gotten past it. If anyone has a specific problem post here, and I'll give it a try :) Or you c