Re: [rspec-users] before(:all) and nested contexts

2009-07-09 Thread Daniel Tenner
gt;> end >> >> it "should do another thing" do >> @variable.should do_another_thing >> end >> end >> >> def some_expensive_operation >> p "in here" >> end >> end >> >> (also uploaded to http

Re: [rspec-users] before(:all) and nested contexts

2009-07-09 Thread Daniel Tenner
To answer myself, I've put together the following work-around: http://www.swombat.com/getting-rspec-beforeall-and-nested-contexts-w Still, would love to know if there was a better, less hackish way to do it. Daniel On Thu, Jul 9, 2009 at 11:40 AM, Daniel Tenner wrote: > Hi all, > Li

[rspec-users] before(:all) and nested contexts

2009-07-09 Thread Daniel Tenner
'm quite happy to give up the ability to have before blocks in the sub-contexts in order to ensure that the expensive operation is only run once... Your thoughts most welcome... (including, perhaps, telling me that I'm Doing It Wrong) Daniel Tenner http://www.woobius.com http://danielten

Re: [rspec-users] unusual challenges speccing external software

2008-01-17 Thread Daniel Tenner
At the risk of sounding a bit silly, what's your question? I couldn't find a question mark in the whole email...? Daniel On 17 Jan 2008, at 07:20 17 Jan 2008, Giles Bowkett wrote: > This is something I've come up against twice. First, I have an > interactive editor which calls vi, emacs, or Te

Re: [rspec-users] specs on private methods

2008-01-09 Thread Daniel Tenner
Just to clarify, this is what I meant in my original email :-) Most of my methods are very small - in Ruby any method longer than 5 lines is, imho, a code smell that's waiting to be fixed. However, no matter how many methods are used to implement the functionality, I test the public behavio

Re: [rspec-users] specs on private methods

2008-01-08 Thread Daniel Tenner
Might be a personal thing, but my approach is that I try to test the public behaviour of the object. Testing private methods is, imho, getting dangerously close to specifying how the object does its business, rather than what it does. I would just spec the externally visible behaviour, where

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Daniel Tenner
x27;s much more likely to break is SantasMailbox - so focus the time, the effort, and the lines of code on speccing that quite thoroughly, so you know it can take every likely Message that you might throw at it. (/opinion) Daniel On 13 Dec 2007, at 14:44 13 Dec 2007, Rick DeNatale wrot

Re: [rspec-users] stub with assigns?

2007-12-13 Thread Daniel Tenner
>> Sorry, perhaps I gave too simplistic an example. >> Real code, please? :-) Simplified examples only ever result in simplistic suggestions. Daniel On 13 Dec 2007, at 07:55 13 Dec 2007, Jonathan Linowes wrote: > > On Dec 13, 2007, at 2:47 AM, Jonathan Linowes wrote: > >> >> On Dec 13, 2007, at

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Daniel Tenner
ent => people(:john) } SantasMailbox.should_receive(:deliver_secret_santa).with(Message.new (msg_creation_parms)) Which would imply you're building the subject, body, sender and recipient before passing things on to the mailer? Maybe I got this all wrong though... Daniel On 13 Dec 2

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Daniel Tenner
Hi Rick, I'm probably a heretic on this point, but I would test that :deliver_xyz is being called but not specify what parameters it's called with. What's my reasoning? - What I'm really testing in the Message spec is not the validity of the email that's being sent, but the fact that an em

Re: [rspec-users] Attachment-fu + Story Runner

2007-12-12 Thread Daniel Tenner
oads using controller specs, which works but is not as clear as a Story. I'm guessing the bug where it changes the TempFile to a String will be fixed soon by the core team, but if someone has a patch it would be awesome! Rai Daniel Tenner wrote: I've now located where this is goin

Re: [rspec-users] Attachment-fu + Story Runner

2007-12-11 Thread Daniel Tenner
%5Bid%5D=1330&request_type=xml" Obviously that's not going to work. I wonder how Test::Unit does it, then, though... Daniel On 11 Dec 2007, at 14:54 11 Dec 2007, Daniel Tenner wrote: Hi Luis, I read through that thread, but unfortunately it wasn't much help. fixtu

Re: [rspec-users] Attachment-fu + Story Runner

2007-12-11 Thread Daniel Tenner
ould be welcome! Thanks, Daniel On 11 Dec 2007, at 14:39 11 Dec 2007, Luis Lavena wrote: On Dec 11, 2007 10:57 AM, Daniel Tenner <[EMAIL PROTECTED]> wrote: I've pasted up the code at: http://pastie.caboo.se/126925 Since there are quite a few files involved. Thanks for your

Re: [rspec-users] Attachment-fu + Story Runner

2007-12-11 Thread Daniel Tenner
I've pasted up the code at: http://pastie.caboo.se/126925 Since there are quite a few files involved. Thanks for your time, Daniel On 11 Dec 2007, at 13:28 11 Dec 2007, David Chelimsky wrote: On Dec 11, 2007 6:18 AM, Daniel Tenner <[EMAIL PROTECTED]> wrote: Hi all, I'm

[rspec-users] Attachment-fu + Story Runner

2007-12-11 Thread Daniel Tenner
Hi all, I'm trying to run a Story Runner integration test that uploads a file through Attachment-fu. I've tried various ways of specifying the file data, from custom mocks: class MockFile < Struct.new (:original_filename, :read, :content_type); end fdata = MockFile.new "test_upload.txt", "Tes

Re: [rspec-users] params not available for controller specs?

2007-12-04 Thread Daniel Tenner
Try: get :download, :ids => ids_string You need the ":" in front of the action name. Daniel On 4 Dec 2007, at 09:28 4 Dec 2007, Al Chou wrote: I actually did stub Order.find() but was getting a nil object error because params[:ids] was nil. I can't write controller.download :ids => '1/2/3

Re: [rspec-users] Stylistic preferences

2007-12-03 Thread Daniel Tenner
The code works fine. I was asking about the "given" thing. Daniel On 3 Dec 2007, at 13:32 3 Dec 2007, Bryan Liles wrote: > > On Nov 29, 2007, at 5:54 AM, Daniel Tenner wrote: > >> What are people's opinions on which of these two styles is better to >> use?

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Daniel Tenner
Hi Daniel, You're trying to do too much in the controller. It's not the controller's responsibility to ensure that the user is capable of returning its own article without including anyone else's - that's the user's (or the Article model's, perhaps) responsibility. Your controller should

[rspec-users] Stylistic preferences

2007-11-29 Thread Daniel Tenner
What are people's opinions on which of these two styles is better to use? 1) before --- module UserSpecHelper include GenericSpecHelper def valid_sms_attributes(phone_number="12345") { :phone_number => phone_number } end end describe User, "with phone numb

Re: [rspec-users] Broken edge

2007-11-28 Thread Daniel Tenner
block) Makes all the specs pass. Obviously not a desirable permanent change... but at least until RubyAMF gets fixed. Thanks for the help all! Daniel On 28 Nov 2007, at 16:39 28 Nov 2007, Daniel Tenner wrote: > Ok, I've ditched externals and switched to piston... wiped out all > the

Re: [rspec-users] Broken edge

2007-11-28 Thread Daniel Tenner
Ok, I've ditched externals and switched to piston... wiped out all the plugins and reinstalled them... And still I'm getting that error. No one else is getting this? Daniel On 28 Nov 2007, at 14:49 28 Nov 2007, David Chelimsky wrote: > On Nov 28, 2007 8:44 AM, Daniel T

Re: [rspec-users] Broken edge

2007-11-28 Thread Daniel Tenner
ov 2007, at 14:36 28 Nov 2007, David Chelimsky wrote: > On Nov 28, 2007 8:29 AM, Daniel Tenner <[EMAIL PROTECTED]> wrote: >> Hi all, >> >> Not sure if I'm the only one with this problem... >> >> We're on edge for both rails and rspec, and i just did an up

[rspec-users] Broken edge

2007-11-28 Thread Daniel Tenner
Hi all, Not sure if I'm the only one with this problem... We're on edge for both rails and rspec, and i just did an update... Some apparently innocuous rails stuff was updated, and then half my specs broke due to an error in rspec_on_rails: ArgumentError in 'UserController without logged in u

Re: [rspec-users] Assumption tests

2007-11-27 Thread Daniel Tenner
finitely not afraid of mocking now :-) Thanks for the discussion last month! Daniel #swombat On 20 Oct 2007, at 23:49 20 Oct 2007, Daniel Tenner wrote: > On 20 Oct 2007, at 19:54 20 Oct 2007, Pat Maddox wrote: >> You seem to believe that the only way to define behavior is in terms >&

Re: [rspec-users] Latest update - broken be_matchers?

2007-11-26 Thread Daniel Tenner
. Hope this helps someone :-) Daniel On 26 Nov 2007, at 19:09 26 Nov 2007, Daniel Tenner wrote: > First time I have a look inside the RSpec codebase (let alone the > Story Runner), and not much luck this time. But, counter-intuitively > enough, I think it's probably nothing to do w

Re: [rspec-users] Latest update - broken be_matchers?

2007-11-26 Thread Daniel Tenner
sh Knowles <[EMAIL PROTECTED]> wrote: >> On 11/26/07, Daniel Tenner <[EMAIL PROTECTED]> wrote: >>> Just seven upped the latest rspec update, and suddenly all my >>> be_matchers don't work anymore (they worked just before I updated): >> >> >

[rspec-users] Latest update - broken be_matchers?

2007-11-26 Thread Daniel Tenner
Just seven upped the latest rspec update, and suddenly all my be_matchers don't work anymore (they worked just before I updated): User.find_by_email(email).should_not be_confirmed User.find_by_email(email).confirmation_code.should_not be_nil >> FAILURES: 1) confirmation (

[rspec-users] Rails sessions in plain text stories

2007-11-25 Thread Daniel Tenner
Ok, maybe I'm being particularly thick, but I've been trying to find the solution to this for a couple of hours now and I just can't seem to be able to do it... I'm trying to write a step as such: Given("user $email is logged in") do |email| user = User.find_by_email(email) sessi

Re: [rspec-users] Assumption tests

2007-10-20 Thread Daniel Tenner
On 20 Oct 2007, at 19:54 20 Oct 2007, Pat Maddox wrote: > You seem to believe that the only way to define behavior is in terms > of interactions with other objects. That is flat-out wrong. Please > read http://martinfowler.com/articles/mocksArentStubs.html. Thanks for that excellent link. I hadn

Re: [rspec-users] Assumption tests

2007-10-20 Thread Daniel Tenner
On 20 Oct 2007, at 17:34 20 Oct 2007, David Chelimsky wrote: > Agreed. This is exactly why we talk about stories and specs instead of > integration and units. I realize that I've slung the term integration > tests around when talking about about stories so I apologize if I've > added to the confus

Re: [rspec-users] Patch idea for rspec_on_rails

2007-10-19 Thread Daniel Tenner
I would like it :-) On 19 Oct 2007, at 19:45 19 Oct 2007, Russell Norris wrote: > I recently wrote a matcher for testing AR associations which allows > you to specify things like: > > Foo.should have_many(:bars).through(:bazes) > > I'm pretty darned proud of it and a couple of people have sug

Re: [rspec-users] Assumption tests

2007-10-19 Thread Daniel Tenner
nge so they are > less brittle. Internal structure tends to change more than an object's > API. Make sense? > > So with that, I really don't think there is a need for a new grouping > of tests. That's my opinion. I look forward to everyone else's. > >

[rspec-users] Assumption tests

2007-10-19 Thread Daniel Tenner
Hi all, I've been thinking about the whole validator/relationship speccing issue, and I came up with a suggestion, which I'd love to get some feedback on. The full article is available at http://www.inter-sections.net/ 2007/10/19/what-to-test-and-specify-and-where-to-do-it/ , with the rele