[rspec-users] Pretty HTML reporting for stories

2008-06-02 Thread Matt Wynne
Hi all, I'm just getting to grips with rspec, and I'm trying to put together a showy demo. We're trying to use the (plain text) stories feature, rather than the specs. I'd like to show off a fancy HTML report of the results if possible. So it seems I can do this from the spec command line tool,

Re: [rspec-users] Pretty HTML reporting for stories

2008-06-02 Thread Matt Wynne
Ben Mabey wrote: The spec command is just for specs. Although the story runner now uses the same command line option parser. So you can pass in the args when running your runner file. Like so: ruby story.rb -f=html or the verbose way: ruby story.rb --format=html Man, you gentlemen are

Re: [rspec-users] Autotest Doesn't Run Old Test::Unit Tests After Install

2008-08-06 Thread Matt Wynne
David Chelimsky wrote: The latest rspec code in git introduces an autospec command that runs specs, leaving autotest to run the stuff in the test directory. This doesn't solve your problem, but might be useful information. To run both tests and specs you'll have to add a .autotest file and

[rspec-users] Straw Poll: How are you using plain text stories (in rails)?

2008-08-06 Thread Matt Wynne
Hi all, I've been using rspec / rails for just over a week now, and I'm loving the specification framework. The way I can group examples together feels really natural, and I'm finding the TDD flow terrific. Thus far I've used the describe / it should... syntax to basically do TDD of my

Re: [rspec-users] Straw Poll: How are you using plain text stories (in rails)?

2008-08-06 Thread Matt Wynne
Joseph Wilk wrote: If you are using JRuby a nice tool which wraps the Java HtmlUnit is Celerity: http://celerity.rubyforge.org/ At the moment I'm yet to see something like HtmlUnit on the ruby platform. I watch Celerity in envy :) Interesting. On the surface HtmlUnit looks just like webrat

Re: [rspec-users] Granularity in stories (was Straw Poll: How are you using plain text stories (in rails)?)

2008-08-06 Thread Matt Wynne
Rahoul Baruah wrote: The thing that's been holding me back is the granularity. Do you try and write a scenario for every possible case? It might help to have a look at the thread that starts here: http://www.benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories/ Its

Re: [rspec-users] Straw Poll: How are you using plain text stories (in rails)?

2008-08-06 Thread Matt Wynne
Note that there's also some existing discussion on this list that I just found (with a search for 'RailsStory'): http://www.ruby-forum.com/topic/156930#new -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org

Re: [rspec-users] Someone please name this matcher for me

2008-08-06 Thread Matt Wynne
How about [1, 2, 3, 4, 1].should contain([1, 3, 1, 4, 2]) [1, 2, 3, 4, 1].should contain_only([1, 3, 1, 4, 2]) or (riffing off Zach) [1, 2, 3, 4, 1].should be_composed_from([1, 3, 1, 4, 2]) Matt -- Posted via http://www.ruby-forum.com/. ___

[rspec-users] Proper Encapsulation of SQL WHERE / ORDER BY Clauses

2008-08-15 Thread Matt Wynne
Hi TDD Fans, I'm pretty new to Ruby / RSpec / Rails but not to TDD. This is more of a general 'how do you do good design in a rails app' question than an rspec-specific question. I'm asking it here because I know this list is read by lots of people who care about good design, but please

Re: [rspec-users] Any news on the rSpec books?

2008-08-15 Thread Matt Wynne
Aidy Lewis (who posts on here from time to time) and I were using RSpec at a .NET shop, using the story runner as a layer over Watir to drive ASP.NET websites, and I know Aidy is still carrying on with that work. I'd suggest including a chapter about how to drive non-ruby apps through

Re: [rspec-users] Proper Encapsulation of SQL WHERE / ORDER BY Clauses

2008-08-15 Thread Matt Wynne
On 15 Aug 2008, at 12:25, David Chelimsky wrote: Hey Matt - welcome! The paginate() method lives on the model class, so there's nothing stopping you from wrapping those calls in methods on the model, slinging around the params object. # CityController def get_cities

[rspec-users] Autotest and subclasses / namespaces

2008-08-15 Thread Matt Wynne
I am writing a controller admin/cities_controller.rb it inherits from AdminController, so it's defined like class Admin::CitiesController AdminController Whenever I save the controller file, autotest freaks out: uninitialized constant Admin::AdminController (NameError) I'm

Re: [rspec-users] Documentation for Plain-Text Stories

2008-08-18 Thread Matt Wynne
to pair on this? I am writing some stuff for the Watir site. I sent you some example code as well. Aidy On 12/08/2008, Matt Wynne [EMAIL PROTECTED] wrote: Can I help the project by writing some docs about the plain-text story runner for the rspec.info website? It would surely help me to get

Re: [rspec-users] Autotest and subclasses / namespaces

2008-08-18 Thread Matt Wynne
Thanks for the tips Ben. We upgraded to Rails 2.1 (from 1.x) on Friday and this seems to have gone away. I'll report back though if I learn anything else. cheers, Matt http://blog.mattwynne.net On 16 Aug 2008, at 20:32, Ben Mabey wrote: Matt Wynne wrote: I am writing a controller

Re: [rspec-users] Documentation for Plain-Text Stories

2008-08-18 Thread Matt Wynne
The RSpec Story runner is likely to be deprecated in favour of the new feature runner (temporarily called Cucumber). http://www.nabble.com/-ANN--Cucumber-td18876816.html And this is going to be distributed as a separate plug-in from RSpec? ___

Re: [rspec-users] Documentation for Plain-Text Stories

2008-08-18 Thread Matt Wynne
, aslak hellesoy wrote: On Mon, Aug 18, 2008 at 1:06 PM, Matt Wynne [EMAIL PROTECTED] wrote: The RSpec Story runner is likely to be deprecated in favour of the new feature runner (temporarily called Cucumber). http://www.nabble.com/-ANN--Cucumber-td18876816.html And this is going

Re: [rspec-users] Autotest and subclasses / namespaces

2008-08-18 Thread Matt Wynne
. On 18 Aug 2008, at 10:07, Matt Wynne wrote: Thanks for the tips Ben. We upgraded to Rails 2.1 (from 1.x) on Friday and this seems to have gone away. I'll report back though if I learn anything else. cheers, Matt http://blog.mattwynne.net On 16 Aug 2008, at 20:32, Ben Mabey wrote: Matt

Re: [rspec-users] Autotest and subclasses / namespaces

2008-08-18 Thread Matt Wynne
On 18 Aug 2008, at 14:27, David Chelimsky wrote: Check out the output from autotest: /usr/local/bin/ruby -S script/spec -O spec/spec.opts /Users/matt/Documents/projects/songkick/skweb/app/controllers/ admin/cities_controller.rb The fact that autotest is trying to load the controller file

[rspec-users] Argument Constraints where the Argument is a Hash

2008-08-18 Thread Matt Wynne
Hi folks, I have an object whose constructor I want to stub, specifying that it should be passed a hash containing an expected set of key / value pairs. Note that the actual hash might contain more key / value pairs, but I don't care, as long as my expected ones are there I thought I

Re: [rspec-users] Argument Constraints where the Argument is a Hash

2008-08-18 Thread Matt Wynne
2008, at 17:10, Matt Wynne wrote: Hi folks, I have an object whose constructor I want to stub, specifying that it should be passed a hash containing an expected set of key / value pairs. Note that the actual hash might contain more key / value pairs, but I don't care, as long as my

Re: [rspec-users] Proper Encapsulation of SQL WHERE / ORDER BY Clauses

2008-08-18 Thread Matt Wynne
Taylor wrote: On Aug 15, 2008, at 9:29 AM, David Chelimsky wrote: On Aug 15, 2008, at 6:46 AM, Matt Wynne [EMAIL PROTECTED] wrote: On 15 Aug 2008, at 12:25, David Chelimsky wrote: Hey Matt - welcome! The paginate() method lives on the model class, so there's nothing stopping you from

[rspec-users] Parameters and View Specs

2008-08-19 Thread Matt Wynne
Sigh. Sorry to ask such a dumb question, but I've hit one of those walls... I'm testing a view which uses the params[] hash directly. (Aside: is this bad form?) How the heckers do I set up the params hash in my test? I've tried calling render 'some/view', { :first_param = true }

Re: [rspec-users] When to mock

2008-08-19 Thread Matt Wynne
It's also, for me, nice to isolate the code I'm testing using mocks. So if I'm building a controller and I mock out the behaviour I will expect it to call on the model layer, I know that any failing tests must be due to bugs in the controller class, nowhere else. Coming from using an

Re: [rspec-users] I want RSpec for CSS layout.

2008-08-20 Thread Matt Wynne
+1 cheers, Matt http://blog.mattwynne.net http://songkick.com In case you wondered: The opinions expressed in this email are my own and do not necessarily reflect the views of any former, current or future employers of mine. On 20 Aug 2008, at 01:40, Jay Levitt wrote: I don't even

[rspec-users] stub_model() and ActiveRecord Associations

2008-08-26 Thread Matt Wynne
Hi all, I have what I thought was quite a simple requirement but something to do with the way ActiveRecord's associations work is making it quite puzzling. I guess I can sum it up with this failing test: before(:each) do @source_comment = @source.comments.create(:user_id

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-27 Thread Matt Wynne
On 27 Aug 2008, at 13:26, David Chelimsky wrote: On Wed, Aug 27, 2008 at 7:22 AM, Zach Dennis [EMAIL PROTECTED] wrote: On Wed, Aug 27, 2008 at 3:34 AM, Matt Wynne [EMAIL PROTECTED] wrote: Here's the basic deal: Model.find(1).equal?(Model.find(1)) = false AR does not cache objects, so when

[rspec-users] array_including()

2008-08-27 Thread Matt Wynne
I found myself having to write this today: class ArrayMatcher def initialize(array_to_match) @array_to_match = array_to_match end def ==(other) ok = true @array_to_match.each do |item| ok = ok and other.include?(item) end ok end end def

Re: [rspec-users] array_including()

2008-08-27 Thread Matt Wynne
, current or future employers of mine. On 27 Aug 2008, at 17:16, Matt Wynne wrote: I found myself having to write this today: class ArrayMatcher def initialize(array_to_match) @array_to_match = array_to_match end def ==(other) ok = true @array_to_match.each do |item

Re: [rspec-users] Four Question From an RSpec Baby - Give me something to chew

2008-08-27 Thread Matt Wynne
I have another, more general tip - read this book: http://www.amazon.com/Working-Effectively-Legacy-Robert-Martin/dp/ 0131177052 Michael's definition of Legacy Code is simply 'code that isn't covered by tests'. So... err... that would be your whole app! The book suggests chipping away at

Re: [rspec-users] Four Question From an RSpec Baby - Give me something to chew

2008-08-28 Thread Matt Wynne
On 28 Aug 2008, at 04:46, Scott Taylor wrote: Especially regressions. Usually you can get in a few extra specs when writing a regression that has nothing to do with the bug itself (it's a sort of testing after the fact - almost like proving theorems of an existing system). The Feathers

Re: [rspec-users] story vs feature (was Documentation for Plain-Text Stories)

2008-08-30 Thread Matt Wynne
On 29 Aug 2008, at 19:37, Dan North wrote: 2008/8/24 David Chelimsky [EMAIL PROTECTED] [...] Sadly, spec has just as much baggage, if not more, as test does. These days we're calling these things code examples, (tongue pressing into cheek) so maybe we should change the name to rcodeexample? Or

Re: [rspec-users] I want RSpec for CSS layout.

2008-08-30 Thread Matt Wynne
I have been in a few pub conversations now about 'photoshop-driven- development' where we show the machine what the page should look like (a photoshop mock-up), and keeps failing the build until we produce something that every browser can render to look like the mock-up. Surely with all

Re: [rspec-users] story vs feature (was Documentation for Plain-Text Stories)

2008-08-31 Thread Matt Wynne
On 30 Aug 2008, at 19:31, Scott Taylor wrote: On Aug 30, 2008, at 2:12 PM, Tero Tilus wrote: 2008-08-30 17:02, Matt Wynne: RuBehave Now _that's_ cool! I love it! Personally, I always liked the rbehave / rspec combo, of Mike Myers Ali G. Scott :) One of the main adoption

Re: [rspec-users] spec'ing the existence of #require

2008-08-31 Thread Matt Wynne
Could you put a mocking expectation on Kernel? (which is where #require is defined) Kernel.should_receive(:require).with(expected_file_name) On 31 Aug 2008, at 15:36, Chuck Remes wrote: I looked through the mailing list archive but unfortunately my search terms are too generic (spec and

[rspec-users] Cucumber: Running a single feature / scenario

2008-09-01 Thread Matt Wynne
Am taking cucumber for a first spin today - first impressions are good. How do I go about running a single feature or scenario so I don't have to run the whole lot when I'm working on a particular one? cheers, Matt http://blog.mattwynne.net http://songkick.com In case you wondered: The

[rspec-users] Cucumber: GivenScenario doesn't seem to work

2008-09-01 Thread Matt Wynne
I'm hardly a story-runner expert, so I may be making a dumb mistake here... I'm trying to get one scenario to run another as part of its Given clause. It looks like this: Scenario: Admin user merges two venues GivenScenario Admin user views two venues

Re: [rspec-users] Cucumber: GivenScenario doesn't seem to work

2008-09-01 Thread Matt Wynne
On 1 Sep 2008, at 21:34, aslak hellesoy wrote: On Mon, Sep 1, 2008 at 7:12 PM, Matt Wynne [EMAIL PROTECTED] wrote: I'm hardly a story-runner expert, so I may be making a dumb mistake here... The scenario Admin user merges two venues fails with this ugly backtrace: rake aborted! Command

Re: [rspec-users] Cucumber: Running a single feature / scenario

2008-09-01 Thread Matt Wynne
On 1 Sep 2008, at 21:30, aslak hellesoy wrote: cucumber --help Example: cucumber path/to/file.feature --line 33 Or with Rake: rake features FEATURE=path/to/file.feature CUCUMBER_OPTS=--line 33 It's not documented on the Wiki yet. Pass the line number of one of the steps. I think it's broken

Re: [rspec-users] specs pass when run with other app specs, but fail when run independently

2008-09-02 Thread Matt Wynne
functionality provided in the protected methods. Again, the fact that they have been specing the protected methods is an indication that another object may want to be born to handle the extra responsibility... +1. The desire to unit test private methods always rings the 'refactor: extract

Re: [rspec-users] Cucumber: Before(:all)

2008-09-02 Thread Matt Wynne
On 2 Sep 2008, at 15:24, aslak hellesoy wrote: On Tue, Sep 2, 2008 at 3:50 PM, Matt Wynne [EMAIL PROTECTED] wrote: Is there a way right now to run some setup code once after environment.rb has loaded but before all the scenarios are run? Yes. Just use Ruby :-) Put it at the main level

Re: [rspec-users] Cucumber: Before(:all)

2008-09-02 Thread Matt Wynne
I assume you've followed the Wiki instructions about how to set up Cucumber with Rails: http://github.com/aslakhellesoy/cucumber/wikis (I should move this to a separate Rails page) Then you should have a steps/env.rb file that looks like this:

Re: [rspec-users] Speccing the existance of an unchecked checkbox

2008-09-03 Thread Matt Wynne
On 3 Sep 2008, at 14:31, Bart Zonneveld wrote: On 3 sep 2008, at 15:28, David Chelimsky wrote: On Wed, Sep 3, 2008 at 6:56 AM, Bart Zonneveld [EMAIL PROTECTED] wrote: Hey list, I found myself trying to verify there are some non-checked checkboxes in a template today, and am kinda

[rspec-users] specifying a controller's layout

2008-09-04 Thread Matt Wynne
I want to spec that a controller uses a particular layout how do I do that? cheers, Matt http://blog.mattwynne.net http://songkick.com In case you wondered: The opinions expressed in this email are my own and do not necessarily reflect the views of any former, current or future

Re: [rspec-users] specifying a controller's layout

2008-09-04 Thread Matt Wynne
On 4 Sep 2008, at 16:12, Jonathan Linowes wrote: noting my own typo def negeative_failure_message should be def negative_failure_message :) Copy Paste Considered Harmfull ;) Thanks ___ rspec-users mailing list

Re: [rspec-users] Four Question From an RSpec Baby - Give me something to chew

2008-09-05 Thread Matt Wynne
* Pain when mocking usually points to potential design improvements +1 It's all about Behaviour Driven *Design*. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] do I use mocking (vs fixtures) for methods that produce results based on non-trivial SQL queries

2008-09-06 Thread Matt Wynne
On 5 Sep 2008, at 16:40, Ben Mabey wrote: Also - have you found a CI server that is working with git? On github you can find forks of cc.rb with added git support. I have been using it like a charm for months. In fact, the main thoughtworks github ccrb repo works with git now - we

Re: [rspec-users] scenarios on production data

2008-09-09 Thread Matt Wynne
On 9 Sep 2008, at 14:54, Ashley Moran wrote: On 8 Sep 2008, at 17:21, Jonathan Linowes wrote: Here's one example: lets say my app is a specialized CMS, where account owners can setup their own projects, pages and forms. I'd like to run scenarios against setups that users have created.

[rspec-users] cucumber - mark a step as pending

2008-09-09 Thread Matt Wynne
I love the way I can throw a call to pending() in the top of an unfinished RSpec example and stop it from failing the build. Is there a similar way to do such a thing with good ole' cucumber? cheers, Matt http://blog.mattwynne.net http://songkick.com In case you wondered: The opinions

Re: [rspec-users] Cucumber and fixtures/FixtureReplacement

2008-09-09 Thread Matt Wynne
Remember these things should use transactions, and may do that by default - the database will be wiped clean once the features have run. On 9 Sep 2008, at 18:22, Tim Glen wrote: Hey guys, I'd never used RSpec Stories before, so I decided to follow the apparent direction of the wind and

Re: [rspec-users] cucumber - mark a step as pending

2008-09-09 Thread Matt Wynne
It's by design, but I'm open for suggestions. David created a similar ticket yesterday: http://rspec.lighthouseapp.com/projects/16211/tickets/8-all-steps- after-a-failure-are-listed-as-skipped#ticket-8-1 Currently, only a failure (red) will cause subsequent steps to be skipped. In case

Re: [rspec-users] Best practices for sharing state between story steps?

2008-09-09 Thread Matt Wynne
On 9 Sep 2008, at 19:52, Jim Morris wrote: aslak hellesoy wrote: The debate seems to be whether step definitions should be stateful or not. In practice this is achieved by setting one or more @variables in a step and reusing them in a different step - all within a scenario. I think that

Re: [rspec-users] cucumber - mark a step as pending

2008-09-09 Thread Matt Wynne
On 9 Sep 2008, at 21:34, aslak hellesoy wrote: On Tue, Sep 9, 2008 at 8:46 PM, David Chelimsky [EMAIL PROTECTED] wrote: On Tue, Sep 9, 2008 at 12:47 PM, aslak hellesoy [EMAIL PROTECTED] wrote: On Tue, Sep 9, 2008 at 7:16 PM, David Chelimsky [EMAIL PROTECTED] wrote: Aslak - I think Matt is

Re: [rspec-users] RSpec in Rails -- HTTP methods

2008-09-10 Thread Matt Wynne
On 10 Sep 2008, at 19:49, Pat Maddox wrote: except you can't simply do that, because ActionPack is a rat's nest of dependencies. With that one sentence, you have summed up all the painful bits of my first five weeks on rails. Bring on merb :) cheers, Matt http://blog.mattwynne.net

Re: [rspec-users] mocking the shell command (Kernel module)

2008-09-12 Thread Matt Wynne
On 12 Sep 2008, at 14:12, Joaquin Rivera Padron wrote: what is the best (or any) way of mocking the running of shell commands? e.g. code like the following: def method %{ ls } end spec: it should list the directory contents shell = mock(Object) # %{} lives in Kernel module and its

Re: [rspec-users] cucumber gem install

2008-09-12 Thread Matt Wynne
On 12 Sep 2008, at 22:37, Damian Jones wrote: David Chelimsky wrote: On Fri, Sep 12, 2008 at 7:46 AM, aslak hellesoy [EMAIL PROTECTED] wrote: C:\gem install aslakhellesoy-cucumber Please get it with Git and build the gem yourself in the meanwhile. For anyone who's not sure about how to do

Re: [rspec-users] booting rails routing without a controller call

2008-09-12 Thread Matt Wynne
Worked perfectly, thank you. By moving our routes config into lib/routing/default_routes.rb, I can also get autotest to watch the file for changes - double bonus! On 12 Sep 2008, at 17:21, David Chelimsky wrote: On Fri, Sep 12, 2008 at 11:17 AM, Matt Wynne [EMAIL PROTECTED] wrote: We're

Re: [rspec-users] mocking the shell command (Kernel module)

2008-09-13 Thread Matt Wynne
able to: it should be mock alright do end 2008/9/13 Scott Taylor [EMAIL PROTECTED] On Sep 12, 2008, at 9:29 AM, Matt Wynne wrote: On 12 Sep 2008, at 14:12, Joaquin Rivera Padron wrote: what is the best (or any) way of mocking the running of shell commands? e.g. code like the following: def

[rspec-users] Factoring out code that creates specs

2008-09-15 Thread Matt Wynne
It's all gone a bit meta. I've started noticing patterns in my specs, where I want more than one class to satisfy a specific bunch of behaviours. I know I can use it_should_behave_like and this works in simple cases, but I want to be able to iterate around an array of values and generate

Re: [rspec-users] RCov / RSpec segfaults on Ubuntu

2008-09-15 Thread Matt Wynne
/) incorporating many of the fixes for rcov segfaults. So far none of the old standard crashes have crept back up. Give it a try and let me know how it works for you. -- Chad On Sat, Sep 13, 2008 at 6:36 AM, Matt Wynne [EMAIL PROTECTED] wrote: Hi all, I appreciate that this is not an RSpec question

Re: [rspec-users] w3 validation

2008-09-16 Thread Matt Wynne
On 15 Sep 2008, at 23:16, Zach Dennis wrote: On Mon, Sep 15, 2008 at 5:32 PM, Jonathan Linowes [EMAIL PROTECTED] wrote: Hi, suggestions how to add w3 validation to a story step? eg Then the page should be valid You could write a then step that takes the current response.body, uploads it to

Re: [rspec-users] Cucumber - stub! or mock?

2008-09-16 Thread Matt Wynne
On 15 Sep 2008, at 21:14, Tim Glen wrote: Hey all, I've got some code that I (mostly) inherited. It essentially has a couple of AR class methods that look for a specific record by id: class Project ActiveRecord::Base class self def specific_project @another_specific_project

Re: [rspec-users] runner does not pick steps. help please

2008-09-16 Thread Matt Wynne
On 16 Sep 2008, at 15:34, Nubee Rails wrote: David Chelimsky wrote: On Tue, Sep 16, 2008 at 12:30 AM, Nubee Rails [EMAIL PROTECTED] wrote: Please help me to understand why runner is not picking steps. http://pastie.org/273126 Need a little more information: What command are you using to

Re: [rspec-users] Cucumber - stub! or mock?

2008-09-16 Thread Matt Wynne
On 16 Sep 2008, at 15:41, Tim Glen wrote: Matt - in terms of subclassing it, I have the entire stable of projects, 1 internal project and 1 slush fund project. If I'm subclassing the project, I assume that I still need to have a record for them in the database that needs to be findable. So

Re: [rspec-users] Factoring out code that creates specs

2008-09-16 Thread Matt Wynne
On 16 Sep 2008, at 14:28, David Chelimsky wrote: Hi Matt, On Mon, Sep 15, 2008 at 12:28 PM, Matt Wynne [EMAIL PROTECTED] wrote: It's all gone a bit meta. I've started noticing patterns in my specs, where I want more than one class to satisfy a specific bunch of behaviours. I know I can

Re: [rspec-users] autospec is not picking latest changes

2008-09-16 Thread Matt Wynne
try script/autospec instead - I always use that these days. not sure what the difference is. On 16 Sep 2008, at 20:20, Luis Lavena wrote: On Tue, Sep 16, 2008 at 4:18 PM, Luis Lavena [EMAIL PROTECTED] wrote: Hey Guys. I just updated a project form 1.1.4 that was working with autotest 3.10

Re: [rspec-users] Cucumber: pending specs

2008-09-17 Thread Matt Wynne
We found that we can raise a Cucumber::Pending error in the step matcher to achieve the same effect, though in practice we're tending to just write PENDING in the feature and break the link to the step matcher. Actually something that would really help us is the ability to comment out

Re: [rspec-users] help on skipping a before_filter for a story

2008-09-17 Thread Matt Wynne
We just write a step that says 'Given I am logged in' which actually walks through the login process on the screens (fills_in :username etc). However you could have another step like 'Given authenication is disabled on the site' which does something dirty to your ApplicationController

Re: [rspec-users] webrat the way to go?

2008-09-17 Thread Matt Wynne
On 9 Sep 2008, at 05:42, DyingToLearn wrote: Hi, Here is the short version of my question: For stories, is webrat the way to go? How many of you use webrat? How many don't? Here is the long version: I have been writing specs for some time now. I have noticed that once I learned how to write

[rspec-users] Specing the Precedence of Rails Routes

2008-09-19 Thread Matt Wynne
Sorry that this is only a tentatively RSpec-related question folks. I had a bug today which was caused by two routing resources being specified in a particular order: map.resources :comments map.resources :posts, :has_many = :comments When I was in the CommentsController, rendering the

Re: [rspec-users] Database clearing

2008-09-20 Thread Matt Wynne
On 20 Sep 2008, at 01:59, Scott Taylor wrote: There's another approach though that I haven't tried yet. One of the guys I work with truncates all the tables in the db before every example. He says this runs as fast or faster than transactional fixtures, and has the added benefit of NOT being

Re: [rspec-users] Running cucumber distributed across hardware

2008-09-23 Thread Matt Wynne
On Mon, 22 Sep 2008 21:57:20 -0400, Scott Taylor [EMAIL PROTECTED] said: On Sep 22, 2008, at 8:11 PM, Bryan Helmkamp wrote: At my job, our story suite contains over 500 scenarios. While we're very happy with the regressions we've caught by running the suite, the long time it takes (~

[rspec-users] Separating black sheep examples from the rest

2008-09-23 Thread Matt Wynne
So we've got a pretty decent number of specs now, and despite my best efforts, AR is just forcing us down the path of having to use database interaction for some of the model specs. It's starting to get tiring to run all the specs now, which is making me sad, and making me worry about how

Re: [rspec-users] Separating black sheep examples from the rest

2008-09-23 Thread Matt Wynne
On 23 Sep 2008, at 16:25, Joseph Wilk wrote: Matt Wynne wrote: So we've got a pretty decent number of specs now, and despite my best efforts, AR is just forcing us down the path of having to use database interaction for some of the model specs. Just out of curiosity, I would be interested

Re: [rspec-users] Separating black sheep examples from the rest

2008-09-23 Thread Matt Wynne
On 23 Sep 2008, at 16:49, Pat Maddox wrote: Matt Wynne [EMAIL PROTECTED] writes: So we've got a pretty decent number of specs now, and despite my best efforts, AR is just forcing us down the path of having to use database interaction for some of the model specs. Why don't you put

Re: [rspec-users] rspec and rspec-rails install hell - autotest

2008-09-23 Thread Matt Wynne
that's actually good - mine is broken an will only run specs. use script/autospec to run specs. now you can run both at once! On 23 Sep 2008, at 23:03, Fernando Perez wrote: I have one last problem. Now autotest only executes tests that sit in test/ folder, and doesn't seem to run the specs.

[rspec-users] Cucumber: listing redundant step matchers

2008-09-24 Thread Matt Wynne
Is there any way currently to list out the step matchers that were never used when you run a set of features? This would help me keep our step files tidy. If not, some pointers to how I might write such a thing would be cool :) cheers, Matt http://blog.mattwynne.net http://songkick.com

Re: [rspec-users] Separating black sheep examples from the rest

2008-09-24 Thread Matt Wynne
On 23 Sep 2008, at 17:11, Ben Mabey wrote: Matt Wynne wrote: So we've got a pretty decent number of specs now, and despite my best efforts, AR is just forcing us down the path of having to use database interaction for some of the model specs. To turn my real database on for individual

Re: [rspec-users] Problem testing method

2008-09-24 Thread Matt Wynne
On 24 Sep 2008, at 13:35, Carlos Rafael Belizón Ibáñez wrote: Hi, I have one problem testing one method to learn rSpec. This is the example #foo.rb class Foo ActiveRecord::Base has_one :bar def foo @bar.bar -= - 1 end end #bar.rb class Bar ActiveRecord::Base end #foo_spec.rb

Re: [rspec-users] Problem testing method

2008-09-24 Thread Matt Wynne
On 24 Sep 2008, at 14:38, David Chelimsky wrote: On Wed, Sep 24, 2008 at 8:23 AM, Matt Wynne [EMAIL PROTECTED] wrote: On 24 Sep 2008, at 13:35, Carlos Rafael Belizón Ibáñez wrote: If you create a mock object using mock_model(), or mock(), you have to stub or mock absolutely all

Re: [rspec-users] Problem testing method

2008-09-25 Thread Matt Wynne
On 24 Sep 2008, at 16:02, Carlos Rafael Belizón Ibáñez wrote: Sorry, before I wrote with errors the example (it's the problem if you are remember without code at your face). This is the correct example with the suggestions to fix the problem: #foo.rb class Foo ActiveRecord::Base has_one

Re: [rspec-users] Problem testing method

2008-09-25 Thread Matt Wynne
On 25 Sep 2008, at 11:51, Carlos Rafael Belizón Ibáñez wrote: And I got this error: 4) Spec::Mocks::MockExpectationError in 'Alineado.cambiar_por with the game in play and sustitutions aviable should decrement in one the sustitutions aviables' Mock 'Partido_1004' received unexpected message

Re: [rspec-users] Problem testing method

2008-09-25 Thread Matt Wynne
What way it's better to test this method? Using a real instance of game, or using a mock? It basically depends on how complex Game is. In this simplistic example, there's really no harm in testing both objects together at the same time, but nine times out of ten in the real world, you

[rspec-users] BDD / cucumber thought - chaining 'Then' steps with Which

2008-09-26 Thread Matt Wynne
Going back to the debate about keeping state between steps, I found myself with the mild urge to be able to write this today: Given there is a user And the user has 20 friends Then I should see a thumbnail of each of the users's friends Which should be a link to the user profile page for that

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Matt Wynne
On 26 Sep 2008, at 12:31, Ashley Moran wrote: On 25 Sep 2008, at 17:48, Mark Wilden wrote: Each controller action only calls one model method other than an initial find or new.. I didn't get that article[1] (or, rather, that particular subarticle) at all. I kinda tuned out when I read,

Re: [rspec-users] BDD / cucumber thought - chaining 'Then' steps with Which

2008-09-26 Thread Matt Wynne
On 26 Sep 2008, at 13:33, David Chelimsky wrote: On Fri, Sep 26, 2008 at 6:30 AM, Matt Wynne [EMAIL PROTECTED] wrote: Going back to the debate about keeping state between steps, I found myself with the mild urge to be able to write this today: Given there is a user And the user has 20

Re: [rspec-users] BDD / cucumber thought - chaining 'Then' steps with Which

2008-09-26 Thread Matt Wynne
On 26 Sep 2008, at 13:59, Josh Chisholm wrote: Stories without shared state feel clunky to me, because we would never speak that way. I also had a similar urge, don't know if it's a programmer urge: Given a user With the name 'josh' And the password 'sesame' ...so I don't end up with an

Re: [rspec-users] RSpec makes me want to write better code

2008-09-27 Thread Matt Wynne
On 26 Sep 2008, at 17:28, Mark Wilden wrote: On Fri, Sep 26, 2008 at 8:28 AM, Ashley Moran [EMAIL PROTECTED] wrote: One downside to STI is it forces you to leave NULL columns for attributes that don't exist in all models. This is also really bad for integrity. I think all of your

Re: [rspec-users] RSpec makes me want to write better code

2008-09-30 Thread Matt Wynne
I like them much better than the gremlins. On 30 Sep 2008, at 14:09, Dan North wrote: We do have pixies! They do all the magic stuff. How else do you think it happens? ;) 2008/9/27 aslak hellesoy [EMAIL PROTECTED] On Sat, Sep 27, 2008 at 10:32 PM, David Chelimsky [EMAIL PROTECTED] wrote:

Re: [rspec-users] Using the response object in stories

2008-09-30 Thread Matt Wynne
I'm sure it's possible, but sorry I don't know how offhand. I'll tell you what I know and see if it's enough to help you figure it out for yourself. The code you write in cucumber steps (which calls webrat) runs inside the context of a rails ActionController::Integration::Session. Have a

Re: [rspec-users] Using the response object in stories

2008-09-30 Thread Matt Wynne
Cool. Be aware that you're by-passing webrat by using the post method - that's one of the 'raw' rails calls that webrat wraps up in its elegant set of methods. It may be that you can pass this same hash to clicks_button but I don't know - you'd have to check the webrat source. On 30

Re: [rspec-users] [ANN] Cucumber Textmate Bundle

2008-10-01 Thread Matt Wynne
Is it possible to rename the project maybe? I know you can have dots in the name - e.g. http://github.com/thoughtworks/cruisecontrol.rb though I think I may have heard this was a restriction that was lifted relatively recently. On 18 Sep 2008, at 20:42, Jay Levitt wrote: Ben Mabey wrote:

Re: [rspec-users] [ANN] Cucumber Textmate Bundle

2008-10-01 Thread Matt Wynne
Just installed this - superb! Thanks Ben. On 17 Sep 2008, at 19:42, Ben Mabey wrote: Hey all, I am in the process of porting my RSpec Story Textmate bundle over to Cucumber. So far I have the syntax highlighting, file switching, and running of the features and single scenarios done. So not

Re: [rspec-users] [ANN] Cucumber Textmate Bundle

2008-10-01 Thread Matt Wynne
How about - can you somehow fork it to the new name, thereby keeping the old things up and running but blazing a new and shiny train from henceforth? Otherwise, it's gotta be a no, hasn't it? On 1 Oct 2008, at 19:12, Ben Mabey wrote: Ben Mabey wrote: Matt Wynne wrote: Is it possible

Re: [rspec-users] Cucumber 0.1.7 released

2008-10-05 Thread Matt Wynne
Shame we didn't see you at Citcon, Aslak, but I'm glad to hear you were doing something useful instead! Looking forward to playing with the new toys. cheers, Matt On 5 Oct 2008, at 17:55, aslak hellesoy wrote: I just released 0.1.7 as a gem. (As usual, it will take a few hours before it

Re: [rspec-users] would I stub an existing class method out or use fixtures in this scenario?

2008-10-05 Thread Matt Wynne
On 5 Oct 2008, at 12:26, Greg Hauptmann wrote: BankAccount.any_instance.stubs(:balance?).returns(as required)). Do people normal use the any_instance.stubs approach to stub out existing classes already developed, as a means to minimize associated Is this any_instance thing in the rspec

Re: [rspec-users] would I stub an existing class method out or use fixtures in this scenario?

2008-10-05 Thread Matt Wynne
On 5 Oct 2008, at 12:26, Greg Hauptmann wrote: Hi, Would the BDD experts recommend I either (a) use fixtures for data or (b) stub out existing class methods for such a scenario? Scenario = Working on a populate for future transactions method testing this. It generates transactions table

Re: [rspec-users] would I stub an existing class method out or use fixtures in this scenario?

2008-10-05 Thread Matt Wynne
On 5 Oct 2008, at 21:56, Scott Taylor wrote: On Oct 5, 2008, at 4:47 PM, Matt Wynne wrote: On 5 Oct 2008, at 12:26, Greg Hauptmann wrote: BankAccount.any_instance.stubs(:balance?).returns(as required)). Do people normal use the any_instance.stubs approach to stub out existing classes

Re: [rspec-users] Uninitialized constant Spec:Story

2008-10-06 Thread Matt Wynne
Mark, what nobody seems to a have mentioned on this thread is that you're using a branch of the story runner that's probably going to be retired. There's no reason why you should know - the rspec.info site is a bit out of date in this regard. I'd encourage you to read this:

Re: [rspec-users] post authentication token

2008-10-07 Thread Matt Wynne
This is actually a pretty tough problem for a newbie, and sent me reeling away from the story runner with my gumption in tatters the first time I tried it. You could probably figure out how to post an authentication token in the HTTP headers if you use the basic underlying rails

Re: [rspec-users] fills_in NoMethodError

2008-10-09 Thread Matt Wynne
On 9 Oct 2008, at 02:55, Mark Thomson wrote: I have an RSpec story with an overall structure that looks something like this - Given the user is on the start page When the user clicks the 'new' button Then the 'new record' page should be displayed When the user fills in the form And the

  1   2   3   4   5   6   >