[rspec-users] Can I set subject to its own method call?

2012-01-05 Thread m
The symbol "subject" by default is an instance of the described class. In some method testing I often want to set the subject to be a method call to the instance, for example "city.parse_input()". I tried to do describe '#parse_input' do subject{ subject.parse_input() } #returns hash ... end but

Re: [rspec-users] Can I set subject to its own method call?

2012-01-05 Thread m
    it 'is a hash' do >       input.should be_a(Hash)              # This evaluates let(:input) >     end >   end > end > > Hope that helps. > > Andrew > > On Thursday 05 January 2012 at 11:26 AM, m wrote: > > > > > > > > > The symbol "s

Re: [rspec-users] Do you still Write Tests First on code that is churning hard?

2010-02-19 Thread m...@franklakatos.com
I kind of follow a similar principle here. Many times I will write app code because in not sure how to pull of the functionality I'm try to do. Once I can confirm that I'm getting the expected results, I take a mental note of what I did, remove the code, and drive it out again with the spec

Re: [rspec-users] rake spec loads development environment

2011-03-21 Thread Jared M.
This thread has been dead for awhile, but I'm having the same issue. I don't have a bash variable set. I'm also having this issue with Cucumber. It always runs in development mode. If I put "p Rails.env" in spec_helper.rb:8 (after spec_helper already declares ENV["RAILS_ENV"] ||= "test") and

[rspec-users] rspect weird problem

2011-12-05 Thread Andres M.
Hello everyone, this is really urgent so ill be quick, here is some ruby code that i know works: require 'csv' class Motorcycle attr_reader :name, :weight @@count = 0 def self.find (name) found = nil ObjectSpace.each_object(Motorcycle) { |o| fo

Re: [rspec-users] rspect weird problem

2011-12-06 Thread Andres M.
Patrick Collins wrote in post #1035294: >> Motrocicle.create > > I don't know if this helps, but I am pretty sure "Motrocicle.create" > isn't what > you intended to call. > > Also, I'd like to point out that: > >> def self.find (name) >> found = nil >> ObjectSpace.each_obj

Re: [rspec-users] rspect weird problem

2011-12-06 Thread Andres M.
no, that didn't work, but i found that i may be due to garbage collector taking place before test starts, so the solution was to add a set called instances and then in the initialize method put the following code line "instances << self", this way my instances had a root, preventing the garbage

[rspec-users] Sufficiently tested?

2012-03-09 Thread U. M.
Hi everybody, I have a general question about how many different cases have to be covered in one Example. Considering the famous Fizzbuzz program, you should test if your output is either "Fizz", "buzz", "Fizzbuzz" or just the number (between 1 and 100). Pretty simple. However, I often see soluti

[rspec-users] Rspec for thor script

2012-09-14 Thread ankush m.
Hello all, I recently developed a CLI extending thor API. While i was trying to write specs for thor's tasks, I couldn't find any way to write the same for tasks with mandatory options or with options. So can anyone please guide me for the same? -- Posted via http://www.ruby-forum.com/

[rspec-users] stricter routing specs with conditional routes

2009-03-24 Thread m...@gorbul.net
Hello, could you please advise me how to test conditional routes with rspec v1.2.0 ? I have something like the following in my application. map.with_options(:namespace => "admin/", :conditions => { :subdomain => /^admin$/i }, :name_prefix => "admin_

Re: [rspec-users] Performance tests using Rspec

2011-01-27 Thread Josep M. Bach
A while ago, I was looking at Minitest's benchmarking capabilities (contained in a single file here) and I thought it would be great to have an equivalent in RSpec. They have methods to assert type of performance (lin

[rspec-users] testing modules

2008-01-18 Thread Neil M. Young
I've developed a module to include in ActiveRecord derived classes. Can I test the module without having to tie it to a particular class? atm, I'm including it in my User class and writing the tests in user_spec.rb, but I don't like the idea of tying the module tests to those of the class. I may

[rspec-users] DRYing up stories

2008-01-23 Thread Neil M. Young
I'm finding that I'm writing sets of very similar scenarios to check access permissions for each of my actions. Does anyone have suggestions on how to dry this up: Given an existing Account And a logged in Admin When the user visits account/manage Then he should get access Given an existing Acco

Re: [rspec-users] DRYing up stories

2008-01-24 Thread Neil M. Young
DD violations there? I personally don't mind the somewhat complex steps because as Ben pointed out, the plain text stories are more manageable this way and still very readable. Neil M. Young wrote: > > I'm finding that I'm writing sets of very similar scenarios to check >

[rspec-users] re -raise exceptions in stories?

2008-01-24 Thread Neil M. Young
I see that rails handles exceptions in stories by rendering public/500.html, whereas in controller specs exceptions are re-raised. Is it possible to have this same behaviour in stories so I can check the correct exceptions are being raised? -- View this message in context: http://www.nabble.com/

[rspec-users] colored output for stories?

2008-02-08 Thread Neil M. Young
sorry if this is documented somewhere, but do stories support colored output? neither -c nor --color are working for me. -- View this message in context: http://www.nabble.com/colored-output-for-stories--tp15363648p15363648.html Sent from the rspec-users mailing list archive at Nabble.com.

Re: [rspec-users] colored output for stories?

2008-02-11 Thread Neil M. Young
aslak hellesoy wrote: > > On Feb 8, 2008 9:50 PM, Neil M. Young <[EMAIL PROTECTED]> wrote: >> >> sorry if this is documented somewhere, but do stories support colored >> output? >> neither -c nor --color are working for me. > > It works for me. What&

[rspec-users] Modules will no longer be automatically included in RSpec version 1.1.4

2008-05-23 Thread Lori M Olson
Can anyone (David?) shed some light on what exactly this warning is complaining about? I started seeing it when I upgraded to Rails 2.1 RC1 and the latest RSpec from git. I'm getting it in some helper specs that I'm writing. And yes, I am including a module there, to reuse some utility me

Re: [rspec-users] Modules will no longer be automatically included in RSpec version 1.1.4

2008-05-23 Thread Lori M Olson
why this is showing up. Pat On 5/23/08, Pat Maddox <[EMAIL PROTECTED]> wrote: It appears when you write a spec like describe FooModule do ... Pat On 5/23/08, Lori M Olson <[EMAIL PROTECTED]> wrote: Can anyone (David?) shed some light on what exactly this warning is complaini

Re: [rspec-users] Modules will no longer be automatically included in RSpec version 1.1.4

2008-05-23 Thread Lori M Olson
On 23-May-08, at 4:48 PM, David Chelimsky wrote: On May 23, 2008, at 4:35 PM, Lori M Olson wrote: Can anyone (David?) shed some light on what exactly this warning is complaining about? I started seeing it when I upgraded to Rails 2.1 RC1 and the latest RSpec from git. I'm getting

Re: [rspec-users] Autotest/RSpec 1.1.4/Rails 2.1 Infinite Loop?

2008-06-19 Thread Lori M Olson
On 19-Jun-08, at 9:10 AM, Kyle Hargraves wrote: The typical cause of these infinite loops is that your test suite updates some file in your project; autotest notices the change and immediately starts again. The solution is to simply add exceptions to your project's .autotest, ignoring any files

Re: [rspec-users] Open source projects using RSpec

2008-07-04 Thread Lori M Olson
Someone on the list was just referencing Typo - http://svn.typosphere.org/typo/trunk/spec/controllers/comments_controller_spec.rb Doesn't look like they use stories, though. On 4-Jul-08, at 4:29 AM, Olivier Dupuis wrote: Hello, Anyone knows of open source projects that uses RSpec and RSpec

Re: [rspec-users] Is BDD with RSpec cheaper?

2008-07-07 Thread Lori M Olson
On 7-Jul-08, at 12:25 PM, yitzhakbg wrote: This might be a loaded question on this forum, but here goes: Just had a discussion with a prospective employer, a Ruby On Rails shop. His reaction to BDD development on every project was skeptical, saying something like: "It depends on the projec

[rspec-users] Baffled by error running rake rspec:models

2008-07-10 Thread Lori M Olson
In my application, we connect to 2 databases, so we make a lot of specs to test this type of interaction. When I run individual model specs using spec, or using rake spec SPEC=xxx, they run *fine*. When I run rake spec:models, all the specs which connect to the 2nd database fail on errors

Re: [rspec-users] Rspec - stubbing same class multiple times with different co

2008-07-22 Thread Lori M Olson
Have you tried using should_receive instead of stub! ? Sent from my iPhone On 22-Jul-08, at 8:37 PM, Ry An <[EMAIL PROTECTED]> wrote: Im having a hard time with a rspec controller test im writting, I need to stub! the User.find call twice once to return the owning user and once to return the v

Re: [rspec-users] RSpec book?

2007-08-08 Thread M. Edward (Ed) Borasky
Ashley Moran wrote: > I hope it will have plenty of BDD theory. I'm still waiting for that > magic book I can give to someone and say "here - read this, it tells > you how to build software". I have two copies, but as far as I know it's still in print. If you can't find it, let me know -- I'l

Re: [rspec-users] Reason for _spec.rb convention

2007-09-05 Thread M. Edward (Ed) Borasky
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ashley Moran wrote: > On 4 Sep 2007, at 23:36, Dan North wrote: > >> C-hash > > I think you meant C-pound... > > > > ___ > rspec-user

Re: [rspec-users] Spec/Test Speed

2007-10-03 Thread M. Edward (Ed) Borasky
Scott Taylor wrote: > Just wanted to pick some smart people about this topic: What are you > guys doing to increase the speed of your specs? > > I'm a big fan of autotest, but right now my current project has 438 > specs (for rails). Most of them are in the model, and for all of > them we a

Re: [rspec-users] Spec/Test Speed

2007-10-03 Thread M. Edward (Ed) Borasky
Scott Taylor wrote: >> If your test suite and application are fully open source and you don't >> mind someone playing with it, I'm collecting benchmark suites for the >> Ruby interpreter and would love to have a nice heavy "rspec" run as an >> example of real-world Ruby usage. Contact me off-list i

Re: [rspec-users] RSpec Book(s) on the radar

2007-10-05 Thread M. Edward (Ed) Borasky
David Chelimsky wrote: > On 10/5/07, Cody P. Skidmore <[EMAIL PROTECTED]> wrote: >> I just found this one: http://tinyurl.com/3c3mfa >> >> David, are there any other RSpec books in the works? > > Yes! > > Alsak and I are writing Behaviour Driven Development in Ruby with > RSpec for the Pragmatic

Re: [rspec-users] Using RSpec to drive the design of a GUI desktop application

2007-11-17 Thread M. Edward (Ed) Borasky
Matthijs Langenberg wrote: > Hello everybody, > > I've been using RSpec as a tool to create web applications for some time > now, in Rails, and using plain Ruby with WEBrick as well. The tool suits > my needs and the story runner is great. > Now there are things that aren't solvable on the web,

Re: [rspec-users] [ANN] Lighthouse and Engine Yard sponsorships

2007-11-19 Thread M. Edward (Ed) Borasky
Luis Lavena wrote: > the use of cygwin git is a bit problematic, and sometimes eol styles > mixes don't like the different interpreters (unix eol against windows > eol) with ruby-mswin32 and ruby cygwin. Yeah, I'll echo this. I do a lot of work with Perl, and it's a real bear to port Cygwin Perl