Re: [rspec-users] Spec-ing private method

2013-05-16 Thread Matt Wynne
On 16 May 2013, at 04:22, Andrey S. wrote: > Yes, I know, that testing private methods it's not a good idea (and I > read this thread - http://www.ruby-forum.com/topic/197346 - and some > others) > > But how can I test the following code? > I use xmpp4r. In my public method #listen I start rece

Re: [rspec-users] expecting one of two conditions

2013-03-10 Thread Matt Wynne
On 10 Mar 2013, at 02:04, Robert Poor wrote: > On Sat, Mar 9, 2013 at 4:24 PM, Adam Sroka wrote: > It depends on what you really mean: > > 1) If you care that it is either OneError or OtherError, then these are two > separate scenarios and should be written as such. > > 2) If you don't care

Re: [rspec-users] hiiiiiii...........lots of question ..

2012-08-07 Thread Matt Wynne
On 2 Aug 2012, at 06:14, Fahim Patel wrote: > i implement all this question but i dont have knowledge perfectly > ...ok > > explain with example code > tell me what is mock and stub ? > stub_model and mock_model ? > mock and mock_model? > > > what to use first rspec

Re: [rspec-users] describe, context, feature, scenario

2012-07-16 Thread Matt Wynne
On 16 Jul 2012, at 02:28, Mike Glaz wrote: > Describe, context, feature, scenario: what is the difference between the > four and when do I use each one? Feature and Scenario are Cucumber keywords and AFAIK have nothing to do with RSpec. #describe and #context are both aliases for the same meth

Re: [rspec-users] Selenium+Autotest: how to run browser in background?

2012-07-05 Thread Matt Wynne
On 22 Jun 2012, at 10:38, Joshua Muheim wrote: > Well, didn't find a solution, but using the :chrome driver lets Chrome > be activated in the background... > > See > http://collectiveidea.com/blog/archives/2011/09/27/use-chrome-with-cucumber-capybara/ capybara-webkit is best for this. It's fa

Re: [rspec-users] Newbie testing questions

2012-06-01 Thread Matt Wynne
Hi Ben, On 1 Jun 2012, at 16:46, Ben Densmore wrote: > I recently wrote my first gem and am now in the process of learning how > to write tests for it before I release. > > My gem is pretty basic and really just has a few class files with some > methods for using GET to an API that returns some

Re: [rspec-users] rspec-2.10 is released!

2012-05-05 Thread Matt Wynne
Corrections to documentation links: On 4 May 2012, at 02:37, David Chelimsky wrote: > rspec-2.10 is released! > > Cucumber docs > > http://rubydoc.info/gems/rspec-core > http://rubydoc.info/gems/rspec-expectations > http://rubydoc.info/gems/rspec-mocks > http://rubydoc.info/gems/rspec-rails ht

Re: [rspec-users] Smart mocks for ActiveRecord to speed up tests

2012-04-16 Thread Matt Wynne
On 16 Apr 2012, at 03:42, David Chelimsky wrote: > On Sunday, April 15, 2012 at 9:23 PM, Rodrigo Rosenfeld Rosas wrote: >> Em 14-04-2012 10:11, David Chelimsky escreveu: >>> >>> On Friday, April 13, 2012 at 2:09 PM, Rodrigo Rosenfeld Rosas wrote: Hello old friends, I'm getting back to Rails

Re: [rspec-users] Can't access https://www.relishapp.com/rspec from Chrome

2012-04-07 Thread Matt Wynne
Hi Rodrigo, On 7 Apr 2012, at 16:30, Rodrigo Rosenfeld Rosas wrote: > It seems it has an invalid certificate. Could you please try this on some other computers to see whether it's a problem with your particular machine? I haven't had any other reports of this issue. If it still persists, pleas

Re: [rspec-users] mocking a reference to a polymorphic model?

2012-03-22 Thread Matt Wynne
On 22 Mar 2012, at 17:27, Fearless Fool wrote: > The basic question: how do you mock a reference to a polymorphic class > in RSpec? Trying the obvious thing leads to an error of the form: > > undefined method `base_class' for Post:Class > > === The details: > > # file: app/models/relation.r

Re: [rspec-users] Asserting on a yield

2012-03-07 Thread Matt Wynne
o_stuff).to_yield val Yeah, I like that. Is that real yet or is this just an idea? > > Zach > > On Wed, Mar 7, 2012 at 12:56 PM, Matt Wynne wrote: >> >> On 7 Mar 2012, at 11:39, Morten Møller Riis wrote: >> >> On Mar 7, 2012, at 8:22 AM, Matt Wynne wr

Re: [rspec-users] Asserting on a yield

2012-03-07 Thread Matt Wynne
On 7 Mar 2012, at 18:16, David Chelimsky wrote: > On Wed, Mar 7, 2012 at 11:56 AM, Matt Wynne wrote: >> >> On 7 Mar 2012, at 11:39, Morten Møller Riis wrote: >> >> On Mar 7, 2012, at 8:22 AM, Matt Wynne wrote: >> >> >> Hi all, >> >>

Re: [rspec-users] Asserting on a yield

2012-03-07 Thread Matt Wynne
On 7 Mar 2012, at 15:12, Ken Chien wrote: > Hi Matt, > On Wed, Mar 7, 2012 at 2:22 AM, Matt Wynne wrote: > Hi all, > > I'm spec'ing a method that yields a value. Right now, I spec it like this: > > result = nil > thing.do_stuff { |value| re

Re: [rspec-users] Asserting on a yield

2012-03-07 Thread Matt Wynne
On 7 Mar 2012, at 11:39, Morten Møller Riis wrote: > On Mar 7, 2012, at 8:22 AM, Matt Wynne wrote: > >> Hi all, >> >> I'm spec'ing a method that yields a value. Right now, I spec it like this: >> >> result = nil >> thing.do_s

[rspec-users] Asserting on a yield

2012-03-06 Thread Matt Wynne
Hi all, I'm spec'ing a method that yields a value. Right now, I spec it like this: result = nil thing.do_stuff { |value| result = value } result.should == expected This feels like too much ceremony. What I want to do is something more this: thing.do_stuff.should yield_value(expec

Re: [rspec-users] should_receive_chain

2012-02-22 Thread Matt Wynne
On 22 Feb 2012, at 15:41, David Chelimsky wrote: > On Tue, Feb 21, 2012 at 2:48 PM, Mike Pack wrote: >> Yup, I find myself doing this all the time. I think it should be considered >> that too deep of a stub chain could be a sign of poor >> abstraction/information hiding. Could lead to bad practi

Re: [rspec-users] stale records with integration testing?

2012-02-17 Thread Matt Wynne
On 16 Feb 2012, at 12:21, David Chelimsky wrote: > On Thu, Feb 16, 2012 at 4:17 AM, Matt Wynne wrote: >> >> On 14 Feb 2012, at 20:44, Justin Ko wrote: >> >> >> On Feb 14, 2012, at 9:23 AM, David Chelimsky wrote: >> >> On Tue, Feb 14, 2012 at 9:

Re: [rspec-users] stale records with integration testing?

2012-02-16 Thread Matt Wynne
On 14 Feb 2012, at 20:44, Justin Ko wrote: > > On Feb 14, 2012, at 9:23 AM, David Chelimsky wrote: > >> On Tue, Feb 14, 2012 at 9:28 AM, Justin Ko wrote: >>> >>> On Feb 13, 2012, at 10:35 PM, David Chelimsky wrote: >>> On Mon, Feb 13, 2012 at 9:04 PM, Justin Ko wrote: > > On F

Re: [rspec-users] testing framework for test automation

2012-02-06 Thread Matt Wynne
On 6 Feb 2012, at 08:20, Ze T wrote: >> Perhaps you could give us a little more background to what you are testing. >> Is it a web app? Is it written in Ruby? What type of testing are you >> looking at? Integration tests, unit tests. > > Looking to run functional tests on site like www.kodakgall

Re: [rspec-users] Game development: how to test interactions like an attack?

2012-02-02 Thread Matt Wynne
On 2 Feb 2012, at 09:50, Romain Tribes wrote: > Hello, > > I'm writing webgames with Rails and I want to test my code (and even TDD) but > I'm really stuck figuring what to test. > I read a lot of articles on the subject but I still don't know what to do in > my case: how to start? > > For in

Re: [rspec-users] Spec'ing a block

2011-12-05 Thread Matt Wynne
On 5 Dec 2011, at 12:04, Morten Møller Riis wrote: > Hi folks > > How would you spec something like this: > >as_user username do > FileUtils.chmod_R 0755, "#{directory}/*" >end > > Where as_user fires off a new process (and set uid to username). > > It seems that this won't catch

Re: [rspec-users] Write tests for objects with lots of dependencies

2011-11-15 Thread Matt Wynne
On 15 Nov 2011, at 04:04, David Chelimsky wrote: > On Nov 8, 2011, at 12:52 AM, Romain Tribes wrote: > >> Hello, >> >> I'm writing a Risk-like webgame >> (https://github.com/Sephi-Chan/Conquest-on-Rails) and I want to add tests, >> but it's painful since objects have a lot of dependencies eac

Re: [rspec-users] Setting expections on chained calls

2011-11-07 Thread Matt Wynne
On 7 Nov 2011, at 18:37, Justin Ko wrote: > On Nov 2, 2011, at 12:01 PM, Rob Aldred wrote: > >> >> I'm pretty sure this has probably been discussed before. >> I'm using couchdb (couchrest_model) >> >> When speccing my controller i want to set expectations that im calling my >> couch views cor

Re: [rspec-users] problems matching generated html output...

2011-11-04 Thread Matt Wynne
On 3 Nov 2011, at 23:25, Patrick J. Collins wrote: >> I realise this isn't the answer you're looking for, but I'm curious: where >> did you get the idea that a presenter should know anything about HTML? > > Maybe I am using the wrong terminology then. I always thought presenters were > classes

Re: [rspec-users] problems matching generated html output...

2011-11-03 Thread Matt Wynne
On 3 Nov 2011, at 22:36, Patrick J. Collins wrote: > So, I am writing tests for a presenter class that outputs html markup. > > I have a method that does something like this: > > def output > > things.map do |thing| > >content_tag :div, :id => thing[:id] do > [content_tag :p, th

Re: [rspec-users] rspec 1.3.2, Rails 2.3.14 - plugins not loading

2011-10-21 Thread Matt Wynne
On 18 Oct 2011, at 15:02, Jens-Christian Fischer wrote: > Hi there > > I have a weird situation. I have inherited a project in Rails 1.2.3 > that has been upgraded to Rails 2.3.14 (and is running). I have > installed Cucumber and Rspec to start to write features/tests for the > new code that nee

Re: [rspec-users] URL helpers in model specs

2011-10-11 Thread Matt Wynne
On 10 Oct 2011, at 18:02, Nick wrote: > Hey guys. One of my models uses a Rails URL helper. In IRB, the method works. > However, when I run the specs for the method, the URL helper doesn't exist. > > The only solution I've found is to include > Rails.application.routes.url_helpers in both the

Re: [rspec-users] Assertions for asynchronous behaviour

2011-10-02 Thread Matt Wynne
On 28 Sep 2011, at 01:09, Alex Chaffee wrote: > After a week of stealing minutes, I eventually wrote eventually! > Please check this out and give me feedback. I can ship it in a new > Wrong gem as soon as you all tell me it's ready. > > docs: > https://github.com/alexch/wrong/commit/cae852f09a3d

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-21 Thread Matt Wynne
On 21 Sep 2011, at 17:46, Alex Chaffee wrote: > There's a semantic issue in your eventually method that I'd like to > discuss. My wait_for[1] and friends take a *predicate* (in the form of > a block) and wait for it to return true(ish). Your eventually[2] > ignores the return condition, and merel

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-21 Thread Matt Wynne
On 20 Sep 2011, at 23:38, Alex Chaffee wrote: > On Tue, Sep 20, 2011 at 4:55 AM, Matt Wynne wrote: >> Thanks for all the ideas. I just rolled my own which expects a block with an >> assertion in it: > > I love the language! > >eventually { white.should be_blac

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-20 Thread Matt Wynne
/lib/selenium/wait_for.rb > > (Maybe I should put it in Wrong.) > > - A > > On Tue, Sep 13, 2011 at 3:56 AM, Matt Wynne wrote: >> Hi all, >> In GOOS[1] they use an assertion called assertEventually which samples the >> system for a success state until a certain time

[rspec-users] Assertions for asynchronous behaviour

2011-09-13 Thread Matt Wynne
Hi all, In GOOS[1] they use an assertion called assertEventually which samples the system for a success state until a certain timeout has elapsed. This allows you to synchronise the tests with asynchronous code. Do we have an equivalent of that in the Ruby / RSpec world already? I know capybar

Re: [rspec-users] rspec testing inheritance

2011-09-07 Thread Matt Wynne
On 7 Sep 2011, at 07:53, Sidu Ponnappa wrote: > > On 7 September 2011 11:09, Justin Ko wrote: >> >> >> On Tue, Sep 6, 2011 at 9:40 PM, slavix wrote: >>> >>> Hello, >>> Is there any way to test model inheritance in spec? >>> >>> something like.. >>> it { ChildModel.should < ParentModel } >

Re: [rspec-users] Speccing a redirect in routes

2011-08-10 Thread Matt Wynne
On 9 Aug 2011, at 13:11, David Chelimsky wrote: > On Aug 9, 2011, at 2:00 AM, Chris Mear wrote: > >> On 9 Aug 2011, at 01:02, David Chelimsky wrote: >> >>> On Aug 8, 2011, at 6:00 PM, Matt Wynne wrote: >>> >>>> I expected to be

[rspec-users] Speccing a redirect in routes

2011-08-08 Thread Matt Wynne
Hi, I expected to be able to do something like this in a routing spec: { :get => '/legacy/route' }.should redirect_to('/shiny/new/route') However there doesn't appear to be a redirect_to matcher, and digging deeper I can't even see an underlying Rails assertion method that will assert for redi

Re: [rspec-users] functional testing with(through?) chrome

2011-08-07 Thread Matt Wynne
On 6 Aug 2011, at 03:21, John Sayeau wrote: > Not sure if this can be done using RSpec and something else but I'm > trying to test a website using Chrome specifically. The website seems > to intermittently hang up Chrome but not Safari and it passes functional > tests without a browser. > I want

Re: [rspec-users] How can I make before/after all a method?

2011-07-29 Thread Matt Wynne
On 29 Jul 2011, at 18:36, John Hinnegan wrote: > I would like to turn this: > > describe TestClass do > before :all do > # set some config > end > after :all do > # restore some config > end > # do a bunch of tests to this > end > > into > > describe TestClass do > with_config_value(X) >

Re: [rspec-users] How to test block parameters which is sending to method with arguments??

2011-07-18 Thread Matt Wynne
On 18 Jul 2011, at 07:04, kevin peter wrote: > Hi David > i have given detailed explanation about my problem. with below link > http://pastie.org/2230103.. > Could u please help me??? > > Thanks in advance I had a quick look at this, and I have three bits of advice: 1) Hire a consultant like @

[rspec-users] tags and spec_helper

2011-06-24 Thread Matt Wynne
I've been trying to separate out some fast specs in a Rails app in a Gary Bernhardt style[1], and I experimented with using tags. The problem with using tags is that in order to scan the specs for examples that match the tags, it loads every spec file, most of which require spec_helper, which l

Re: [rspec-users] Name of current example's file:line in a before block?

2011-06-15 Thread Matt Wynne
On 15 Jun 2011, at 13:47, David Chelimsky wrote: > On Jun 15, 2011, at 7:29 AM, Matt Wynne wrote: > >> Hi, >> >> I have an idea for a tool I want to build. In a Cucumber Before() block, I >> can say: >> >> Before do |scenario| >> puts scenario.

[rspec-users] Name of current example's file:line in a before block?

2011-06-15 Thread Matt Wynne
Hi, I have an idea for a tool I want to build. In a Cucumber Before() block, I can say: Before do |scenario| puts scenario.file_colon_line end That then gives me the information I'd need to run that test case (and only that test case) again. Is there any way (however hacky / brittle) to do

Re: [rspec-users] rake 0.9.0 activated error + debugger not working?

2011-06-07 Thread Matt Wynne
On 7 Jun 2011, at 03:06, Patrick J. Collins wrote: >> rspec, not rake: > > Oops! I missed that.. So other than this debugger thing, are there any other > differences between rake spec and rspec spec? Just a bit! They're two completely different commands that run two completely different comp

Re: [rspec-users] How do you test a module that extends ActiveSupport::Concern?

2011-05-31 Thread Matt Wynne
Hi Ken, On 31 May 2011, at 19:09, Ken Egervari wrote: > I have a module that extends ActiveSupport::Concern. Here is the `included` > block: > > included do > after_save :save_tags > > has_many :taggings, :as => :taggable > has_many :tags, :through => :taggings > end > > How c

Re: [rspec-users] Cucumber and rspec, do cucumber step definitions use rspec?

2011-05-10 Thread Matt Wynne
On 9 May 2011, at 16:00, S Ahmed wrote: > I'm a bit confused as to how cucumber and rspec integrate (if they d at all?). > > You write a cucumber feature, and step definitions. > Now in the step definitions, do you write rspec in the step definitions or do > they somehow link to the spec's writ

Re: [rspec-users] before(:each) <- need some clarification

2011-04-27 Thread Matt Wynne
Hi, On 27 Apr 2011, at 20:55, Sergio Ruiz wrote: > i am setting up a few objects that are interrelated for use in an rspec > test.. > > something like: > > describe Dimension do > > before(:each) do > text = "string here" This defines a local variable 'text' which lives for the duration of th

Re: [rspec-users] Faking Files, Data, Git interractions with mocks/stubs/fixtures

2011-04-21 Thread Matt Wynne
On 19 Apr 2011, at 19:24, Josh N. wrote: > I'm new to ruby and just learning cucumber and rspec. I have some > examples(tests) that need to fake a directory structure and file > grouping, fake a properly formatted json file and fake a ruby-git > interraction (git.fetch, git.merge). > > I've been

Re: [rspec-users] added new cool matcher into my framework WatirSplash - #in

2011-04-18 Thread Matt Wynne
On 18 Apr 2011, at 13:49, Jarmo Pertman wrote: > What does the "matcher extension" mean? E.g. some separate gem, which > adds that method? > > Didn't know that ActiveSupport adds #in? to Object, but it doesn't > conflict with matcher's #in anyway. I think the point is that it clashes conceptual

Re: [rspec-users] Need suggestions on how to test a class

2011-04-13 Thread Matt Wynne
On 13 Apr 2011, at 02:48, Nicholas Wieland wrote: > Hi *, the class I need to test is: > > https://gist.github.com/49ef28014bb648ffa63e > > I know my question is very generic, but I honestly fail to see how to test > something that is so strictly procedural and so dependent to the > platform/

Re: [rspec-users] Can't put shared example group in its own file

2011-04-02 Thread Matt Wynne
On 28 Mar 2011, at 04:04, Mike T wrote: > Any ideas? All I'd like to do is have two specs in different files use the > same shared example group. I saw a similar thread about autotest, but I am > not using that. > > $ uname -a > Darwin mbp.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10

Re: [rspec-users] given-when-then-and syntax support in Rspec

2011-03-27 Thread Matt Wynne
On 27 Mar 2011, at 03:43, Rodrigo Rosenfeld Rosas wrote: > Hi David and fellows, > > I know this subject has already been discussed here and there are already > some attempts to support the given-when-then-and syntax in Rspec, like the > links below: > > https://gist.github.com/206969 > https

Re: [rspec-users] Stub a controllers helper_method in a view template helper spec

2011-03-21 Thread Matt Wynne
On 21 Mar 2011, at 10:41, Kai Schlamp wrote: > My ApplicationController exposes a method (e.g. sort_direction) to the > view templates by using > helper_method :sort_direction. > I then use this method in another method (e.g. sort_link) in a view > helper (application_helper.rb). > > When testin

Re: [rspec-users] Controller Spec & DataMapper Chaining

2011-03-19 Thread Matt Wynne
On 19 Mar 2011, at 17:49, Sid Wood wrote: > Thanks Ken, but when I said I was new to RSpec I didn't mean I was THAT new! > ;o) > > I think people aren't grasping the DataMapper chaining that is at the root of > my testing confusion. I managed to come up with a solution that I've outlined > he

Re: [rspec-users] Post call verification

2011-03-19 Thread Matt Wynne
On 19 Mar 2011, at 13:35, David Chelimsky wrote: > On Mar 18, 2011, at 10:37 AM, Srushti Ambekallu wrote: > >> Hey all, >> >> I would like to be able to be able to have mocks where I can make all the >> calls and assert that it was called afterwards. This would be especially >> useful when as

Re: [rspec-users] 'spec' command not working

2011-03-18 Thread Matt Wynne
On 18 Mar 2011, at 16:31, Will C. wrote: > Will C. wrote in post #988062: >> When I run JSpec, in the command prompt, using the "spec" command, I get >> this error: >> >> 'spec' command not recognized as a command >> >> I have the latest versions of JSpec and Ruby installed. How can I use >> th

Re: [rspec-users] Faking FS in specs

2011-03-13 Thread Matt Wynne
On 13 Mar 2011, at 22:05, Avdi Grimm wrote: > On Sun, Mar 13, 2011 at 10:30 AM, Nicholas Wieland wrote: >> Hi *, for some reasons I'm not able to fake writing on the FS during specs >> with carrierwave, someone managed to make it work ? >> I'm currently trying to use FakeFS, but apparently I'm

Re: [rspec-users] How to intercept an instance method from StdLib (1.9.2)

2011-03-06 Thread Matt Wynne
On 6 Mar 2011, at 10:30, Hedge Hog wrote: > On Sun, Mar 6, 2011 at 12:27 AM, Matt Wynne wrote: >> >> On 5 Mar 2011, at 12:06, Hedge Hog wrote: >> >>> On Fri, Mar 4, 2011 at 8:12 PM, Matt Wynne wrote: >>>> >>>> On 4 Mar 2011, at 05:45,

Re: [rspec-users] How to intercept an instance method from StdLib (1.9.2)

2011-03-05 Thread Matt Wynne
On 5 Mar 2011, at 12:06, Hedge Hog wrote: > On Fri, Mar 4, 2011 at 8:12 PM, Matt Wynne wrote: >> >> On 4 Mar 2011, at 05:45, Hedge Hog wrote: >> >>> Hi, >>> I'm struggling with something that seems to be simple, and I've not >>>

Re: [rspec-users] How to intercept an instance method from StdLib (1.9.2)

2011-03-04 Thread Matt Wynne
On 4 Mar 2011, at 05:45, Hedge Hog wrote: > Hi, > I'm struggling with something that seems to be simple, and I've not > had any joy following the RSpec books suggestions (p. 187). > I'd like to test that a method raises and error when a file is not found. > I've tried adding this in my example ju

Re: [rspec-users] Cucumber not inserting record in db

2011-03-03 Thread Matt Wynne
Hi Tushar, On 3 Mar 2011, at 04:39, Tushar Gandhi wrote: > Hi, > I am trying to learn Cucumber. I have followed the tutorial on > "http://www.ultrasaurus.com/sarahblog/2008/12/rails-2-day-3-behavior-driven-development/"; > > Everything is working fine but my problem is it is not inserting any >

Re: [rspec-users] RSpec doesn't see the DATA constant

2011-02-28 Thread Matt Wynne
On 25 Feb 2011, at 00:26, Shamaoke wrote: > Thanks for the explanations, Costi G. I didn't thought that the `DATA` > constant isn't seen by the interpreter if it is in the required file. > > The only solution that I can think of right now is the following: Why not just File.read(DATA_FILE) and

Re: [rspec-users] Problem with rendering JSON

2011-02-13 Thread Matt Wynne
On 12 Feb 2011, at 12:49, Ants Pants wrote: > > > On 11 February 2011 23:45, Matt Wynne wrote: > > On 11 Feb 2011, at 16:04, Ants Pants wrote: > >> You are my last resort for solving this issue as I have tried and tried to >> solve it myself but can't.

Re: [rspec-users] Problem with rendering JSON

2011-02-11 Thread Matt Wynne
On 11 Feb 2011, at 16:04, Ants Pants wrote: > You are my last resort for solving this issue as I have tried and tried to > solve it myself but can't. > > I'm not even sure if it's an RSpec issue but the thing is, if I run the > request from the browser, it works. Sadly, my test fails. So eithe

Re: [rspec-users] custom matchers for request specs

2011-02-08 Thread Matt Wynne
On 4 Feb 2011, at 09:30, Alan B wrote: > Hi all, I'm trying to create a custom matcher that will visit a given > path and check it's authenticated. > Here's what I have so far (using rspec-rails and capybara): > > matcher :require_authentication do > match do |path| >visit path >#page.c

Re: [rspec-users] Comparing two XML documents

2011-01-31 Thread Matt Wynne
On 31 Jan 2011, at 08:26, Pat Maddox wrote: > I load my XML docs into a hash using Hash#from_xml and then compare the > hashes. Bullseye! Thanks Pat. > On Jan 26, 2011, at 7:26 AM, Matt Wynne wrote: > >> I have a problem. I have a test that needs to assert that one XML

Re: [rspec-users] rspec-rails 2 adding current account helper to all view specs

2011-01-28 Thread Matt Wynne
Hi Rob, On 27 Jan 2011, at 21:45, Rob Westgeest wrote: > Hi, > > in rspec-1 view specs i had the ability to say: > > login_as(some_role_or_account) > > which made some helper methods like > > current_account > > that where used in views and controllers return something valuable. > > Imp

[rspec-users] Comparing two XML documents

2011-01-26 Thread Matt Wynne
I have a problem. I have a test that needs to assert that one XML document looks exactly like another XML document. I couldn't find a way to compare them as Nokogiri::XML::Documents, so I converted them both to strings with #to_xml and compared the strings. Trouble is, sometimes the attributes

Re: [rspec-users] 'require'ing files from other directories

2011-01-21 Thread Matt Wynne
On 21 Jan 2011, at 16:22, Brian Warner wrote: > Matt Wynne wrote in post #976412: >> On 20 Jan 2011, at 19:32, Brian Warner wrote: >> >>> I have a file in step_definitions that's giving me an error for an >>> uninitialized constant. My guess is I need to &

Re: [rspec-users] 'require'ing files from other directories

2011-01-20 Thread Matt Wynne
On 20 Jan 2011, at 19:32, Brian Warner wrote: > I'm going through The RSpec Book and am currently working with the > Mastermind game example. > > But that's besides the point. > > The way my directories are setup is like so: > > /mastermind/features/step_definitions... > /mastermind/lib/codebr

Re: [rspec-users] Specing Ajaxy Views

2011-01-02 Thread Matt Wynne
On 30 Dec 2010, at 03:43, Shea Levy wrote: > Hi all, > > I am working on a feature to allow administrators of an online store to > rearrange the order in which their product categories show up on the site. I > want to use a simple implementation of sortable_lists > (madrobby.github.com/script

[rspec-users] Fantastic Thread on Mock Objects

2011-01-02 Thread Matt Wynne
This is a classic, with some terrific insights from Steve Freeman and Nat Pryce, two of the finest practitioners of TDD that I know: http://groups.google.com/group/growing-object-oriented-software/t/af0c4251123fde43 cheers, Matt m...@mattwynne.net 07974 430184 _

Re: [rspec-users] Webrat or RSpec and Table Headers

2010-12-29 Thread Matt Wynne
On 29 Dec 2010, at 10:21, Matt Wynne wrote: > > On 29 Dec 2010, at 06:14, Shea Levy wrote: > >> Hi all, >> >> Suppose I have a table that lists all of my products, that includes a a >> Description somewhere in the first , and each product has its >>

Re: [rspec-users] Webrat or RSpec and Table Headers

2010-12-29 Thread Matt Wynne
On 29 Dec 2010, at 06:14, Shea Levy wrote: > Hi all, > > Suppose I have a table that lists all of my products, that includes a a > Description somewhere in the first , and each product has its > data held within a . After updating a > product's description, I want to write something like: >

Re: [rspec-users] BDD and Performance

2010-12-29 Thread Matt Wynne
On 29 Dec 2010, at 05:49, Shea Levy wrote: > Hi all, > > What's the best way to implement performance enhancements from the > outside-in? For example, if I'm working test-free and I know I'm going to be > looking up my Shops by phone number often, I'll write a migration to make > phone_number

Re: [rspec-users] RSpec2: How to avoid an example run when previous failed

2010-12-11 Thread Matt Wynne
On 10 Dec 2010, at 20:25, Gennady Bystritsky wrote: > Is there a way not to execute an example when another one fails? I want to > minimize failure noises in cases when, say, one spec checks that an array has > an expected number of elements while the others drill down on a specific > element.

Re: [rspec-users] "unit" vs. "functional" specs

2010-12-11 Thread Matt Wynne
On 10 Dec 2010, at 22:29, Andrew Wagner wrote: > I went back and forth on whether to send this to this list or the ruby-talk > list, so feel free to tell me to take a hike... > > I'm working on a personal project where I'm trying to keep a really high bar > on quality. One of the ways I'm doin

Re: [rspec-users] Comparing files

2010-12-11 Thread Matt Wynne
On 10 Dec 2010, at 16:21, Ben Mabey wrote: > On 12/10/10 8:56 AM, Matt Wynne wrote: >> Hello folks, >> >> I'm writing some tests for file upload code. The files are binary, images >> mostly. I'm futzing around a bit, trying to figure out how to assert that

Re: [rspec-users] Comparing files

2010-12-10 Thread Matt Wynne
On 10 Dec 2010, at 15:56, Matt Wynne wrote: > Hello folks, > > I'm writing some tests for file upload code. The files are binary, images > mostly. I'm futzing around a bit, trying to figure out how to assert that the > uploaded file is the same as some go

[rspec-users] Comparing files

2010-12-10 Thread Matt Wynne
Hello folks, I'm writing some tests for file upload code. The files are binary, images mostly. I'm futzing around a bit, trying to figure out how to assert that the uploaded file is the same as some golden master. If I do this: File.read(uploaded_file_path).should == File.read(path_to_expected_

Re: [rspec-users] How can I use nested "before" functions?

2010-12-03 Thread Matt Wynne
On 1 Dec 2010, at 05:47, helino wrote: > Hi everyone, > > I've started learning Ruby and RSpec, and I've ran into a small > problem. I have one "before" functions which run before all my > descriptions and the context in the spec, and then I have another > "before" function inside a context, whi

Re: [rspec-users] Factories vs. stubs/mocks

2010-08-31 Thread Matt Wynne
On 30 Aug 2010, at 18:32, Justin Ko wrote: > > > On Aug 30, 1:09 pm, Rob Biedenharn > wrote: >> On Aug 30, 2010, at 12:54 PM, Brennon Bortz wrote: >> >> >> >> >> >>> On 30 Aug 2010, at 17:17, Justin Ko wrote: On Aug 30, 11:59 am, Brennon Bortz wrote: > I am, as usual, assigning

Re: [rspec-users] Default format for all requests in a spec

2010-08-30 Thread Matt Wynne
Or you could override the #get/post/put/delete methods in your ExampleGroup describe MyController do def get(path, params) super(path, params.merge({:format => 'js'}) end it '...' do get :show, :id => 1 end end On 27 Aug 2010, at 08:00, Justin Ko wrote: > Well, you could setup

Re: [rspec-users] there should be one test or two?

2010-08-27 Thread Matt Wynne
Hi Zhenning, One assertion per test [1] is a good rule of thumb, but don't get too hung up about it. [1] http://blog.jayfields.com/2007/06/testing-one-assertion-per-test.html On 27 Aug 2010, at 06:43, Zhenning Guan wrote: > in real world, when user deposit money into their bank, bank have mone

Re: [rspec-users] Controller spec with devise.

2010-08-26 Thread Matt Wynne
David Chelimsky wrote: >On Aug 24, 2010, at 6:51 PM, Titinux wrote: > >> Hello, >> >> I'm new in using RSpec and I can't figured out to spec this controller >> action. >> >> class OrdersController < ApplicationController >> before_filter :authenticate_user! >> >> def index >>respond_wi

Re: [rspec-users] Including modules for view test in RSpec 2.0.0.beta.19

2010-08-16 Thread Matt Wynne
On 16 Aug 2010, at 05:48, David Chelimsky wrote: > 20) which will be sometime in the next week or so. Would have been > sooner, but I just got the book back from indexing (wt) and I have > some work to do before it goes off to the copyeditor (double w0t). Congratulations David! cheers, M

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

2010-08-09 Thread Matt Wynne
On 9 Aug 2010, at 13:04, David Chelimsky wrote: > > On Aug 9, 2010, at 6:37 AM, Matt Wynne wrote: > >> >> On 9 Aug 2010, at 01:54, David Chelimsky wrote: >> >>> >>> On Aug 8, 2010, at 11:13 AM, Matt Wynne wrote: >>> >>>> &

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

2010-08-09 Thread Matt Wynne
On 9 Aug 2010, at 01:54, David Chelimsky wrote: > > On Aug 8, 2010, at 11:13 AM, Matt Wynne wrote: > >> >> On 8 Aug 2010, at 16:53, David Chelimsky wrote: >> >>> On Aug 8, 2010, at 10:40 AM, Matt Wynne wrote: >>>> On 8 Aug 2010, at 16:38, Davi

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

2010-08-08 Thread Matt Wynne
On 8 Aug 2010, at 16:53, David Chelimsky wrote: > On Aug 8, 2010, at 10:40 AM, Matt Wynne wrote: >> On 8 Aug 2010, at 16:38, David Chelimsky wrote: >>> On Aug 7, 2010, at 4:10 PM, David Chelimsky wrote: >>> >>>> Hey all, >>>> >>&g

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

2010-08-08 Thread Matt Wynne
On 8 Aug 2010, at 16:38, David Chelimsky wrote: > On Aug 7, 2010, at 4:10 PM, David Chelimsky wrote: > >> Hey all, >> >> It turns out that if you have >> >> * Rails (2 or 3) >> * Ruby-1.9 >> * a model named Message >> * let(:message) or def message in an example group >> * a Rails assertion in

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

2010-08-08 Thread Matt Wynne
On 7 Aug 2010, at 23:18, David Chelimsky wrote: > On Aug 7, 2010, at 4:37 PM, Ashley Moran wrote: > >> 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 a

Re: [rspec-users] [newbie] tradeoffs of direct model access vs. simulated browser (webrat)

2010-08-04 Thread Matt Wynne
On 4 Aug 2010, at 18:44, Lille wrote: > Hi, > > My app involves the elicitation of tabular data over a succession of > controller/model/view groups. The net result is a numeric outcome > based on the entered data (basically, it's a spreadsheet on Rails.) > > Here is the nub of my question about

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

2010-07-24 Thread Matt Wynne
Lille, On Sat, 24 Jul 2010 01:26 -0500, "David Chelimsky" wrote: > On Fri, Jul 23, 2010 at 6:46 PM, Lille wrote: > > Hi, > > > > I've been browsing the RSpec book and the RDoc, but I can't see how to > > ensure the following: > > > > Stub an instance with a method it doesn't have and raise NoMet

Re: [rspec-users] How do I setup Rspec, Cucumber to test a Gem?

2010-07-19 Thread Matt Wynne
On 19 Jul 2010, at 19:05, Walther Diechmann wrote: > Hi, > > my question unwields me as a complete noob - which is okay - but I > apologize for this totally basic question <:) > > I've bought the PragProg Rspec Book and googled, been reading blogs and > what-have-I-not, but nowhere have I been

Re: [rspec-users] Data-wise context combination for controller speccing

2010-07-19 Thread Matt Wynne
On 19 Jul 2010, at 11:38, Wincent Colaiuta wrote: > El 19/07/2010, a las 10:58, Matt Wynne escribió: > >> On 18 Jul 2010, at 00:10, David Chelimsky wrote: >> >>> On Jul 17, 2010, at 1:18 PM, Costa Shapiro wrote: >>> >>>> Hello, >>>>

Re: [rspec-users] Data-wise context combination for controller speccing

2010-07-19 Thread Matt Wynne
On 18 Jul 2010, at 00:10, David Chelimsky wrote: > On Jul 17, 2010, at 1:18 PM, Costa Shapiro wrote: > >> Hello, >> >> I've been thinking of how to express my idea in code, but since I've never >> been involved in RSpec development, I'd better have some feedback here first. >> The feature sugg

Re: [rspec-users] set expectation using self in constructor?

2010-07-16 Thread Matt Wynne
On 16 Jul 2010, at 10:45, Tom Stuart wrote: > On 16 Jul 2010, at 10:29, Matt Wynne wrote: >>> For those following along at home, this exact technique did not work. The >>> +actual_foo+ variable was holding some mock value instead of the real self >>> value. >&

Re: [rspec-users] set expectation using self in constructor?

2010-07-16 Thread Matt Wynne
On 15 Jul 2010, at 14:55, Chuck Remes wrote: > > On Jul 14, 2010, at 4:20 PM, Matt Wynne wrote: > >> >> You can do this, by using a test spy to remember the value of foo passed >> into the stubbed constructor and then later comparing it: >> >>

Re: [rspec-users] set expectation using self in constructor?

2010-07-14 Thread Matt Wynne
On 14 Jul 2010, at 15:26, Chuck Remes wrote: > I find myself using this pattern quite a bit. > > rspec 1.30 > ruby 1.9.1, 1.9.2-rc2, jruby 1.51 all on osx 10.6.4 > > class Foo > def initialize >@bar = Bar.new > end > end > > context "init" do > it "should allocate a helper class Bar" do

Re: [rspec-users] (rspec2/rails3) spec'ing the details of a controller that is not purely *skinny* by design.

2010-07-12 Thread Matt Wynne
On 12 Jul 2010, at 06:43, Kevin wrote: > Awesome discussion you've started here, very fun read for a new rspec > follower. > > Just wanted to throw in that I've found setting a > "cattr_accessor :current_user" in the user model to hold the current > user to be very handy in terms of simplifying

Re: [rspec-users] Possible improvements to routing spec API

2010-07-05 Thread Matt Wynne
On 5 Jul 2010, at 08:00, Wincent Colaiuta wrote: > Hi folks, > > I've been unhappy with routing specs for a long time now and last night when > updating some old 1.3 specs for 2.0 I decided to see if I could come up with > something that didn't make me feel unhappy. > > Principal causes of un

Re: [rspec-users] Using RSpec and Cucumber with Rails 3 Engines

2010-06-29 Thread Matt Wynne
On 29 Jun 2010, at 06:54, aslak hellesoy wrote: > On Tue, Jun 29, 2010 at 4:58 AM, Brandon Olivares > wrote: >> Hi, >> >> I recently upgraded to Rails 3 beta, a few weeks ago. One thing I would >> really like to do is to develop components of my application, because some >> of them I'd really l

  1   2   3   4   5   6   7   >