[rspec-users] Possible subject/its bug?

2010-11-13 Thread Ashley Moran
Hi I recently did a coding kata and ran into some strange behaviour. The code is here[1], the weirdness under the comment "Doesn't work... RSpec bug?". Basically, all the `subject` / `its(:sequence)` examples seem to work, except the one split into the two contexts. In this case `its(:sequenc

Re: [rspec-users] Issue with parameterized shared example group on ruby 1.8.6

2010-08-20 Thread Ashley Moran
On 20 Aug 2010, at 06:40, Myron Marston wrote: > describe VCR::HttpStubbingAdapters::FakeWeb do > it_should_behave_like 'an http stubbing adapter', ['net/http'], > [:method, :uri, :host] > end > > describe VCR::HttpStubbingAdapters::WebMock do > it_should_behave_like 'an http stubbing adapter'

Re: [rspec-users] How do you turn colour on in autotest?

2010-08-18 Thread Ashley Moran
On 18 Aug 2010, at 15:06, Chris Flipse wrote: > Check for a .rspec file in one project, not the other. Aha! You're a genius :D I need to stop TextMate hiding stuff like that... Cheers Ash -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran ___

[rspec-users] How do you turn colour on in autotest?

2010-08-18 Thread Ashley Moran
Hi This may sound like a really dumb question (most likely because it is), but I have two RSpec 2 projects, and one of them gives me colour, but the other doesn't. Nothing in spec_helper.rb or my autotest files mentions colour. There's no spec.opts. So what could be different about them? Ch

Re: [rspec-users] Autotest does not start

2010-08-14 Thread Ashley Moran
On 14 Aug 2010, at 18:49, Don French wrote: > Thought that was what you meant, but did not want to leave anything > untried. I have updated to 1.9.2-rc2. same problem. I am going to > have to do an update to snow leopard soon, may try it and put new code > on not just restore. I wish I could he

Re: [rspec-users] Module & Mixin testing strategy

2010-08-14 Thread Ashley Moran
On 14 Aug 2010, at 15:50, David Chelimsky wrote: > I need to blog this, which I'll do later, but here is the short version: You could pretty much copy and paste that "short version" into a chapter of the RSpec Book, never mind a blog post ;) -- http://www.patchspace.co.uk/ http://www.linkedin

Re: [rspec-users] Autotest does not start

2010-08-14 Thread Ashley Moran
On 13 Aug 2010, at 22:16, Don French wrote: > Not sure what you meant by "did you turn it off and on again?" Ah, I just meant I was running out of ideas[1]. > The other information is here: > http://pastie.org/1091155 All I can suggest is maybe updating RVM and trying in Ruby 1.9.2 with a fre

Re: [rspec-users] Module & Mixin testing strategy

2010-08-14 Thread Ashley Moran
On 14 Aug 2010, at 11:34, Mike Howson wrote: > Just wondered what people thoughts are to testing module's to be > included in mixin's? Seems to me there are two main approaches:- Hi Mike I've been doing a lot of this sort of coding lately, as I've been extracting duplicated code into a mini-fr

Re: [rspec-users] Autotest does not start

2010-08-13 Thread Ashley Moran
On Aug 12, 2010, at 11:09 pm, Don French wrote: > yep: Autotest.add_discovery {"rspec2"} > in the base project directory I'm at the point of asking "did you turn it off and on again?" :-/ Can you give your Ruby installation details? (versions etc, ideally the output of `rvm info` and `gem li

Re: [rspec-users] Name collision - how would you handle this?

2010-08-12 Thread Ashley Moran
On 12 Aug 2010, at 04:30, David Chelimsky wrote: > I think they should all be registered in the same place, in rspec-core. Or > are you saying that rspec-rails would take the responsibility of registering > the names for rspec-rails, rails, test/unit and minitest? That makes sense to > me, as

Re: [rspec-users] Autotest does not start

2010-08-12 Thread Ashley Moran
On 12 Aug 2010, at 08:27, Don French wrote: > under bundler bundle exec autotest standalone autotest both within > the project directory and there is a spec subdirectory with the spec > in them. What happens when you run `rspec spec`? What is in your spec_helper.rb file? What is the output of

Re: [rspec-users] Autotest does not start

2010-08-11 Thread Ashley Moran
On 11 Aug 2010, at 19:44, Don French wrote: > Any help on this. I think I have read all posts related to autotest > but still do not have the answer. Is there something that works better > with Rspec that autotest? When you say "and a prompt (back)" ... do you mean autotest exits in both situat

Re: [rspec-users] Recognising RSpec files in the Textmate bundle

2010-08-10 Thread Ashley Moran
On 10 Aug 2010, at 15:03, Rick DeNatale wrote: > And easy to add yourself by just editing the bundle. I've tried this before. Unfortunately, it just leads to pain when you try to update the bundle via Git >> Or... how about an actual dot-suffix, ".rspec", eg, >> "active_record_associations.

Re: [rspec-users] Order guarantees of let

2010-08-10 Thread Ashley Moran
On 9 Aug 2010, at 13:49, David Chelimsky wrote: > Yes, eval'd in order. No, not explicitly stated, but I think it should be. > Want to submit a patch with a spec for this? Sure - I've made an action to write a spec for this. I guess the implementation is not likely to change any time soon so

Re: [rspec-users] Recognising RSpec files in the Textmate bundle

2010-08-10 Thread Ashley Moran
On 8 Aug 2010, at 21:53, Phillip Koebbe wrote: > I don't think you are alone in your quest to achieve greater organization. I > am guessing that in your suggested RSpec folder structure, the current > folders of controllers|helpers|models|views would all live under examples? I > might go for t

Re: [rspec-users] Recognising RSpec files in the Textmate bundle

2010-08-10 Thread Ashley Moran
On 9 Aug 2010, at 17:37, Rick DeNatale wrote: > Well, I'd still use a different file name suffix which I could set > textmate to recognize as a spec > > _sspec.rb or _sgroup.rb > > something like that. Hi Rick, I think that was what David was saying? (If I understood you both correctly, tha

[rspec-users] Order guarantees of let

2010-08-09 Thread Ashley Moran
Hi I was just about to replace a `before` block along the lines of: before(:each) do @cti_b_id = service.create(name: "Item-B") @cti_z_id = service.create(name: "Z-Item") @cti_a_id = service.create(name: "Item-A") # ... end with let!(:cti_b_id) { ... } let!(:cti_z_id)

Re: [rspec-users] Name collision - how would you handle this?

2010-08-08 Thread Ashley Moran
On 8 Aug 2010, at 12:05, Matt Wynne wrote: >> And you override it using let(:foo), which would be a perfectly reasonable >> way to handle it. In fact, it would be the way I would handle in >> instinctively, because now I don't have to wrote my own memoization handling >> into the method. > >

Re: [rspec-users] Recognising RSpec files in the Textmate bundle

2010-08-08 Thread Ashley Moran
On Aug 08, 2010, at 2:17 am, Phillip Koebbe wrote: > I have developed a system in which I require model_helper.rb in model specs, > controller_helper.rb in controllers, and (you guessed it!) view_helper.rb in > view specs. Each of those then require spec_helper.rb. I did this because I > wante

Re: [rspec-users] RSpec 2 autotest file

2010-08-08 Thread Ashley Moran
On Aug 08, 2010, at 12:00 am, David Chelimsky wrote: > Yes: > http://github.com/rspec/rspec-core/commit/c2e8a3947321e501b84113c1b2b1049df4868f4b Cool, ta :) I'll update my code shortly. Cheers Ash -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran __

[rspec-users] Recognising RSpec files in the Textmate bundle

2010-08-07 Thread Ashley Moran
Hi Did the RSpec TMBundle ever have multiple ways of recognising RSpec files? I'm convinced it user to look for "spec_helper" on the first line. The Ruby bundle does something similar, as it looks for "firstLineMatch = '^#!/.*\bruby';" The reason I ask is because I now have several files that

[rspec-users] RSpec 2 autotest file

2010-08-07 Thread Ashley Moran
Hi I've tried using the autotest file from RSpec 2 (lib/autotest/rspec2.rb) but I've found a problem with it, that I think is a bug. The file contains two sections * an Autotest `Autotest.add_hook :initialize` block * an Autotest class "Autotest::Rspec2" In one project I'm working on, the code

Re: [rspec-users] Name collision - how would you handle this?

2010-08-07 Thread Ashley Moran
On 7 Aug 2010, at 22:10, David Chelimsky wrote: > So - what should we do? I don't think changing Minitest is really an option, > as too many assertion libraries already wrap Minitest assertions. I don't > think RSpec should be in the business of monitoring methods end-users define > to make su

Re: [rspec-users] Cucumber Development

2010-08-06 Thread Ashley Moran
On 6 Aug 2010, at 18:28, Subhash Mishra wrote: >> Cucumber has its own mailing list/user group: >> http://groups.google.com/group/cukes. >> >> I'd recommend asking there, though you'll probably want to be a bit more >> specific about your question. >> >> Cheers, >> David > > Thanx, > Well as

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-08-06 Thread Ashley Moran
On Aug 06, 2010, at 11:58 am, David Chelimsky wrote: > Barring the unforeseen, I'll knock out beta.20 this weekend. Cool, ta! Cheers Ash -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran ___ rspec-users mailing list rspec-users

Re: [rspec-users] New bie question: Why use assert_equal when there are comparison operators in Rspec?

2010-08-06 Thread Ashley Moran
On Aug 06, 2010, at 3:52 am, ct9a wrote: > Reading up on the Rspec's main site, the main example in > http://rspec.rubyforge.org/rspec/1.3.0/ does not show any use of > assert_equals. Rather it just uses the "==" comparison operators. > Here's an extract: assert_equals is part of Test::Unit, no

Re: [rspec-users] Macros and accessing block-variables (rspec2)

2010-08-06 Thread Ashley Moran
On Aug 06, 2010, at 1:24 am, Myron Marston wrote: > It's the difference between an instance variable of a Class instance > (since Classes are objects, too), and an instance variable of an > instance of a class. I talked a .Net dev friend of mine through instance ivar + class ivar + class variab

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-08-06 Thread Ashley Moran
On Aug 05, 2010, at 4:28 am, David Chelimsky wrote: > At this point, the customization block is still being eval'd after the shared > block, and I'm fairly well convinced this is the right thing, in combination > with params to the block. I don't think it makes any different any more, at least

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-08-06 Thread Ashley Moran
On Aug 04, 2010, at 12:41 pm, David Chelimsky wrote: > What happens if the shared spec author really wants it to just be a hash? Do > you think that's a valid use case? It could get in the way, then, I guess. You'd always have the original hash parameter if you wanted to use the method, but I

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-08-04 Thread Ashley Moran
On 4 Aug 2010, at 1:05 AM, David Chelimsky wrote: > One other thought I've had is keyword syntax. While currently I'm writing: it_satisfies_contract "[Entity] Collection:", :children, :child, Child.name I prefer keyword arguments, so I'd like to write: it_satisfies_contract "[Entity] C

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-08-04 Thread Ashley Moran
On 4 Aug 2010, at 7:55 AM, Myron Marston wrote: > Ashley: thanks for posting the example. It's nice to see how this all > fits together. Arguably it would have made more sense to post that example *before*, rather than expecting you all to read my mind :) I'm pleased with how it's working out

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-08-04 Thread Ashley Moran
On 4 Aug 2010, at 1:05 AM, David Chelimsky wrote: > I actually like contract a lot. Maybe we'll need alias_shared_examples_for_to > :) Haha, actually that gets +1 from me! Should I file a ticket? :) In general I like contract, I just wasn't sure it was the right word for this usage of shared

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-08-03 Thread Ashley Moran
On 3 Aug 2010, at 12:50 PM, David Chelimsky wrote: > Pushed: > > http://github.com/rspec/rspec-core/commit/84303616be1ac2f8126675488947b47f6945cebe > http://github.com/rspec/rspec-core/commit/3cea7b8bea51766d632e20bcc9ef15c64b719ea1 Awesomeness! > Please do let me know if this works with what

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-08-03 Thread Ashley Moran
On Aug 03, 2010, at 12:22 pm, David Chelimsky wrote: > My inclination is to get this feature out with explicit non-support for > 1.8.6, and then add support for 1.8.6 if we can get this to work. Working on > that now - should be pushing some code (including Myron's contribution) later > today.

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-08-02 Thread Ashley Moran
On 1 Aug 2010, at 11:52 PM, David Chelimsky wrote: > re: order of evaluation of blocks, I think I'm inclined to go one way one > minute, and another the next. Somebody convince me of one or the other. One thing that may help clear this up is: can anyone offer a concrete example of where overri

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-08-02 Thread Ashley Moran
On 2 Aug 2010, at 4:08 AM, Myron Marston wrote: > Backports (a library that implements features of later versions of > ruby in 1.8.6) implements it in a similar fashion: > > http://github.com/marcandre/backports/blob/v1.18.1/lib/backports/1.8.7/module.rb Conceivably, RSpec 2 could depend on Bac

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-08-02 Thread Ashley Moran
On 2 Aug 2010, at 2:04 AM, Myron Marston wrote: > I actually find the use of this to be a bit confusing: > > [:foo, :bar].each do |arg| > it_should_behave_like "Something", arg do |a| ># The value of the param is already bound to arg and now it's > bound to a, too. > end > end > > I suppo

Re: [rspec-users] RSpec 2 Ruby 1.8.6 support (was Evaluating shared example customisation block before shared block)

2010-08-02 Thread Ashley Moran
On 2 Aug 2010, at 1:08 PM, David Chelimsky wrote: > But what about people who are, for what ever reasons, stuck with Ruby 1.8.6 > and want to upgrade? Also, there are a few rspec-2 + rails-2 efforts in the > works, and there will be a solution for this sometime this fall. > > We need to suppor

[rspec-users] RSpec 2 Ruby 1.8.6 support (was Evaluating shared example customisation block before shared block)

2010-08-02 Thread Ashley Moran
On Aug 01, 2010, at 11:52 pm, David Chelimsky wrote: > re: 1.8.6, we've got a home-grown implementation of instance_exec that runs > in 1.8.6 (although I just discovered that it's broken - fix coming shortly). > I could > > a) add such a thing for module_exec as well, though I haven't quite fi

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-08-01 Thread Ashley Moran
On 1 Aug 2010, at 3:43 PM, David Chelimsky wrote: > shared_examples_for "blah" do |a,b| > ... > end > > it_should_behave_like "blah", 1, 2 > > That wouldn't have worked with the old implementation, but it would work > perfectly well now. This would also "just work" with hash-as-keyword-args:

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-08-01 Thread Ashley Moran
On Jul 31, 2010, at 7:06 pm, Myron Marston wrote: > I think this is a clunky way to essentially pass a parameter to the > shared example group. Better would be something like this: > > it_should_behave_like "something" do > providing :method_name, :foo > end After sleeping on this, I found an

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-07-31 Thread Ashley Moran
On 31 Jul 2010, at 7:06 PM, Myron Marston wrote: > Good point--I hadn't thought of that. The one issue I see with it is > that the author of the shared example group may not have knowledge of > which helper methods consumers will need to override. So he/she > either defines all helper methods t

Re: [rspec-users] rspec 1 - nested examples (in an each block) use the final block variable 4 times instead of each of the 4 once

2010-07-31 Thread Ashley Moran
On 31 Jul 2010, at 2:08 AM, nruth wrote: > Re: error / warning message, at the same scope (i.e. an accident, as > in the op) then yes that could be quite useful for spotting mistakes. > I'm not so sure about in different blocks though, it's probably > intentional there (different context). I for

Re: [rspec-users] rspec 1 - nested examples (in an each block) use the final block variable 4 times instead of each of the 4 once

2010-07-31 Thread Ashley Moran
On 31 Jul 2010, at 2:08 AM, nruth wrote: > If I want to set up a context to run some examples in (models created > with machinist, associations, etc) then the before block makes it > clear that that's the state the examples are running against, and the > @vars give me a (quick and dirty?) hook to

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-07-31 Thread Ashley Moran
On 31 Jul 2010, at 1:10 AM, David Chelimsky wrote: > You can still get the same outcome, but you have to implement it in the group > like this: > > unless defined?(:foo) > def foo; "foo"; end > end Maybe a DSL method while I'm working on it? Maybe: default_helper(:foo) do "foo" end

Re: [rspec-users] rspec 1 - nested examples (in an each block) use the final block variable 4 times instead of each of the 4 once

2010-07-30 Thread Ashley Moran
On 30 Jul 2010, at 10:00 PM, nruth wrote: > http://gist.github.com/501296 > > I don't think anything needs to change, though a wrapper function > (each + an inner describe) might help flag it as a possible pitfall. Hi Nick I think the "before + ivar" pattern (below) is on its way out. At leas

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-07-30 Thread Ashley Moran
On 30 Jul 2010, at 5:00 PM, David Chelimsky wrote: > By all means. I've started on that and filed a ticket[1]. One question I have, is I keep calling the Example Group that uses a shared block the "host group". Is there already a name for it? I never know what to use, and I'm not sure "host

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-07-30 Thread Ashley Moran
On Jul 30, 2010, at 4:47 pm, David Chelimsky wrote: > If I provide spec extensions for a library (other than RSpec in this case) > that include a shared group that "you can use to spec your foos to make sure > they comply with this API" (or whatever), then this sort of thing can be very > help

Re: [rspec-users] Evaluating shared example customisation block before shared block

2010-07-30 Thread Ashley Moran
On Jul 30, 2010, at 3:10 pm, David Chelimsky wrote: > Maybe that, or a DSL that wraps that, is the better way, so we can get the > best of both worlds? > > shared_examples_for Enumerable do > require_instance_method :foo, "gotta have foo instance method" > require_class_method :foo, "gotta ha

[rspec-users] Evaluating shared example customisation block before shared block

2010-07-30 Thread Ashley Moran
Hi I finally looked into why this is not currently possibly in RSpec 2 (beta 19): shared_examples_for "Etymology" do describe "The etymology of foo" do it "is followed by #{after_foo}" do # ... end end end describe "foo", focus: true do it_should_behave_like

Re: [rspec-users] Problem running RSpec tests with Rails

2010-07-26 Thread Ashley Moran
On 26 Jul 2010, at 6:36 PM, Bruno Cardoso wrote: > What both solutions (from Ashley and David) do is not modify the BD in > anyway, so nothing gets dropped and nothing is created. This resolves > the problem but what if I want a clean installation in each test run? Is > there a way to keep my

Re: [rspec-users] Problem running RSpec tests with Rails

2010-07-26 Thread Ashley Moran
On Jul 26, 2010, at 5:12 pm, Bruno Cardoso wrote: > Not sure if this is a RSpec problem or Rails but I believe is more a > RSpec situation. > > What happens is that when I run my RSpecs tests all the BD is recreated, > > ... > > Anyone know how to resolve this? Hi Bruno Are you running `rake

Re: [rspec-users] Formatting shared example descriptions with test data

2010-07-26 Thread Ashley Moran
On Jul 26, 2010, at 3:44 pm, Wincent Colaiuta wrote: > Personally I wouldn't do this. It makes it harder for anybody coming to your > project to understand what's going on, because they see this "contract 'foo' > do" construct and don't know what it is unless they dig into your > spec_helper.

Re: [rspec-users] Formatting shared example descriptions with test data

2010-07-26 Thread Ashley Moran
On Jul 26, 2010, at 8:55 am, Wincent Colaiuta wrote: > Seems to me that including the same shared example group twice in the same > "describe" block is a bit of an abuse, to be honest. I don't think it was > ever really intended to be used in that way. You're right, it clearly wasn't intended

[rspec-users] RSpec 2 example group block scope

2010-07-26 Thread Ashley Moran
Hi again As part of the refactoring I'm doing, I'm writing out quite a bit of metaprogramming. The easiest way to prove constant lookup is working is to create a new class in an example group, and use its name. But the scope of the example group definition appears to be the containing module,

[rspec-users] Formatting shared example descriptions with test data

2010-07-26 Thread Ashley Moran
Hi I'm back again, and still on a quest to tame shared example to do my bidding. This time what I'm wondering is... is there any way to format shared example specdoc description output with data passed in with #let, or otherwise? eg: How do I get "1" and "2" into either of the placeholders h

Re: [rspec-users] rspec-orm and _not_ mocking models

2010-07-25 Thread Ashley Moran
On 21 Jul 2010, at 10:28 PM, Costa Shapiro wrote: > (Surprisingly?) I find mocking AR (DM less so) in specs extremely tedious > _and_ intrusive. Yeah, I know what you mean, I just don't do it any more. I find the pain isn't worth it on the stuff I do. > I think the README there pretty much c

Re: [rspec-users] newbie: how to preserve NoMethodError under stubbing?

2010-07-24 Thread Ashley Moran
On 24 Jul 2010, at 2:52 PM, Wincent Colaiuta wrote: > How about this: > > f.stub.existing(:bar) > > That's probably RR influencing me there, which employs things like > "stub.proxy" and so on. So maybe not such a good idea for rspec-mocks. Another option might be to deprecate #stub! as an al

Re: [rspec-users] Parameterised shared examples / metadata in examples (RSpec 2)

2010-07-23 Thread Ashley Moran
On Jul 23, 2010, at 8:57 am, Wincent Colaiuta wrote: > Recently commited (RSpec 2.0.0.beta.18) was the ability to pass a block to > "it_should_behave_like", making the relation clearer; eg: > > describe MyStruct do >it_should_behave_like 'a Struct' do > let(:struct) { MyStruct.new } >

[rspec-users] Parameterised shared examples / metadata in examples (RSpec 2)

2010-07-23 Thread Ashley Moran
Hi Warning: this goes on quite a bit. It contains early-morning caffeinated ramblings and many "hmmm I wonder what this does..." snippets. I'm looking for the best way to parameterise shared examples. Imagine (as an academic example...) you were doing it for subclasses of Struct instances (a

Re: [rspec-users] How are people speccing and cuke-ing Paperclip (with S3)?

2010-07-17 Thread Ashley Moran
On 17 Jul 2010, at 5:43 PM, doug livesey wrote: > Please tell me they're doing *some*thing, as I'm using S3 storage, which > would really slow my tests down if I just did nothing. > I'm starting to think of all sorts of horrible solutions, like making the > storage strategy dependent on the env

Re: [rspec-users] How are people speccing and cuke-ing Paperclip (with S3)?

2010-07-17 Thread Ashley Moran
On 17 Jul 2010, at 5:58 PM, Steve Klabnik wrote: > You don't need to test Paperclip's ability to put files to S3 It depends on your confidence in Paperclip (s/Paperclip/X random library) and the severity of problem it could cause if it doesn't work. To me, at least, it's more a risk/value ju

Re: [rspec-users] How are people speccing Rails 3 ActiveRecord queries?

2010-07-17 Thread Ashley Moran
On 17 Jul 2010, at 4:37 PM, doug livesey wrote: > At the minute I'm chaining a load of should_receive calls on mock relation > objects I've found this can cause pain in so many ways: * Your tests end up coupled to the database structure (as that's how most associations are inferred) * You're a

[rspec-users] [ANN] ShRUG 8, Mon July 12th: Introduction to RSpec

2010-07-05 Thread Ashley Moran
Hi all Reposting this for the benefit of anyone who may be able to attend but wouldn't normally see ShRUG announcements. ShRUG is the Sheffield (UK) Ruby User Group. ShRUG July 2010 is now confirmed. Ashley Moran (that's me) of PatchSpace Ltd (that's also me, really) will

[rspec-users] [ANN] database_resetter 0.1.0

2010-07-04 Thread Ashley Moran
Hi all Apologies for cross-posting and spam in the same post. Hopefully you'll let me off this once... I just released my first gem (woo!), database_resetter[1]. It's designed to completely rebuild your Rails/Merb etc database before a Cucumber/RSpec every time a migration changes. Basicall

[rspec-users] Colour support in RSpec 1.3 with Spork

2010-04-13 Thread Ashley Moran
Hi I can't find any reference to this being a known issue or not. I'm having to work on a Rails 2.3 project for a bit, so I'm back with RSpec 1.3. I've got Spork working and I'm running it with this command: ruby -S spec --drb --colour --format progress -o spec/spec.opts ... But I only get

Re: [rspec-users] Spork

2010-03-31 Thread Ashley Moran
On Mar 29, 2010, at 9:04 pm, David Chelimsky wrote: > How wide-reaching are your changes? i.e. how many files, etc? I think it's only really the Runner stuff that's changed. I've split it into InProcess and DRbProxy or some such... although I think really the DRb stuff belongs higher up. >

[rspec-users] Spork

2010-03-29 Thread Ashley Moran
Hi Hopefully I'll get chance to finish Spork integration with RSpec 2 this weekend. I've got two questions... (1) What's the best way to merge my changes back in? My shockingly bad Git-fu has made it impossible to rebase on top of master. I suspect having a (now disabled) Textmate macro to

Re: [rspec-users] Spork in RSpec 2

2010-03-10 Thread Ashley Moran
On Mar 10, 2010, at 1:46 pm, David Chelimsky wrote: > AFAIK, no. Please add a comment to the issue saying you're working on it. Done. >> * are there any potential issues that people with RSpec 2 knowledge can >> forsee? I don't want to lose time on known gotchas. > > * You will need the othe

[rspec-users] Spork in RSpec 2

2010-03-10 Thread Ashley Moran
Hi I've just started using RSpec 2 in Rails 3 and I'm incredibly frustrated by the time it takes to boot Rails, it's a real TDD bottleneck. The obvious solution is Spork, which is currently not possible with RSpec 2 because it lacks DRb support[1]. I've cloned RSpec and I'm about to start wor

[rspec-users] RSpec 2 / Rails 3 autoload

2010-03-06 Thread Ashley Moran
Hi For the last 18 months I've been used to writing specs like this, which was written with Merb 1.1.0.pre and RSpec 1.3: module LanguageRepository describe DataMapperAdapter do it_should_behave_like "Contract: LanguageRepository" def language_repository DataMapper

Re: [rspec-users] Rails3 + RSpec2 sample project?

2010-02-07 Thread Ashley Moran
On 7 Feb 2010, at 8:41 PM, David Chelimsky wrote: > The a5 release only supports model and request (integration - a la > merb) specs, but controllers, views and helpers will be coming soon. Well chop chop then, anyone would think you were working for free ;o) On a more serious note, I think the

Re: [rspec-users] CRITICAL: Rspec gem install > spec command not found!

2010-02-03 Thread Ashley Moran
On Feb 02, 2010, at 8:58 am, Kristian Mandrup wrote: > Where should the spec command be found? Did you find it? -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran ___ rspec-users mailing list rspec-users@rubyforge.org http://ruby

Re: [rspec-users] CRITICAL: Rspec gem install > spec command not found!

2010-02-02 Thread Ashley Moran
On Feb 02, 2010, at 8:58 am, Kristian Mandrup wrote: > Using brew as package manager > kristian-mandrups-macbook-pro:rspec-coding kristianconsult$ spec -- > help > > -bash: spec: command not found > $ If you're using Homebrew[1] (?) you'll need to figure out where it's storing binaries. Run "

Re: [rspec-users] What is difference between TDD & BDD

2010-01-31 Thread Ashley Moran
On Jan 31, 2010, at 5:13 pm, Ravi Shankar wrote: > What is the difference between test driven development & behavior driven > development, which one is better. The link to behaviour-driven.org that Tristam already posted[1] tells you exactly that. Did you read it? I'm having flashbacks to an

Re: [rspec-users] Message expectation that verifies result of passed block

2010-01-28 Thread Ashley Moran
On Jan 28, 2010, at 1:29 pm, Paul Hinze wrote: > I believe the lack of ability to use this notation comes down to a ruby > limitation, but I'm not sure. If that's the case, then we would need a > specific argument expectation (along the lines of my suggestion) that > executes in a context in whi

Re: [rspec-users] Can I set an expectation that a method invokes super?

2010-01-28 Thread Ashley Moran
On Jan 28, 2010, at 5:49 pm, Rick DeNatale wrote: > I'd like to write a spec to ensure that this doesn't regress, but my > imagination is failing me as to how to do it. > > Any ideas? Yes: don't use inheritance for implementations. The bug you describe is arguably a violation of the Liskov Su

Re: [rspec-users] Singleton classes

2010-01-19 Thread Ashley Moran
On Jan 19, 2010, at 2:33 pm, Juanma Cervera wrote: > Yes, I mean the Singleton Pattern. > I am not an expert with OO, but I supposed this pattern was what best > fits my needs of a class that represent a unique resource in the system, > in this case it's something like a queue of jobs that I ha

Re: [rspec-users] default to just call the method?

2010-01-18 Thread Ashley Moran
On Jan 18, 2010, at 3:12 pm, David Chelimsky wrote: > I'd rather not add a new DSL for the few cases in which we want to > essentially delegate a predicate. We can already do this with the > matcher DSL: I think Pat was just suggesting Roger try this in his own code. It's not something I espec

Re: [rspec-users] default to just call the method?

2010-01-18 Thread Ashley Moran
On Jan 18, 2010, at 9:31 am, Pat Maddox wrote: > define_simple_predicate_matcher :rise_from_the_ashes? As an extension, how about: define_simple_predicate_matcher :risen_from_the_ashes => :rise_from_the_ashes? Also, in general, I think specs look better without ? symbols on methods, my prefer

Re: [rspec-users] default to just call the method?

2010-01-15 Thread Ashley Moran
On 14 Jan 2010, at 17:02, Rick DeNatale wrote: > -1 > > You can already say > > a.should include("1:4") > > which is clearer IMHO. I assume Roger was referring to the general case though (which I still don't like) - and just happened to pick an example with an existing matcher. -- http://

Re: [rspec-users] Testing .Net Newbie

2010-01-14 Thread Ashley Moran
On Jan 14, 2010, at 1:17 pm, John Polling wrote: > I think this is the part that I'm confusing myself with as most Cucumber > information talks about using scenarios to drive the code out. So > Cucumber comes first, whereas I used to do the Acceptance testing after > all the other TDD stuff.

Re: [rspec-users] Testing .Net Newbie

2010-01-14 Thread Ashley Moran
On Jan 14, 2010, at 12:15 pm, David Chelimsky wrote: > re: Integration testing, everybody has a different definition. Before Rails > came along, the prevalent definition that I was aware of was "testing the > behaviour of two non-trivial components together." > > More recently, the definition

Re: [rspec-users] default to just call the method?

2010-01-14 Thread Ashley Moran
On Jan 12, 2010, at 10:49 pm, rogerdpack wrote: > a.should include?("1:4") # if there's no matcher called include? then > just call include? Am I right thinking that this would mean writing a method_missing that creates a matcher for every unhandled message on the example object (whatever scope

Re: [rspec-users] Problem with should_not when passing a multipleargs to a matcher

2010-01-07 Thread Ashley Moran
On 7 Jan 2010, at 19:15, David Chelimsky wrote: > Cool. I'm not sure when I'll get to this, but I'm pretty sure this would work > for you for now (untested): > > Spec::Matchers.define :include_all do |*expected| > match do |actual| > expected.all? {|e| actual.include?(e)} > end > end >

Re: [rspec-users] Submitting a Custom Matcher: gem or other method?

2009-12-30 Thread Ashley Moran
On 29 Dec 2009, at 15:59, David Chelimsky wrote: > I started http://wiki.github.com/dchelimsky/rspec/matcher-libraries. Please > feel free to modify/add. I like! A wiki solves 90% of problems like this with 2% of the effort. I hadn't realised the wiki had moved along - unlike Cucumber, I st

Re: [rspec-users] more verbosity for be_an?

2009-12-30 Thread Ashley Moran
On 30 Dec 2009, at 20:19, David Chelimsky wrote: > What about something like: > > expected # => Fixnum to be a kind of Fixnum > > That is more aligned with other failure messages. WDYT? I like that. You have to read the current message _very_ carefully to see what it's actually saying. Th

Re: [rspec-users] Submitting a Custom Matcher: gem or other method?

2009-12-29 Thread Ashley Moran
On 28 Dec 2009, at 16:27, David Chelimsky wrote: > For most users, gems are the easiest answer. By all means, host source on > github if you want people to contribute, or have a place to inspect code, but > you don't need a public source repository in order to push gems to gemcutter. A standar

Re: [rspec-users] no should raise_exception

2009-12-20 Thread Ashley Moran
On Dec 20, 2009, at 6:07 am, Elliot Winkler wrote: > raise_error already catches any type of exception, error or not: > > class BlahException < Exception; end > class BlahError < StandardError; end > > lambda { raise BlahException }.should raise_error(BlahException) > lambda { raise BlahE

Re: [rspec-users] State-based expectations (as per jMock in GOOS)

2009-12-19 Thread Ashley Moran
On 18 Dec 2009, at 14:46, Tom Stuart wrote: > Can you elaborate? From a position of no knowledge, the most obvious question > to me is: why would I care about the state of O? Either the change in O's > state is observable through its behaviour (in which case I specify that > behaviour) or it's

Re: [rspec-users] State-based expectations (as per jMock in GOOS)

2009-12-18 Thread Ashley Moran
On Dec 18, 2009, at 2:46 pm, Tom Stuart wrote: > Can you elaborate? From a position of no knowledge, the most obvious question > to me is: why would I care about the state of O? Either the change in O's > state is observable through its behaviour (in which case I specify that > behaviour) or i

[rspec-users] State-based expectations (as per jMock in GOOS)

2009-12-18 Thread Ashley Moran
Hi all I'm working my way through Growing Object-Oriented Software[1], currently at the start of chapter 15. Chapter 14 introduces a concept I haven't seen before, state-based expectations based on sent messages. The principle appears to be object O has sent message M => O is in state S f

Re: [rspec-users] should_receive(:x).at_most/exactly... ignored when method is previously stubbed?

2009-12-01 Thread Ashley Moran
On Dec 01, 2009, at 7:34 pm, Lenny Marks wrote: > Thanks Ashley. I added my 2 cents to the ticket. Just had a look over your comments. It's a complicated issue... I hope David can reconcile it. I'm not sure what the best solution is. Ashley -- http://www.patchspace.co.uk/ http://www.linkedi

Re: [rspec-users] should_receive(:x).at_most/exactly... ignored when method is previously stubbed?

2009-12-01 Thread Ashley Moran
On Dec 01, 2009, at 4:46 pm, Lenny Marks wrote: > This seems dangerous to me. Assuming I hadn't initially stubbed in the before > block and everything worked as expected, if someone later stubs :lookup in > the before block because they are adding new examples that don't care about > it, my ex

Re: [rspec-users] surprising...

2009-11-30 Thread Ashley Moran
On Nov 29, 2009, at 6:33 am, rogerdpack wrote: > It is somewhat surprising to me, as a newbie, to have to assert > a.should be_a(Hash) Hi Roger Once you see the matcher (ie be_a) as something that returns a matcher object, it makes a lot more sense. My brain is now wired to give much more wei

Re: [rspec-users] Introductory recommendations?

2009-11-26 Thread Ashley Moran
On Nov 25, 2009, at 6:38 pm, Matt Wynne wrote: > +1 > > And have a coding dojo ASAP. It's much easier to learn when you're having fun. > > On 25 Nov 2009, at 18:07, Pat Maddox wrote: > >> Pair with them. How big's the team? Lots of ways you can do this. +2 +1 For the pairing, it's the most

Re: [rspec-users] Using Mock / Datamapper / Associations

2009-11-14 Thread Ashley Moran
On Nov 13, 2009, at 6:04 pm, Arco wrote: > Is there a way to mock the Org object, without having to require it in > my test setup ?? Hi Arco Are you running the spec through something that loads a code loader (eg: for my specs, spec_helper.rb starts Merb in the test environment), or just runni

Re: [rspec-users] "lambda Should Change" Behavior Failing When Checking Time

2009-11-08 Thread Ashley Moran
On Nov 08, 2009, at 10:39 am, Rodrigo Rosenfeld Rosas wrote: @post.published_at.should be_nil @post.publish! (Time.now - @post.published_at).should have_at_most(1).second FWIW, this is what I do too, although I normally use "should <" or "be_close", but the idea is the same. You only need

Re: [rspec-users] spec failing to run specs when spec.opts is present on 1.2.9

2009-10-29 Thread Ashley Moran
On 29 Oct 2009, at 08:28, Paul Carey wrote: If I create a new merb app (1.0.12) and model and then run rake spec, all is well. However, if I copy its spec_helper into my own app, the problems listed above appear. So I think the source of the issue lies somewhere else. Have you upgraded the o

Re: [rspec-users] at_exit in spec file?

2009-10-29 Thread Ashley Moran
On 29 Oct 2009, at 13:58, Tom Stuart wrote: On 29 Oct 2009, at 13:46, Stephen Eley wrote: Everyone's busy programming. >8-> I imagine the book helps a bit, too. The book pretty much replaces the slides I did for my mocking presentation, and may do the same for the rest of my consulting

  1   2   3   4   5   >