[rspec-users] Spec for validation plugin

2007-07-26 Thread rob_twf
Hi, I'm writing a specification for a model called Location which has a post_code attribute which should be a valid UK postcode. I'm using the http://svn.designbyfront.com/rails/plugins/validates_as_uk_postcode/ validates_as_uk_postcode plugin to handle the validation but I'm not sure how I sho

Re: [rspec-users] MockCov: Proof of concept

2007-07-26 Thread Scott Taylor
Yeah - I think that's a neat idea too. Does the code only work with RSpec's mocking framework? Maybe it could be integrated into Rcov somehow. Scott On Jul 25, 2007, at 12:27 PM, Marcus Ahnve wrote: > Really cool - I have asked myself that question several times. > > /Marcus > > On 7/25/07,

Re: [rspec-users] Mocking Access Control

2007-07-26 Thread Justin Williams
I've done some more work on the specs, and it seems that my mocks aren't pushing in the roles array associated with current_user. describe UsersController do before(:each) do @user = mock_model(User, :id => 1, :email => '[EMAIL PROTECTED]', :password => 'teamup' )

Re: [rspec-users] Mocking Access Control

2007-07-26 Thread Courtenay
For starters, refactor your user<-->roles interaction. class User def has_role?(name) role = Role.find_by_name(name) roles.include?(role) end end Trust me, this will make things much easier to spec, and later, to scale. Also, it keeps the DB-specific stuff ("find") in the model, wh

Re: [rspec-users] MockCov: Proof of concept

2007-07-26 Thread David Chelimsky
On 7/25/07, Ian Leitch <[EMAIL PROTECTED]> wrote: > Hey list, > > RSpec is great, I've been using it at work for a couple of months now. One > gripe I have is that I find it hard to know exactly to what extent my code > is covered by the specs. I am aware of RCov and Heckle; they're great, but > I'

Re: [rspec-users] response.should_not redirect_to

2007-07-26 Thread David Chelimsky
On 7/26/07, Yurii Rashkovskii <[EMAIL PROTECTED]> wrote: > David, > > >> > >> Here is an extract from my source code > >> > >> it "should allow authenticated user to access '#{action}'" do > >>@user = mock_user_authentication(:id => 1, :identity_url => > >> "http://openid.server/yrashk

Re: [rspec-users] response.should_not redirect_to

2007-07-26 Thread Yurii Rashkovskii
David, >> >> Here is an extract from my source code >> >> it "should allow authenticated user to access '#{action}'" do >>@user = mock_user_authentication(:id => 1, :identity_url => >> "http://openid.server/yrashk";, :queues => []) >>get action, params >>assigns[:curre

Re: [rspec-users] response.should_not redirect_to

2007-07-26 Thread Yurii Rashkovskii
David, Depending on action, it is either successful response or response that redirects somewhere (but not to login, since user is "proven" to be authenticated). In this example, I really don't want to care, whether it was successful response or redirection to somewhere,

Re: [rspec-users] response.should_not redirect_to

2007-07-26 Thread David Chelimsky
On 7/26/07, Yurii Rashkovskii <[EMAIL PROTECTED]> wrote: > > On Jul 27, 2007, at 3:26 AM, David Chelimsky wrote: > > > On 7/26/07, Yurii Rashkovskii <[EMAIL PROTECTED]> wrote: > >> Hey, > >> > >> May be it is just too deep night over here and I'm missing something > >> though I got this failure on

Re: [rspec-users] rspec_resource error

2007-07-26 Thread Paul Brackenridge
On 26/07/07, Marcus Crafter <[EMAIL PROTECTED]> wrote: It's been renamed from rspec_resource to rspec_scaffold in a more recent release, looks like you're installation is good to go. We should look at updating the web site to reflect the name change. Hope this helps mate. Cheers, Marcus

Re: [rspec-users] rspec_resource error

2007-07-26 Thread Marcus Crafter
Hi Paul, On 27/07/2007, at 1:13 AM, Paul Brackenridge wrote: > When I run script/generate I get the following: > > Installed Generators > Plugins: authenticated, rspec, rspec_controller, rspec_model, > rspec_scaffold > Builtin: controller, integration_test, mailer, migration, model, > obs

Re: [rspec-users] Spec for validation plugin

2007-07-26 Thread David Chelimsky
On 7/26/07, rob_twf <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm writing a specification for a model called Location which has a > post_code attribute which should be a valid UK postcode. I'm using the > http://svn.designbyfront.com/rails/plugins/validates_as_uk_postcode/ > validates_as_uk_postcode

Re: [rspec-users] Canonical way to generate RSpec HTML report in Rails app

2007-07-26 Thread Johan Sørensen
On Jul 26, 2007, at 6:54 PM, Peter Marklund wrote: > Hi Don! > Thanks, that looks nice. For now I'm just using this bash alias: > > alias specdoc='spec spec -f h:spec/spec_report.html; open spec/ > spec_report.html' > > However, I guess it's nicer to have this be a Rake task so that it > can be u

[rspec-users] Canonical way to generate RSpec HTML report in Rails app

2007-07-26 Thread Peter Marklund
Hi! I was just wondering how you typically generate a spec HTML report in a Rails app. Currently I'm doing something like this: spec spec -f h:spec/spec_report.html But that seems sort of clumsy and I would have thought that there was a rake task for it. Have I overlooked something? Thanks!

Re: [rspec-users] response.should_not redirect_to

2007-07-26 Thread Yurii Rashkovskii
On Jul 27, 2007, at 3:26 AM, David Chelimsky wrote: > On 7/26/07, Yurii Rashkovskii <[EMAIL PROTECTED]> wrote: >> Hey, >> >> May be it is just too deep night over here and I'm missing something >> though I got this failure on {{{response.should_not redirect_to}}}: >> >> 'QueuesController should a

Re: [rspec-users] response.should_not redirect_to

2007-07-26 Thread David Chelimsky
On 7/26/07, Yurii Rashkovskii <[EMAIL PROTECTED]> wrote: > Hey, > > May be it is just too deep night over here and I'm missing something > though I got this failure on {{{response.should_not redirect_to}}}: > > 'QueuesController should allow authenticated user to access 'show'' > FAILED > Matcher d

[rspec-users] response.should_not redirect_to

2007-07-26 Thread Yurii Rashkovskii
Hey, May be it is just too deep night over here and I'm missing something though I got this failure on {{{response.should_not redirect_to}}}: 'QueuesController should allow authenticated user to access 'show'' FAILED Matcher does not support should_not. See Spec::Matchers for more information

Re: [rspec-users] Canonical way to generate RSpec HTML report in Rails app

2007-07-26 Thread Don Petersen
There might be a "better" way to do it, but I basically ripped off the builtin spec:doc Rake task almost verbatim and made a custom task in my Rails app for generating the HTML report. This isn't anything magical, but you should be able to drop a file called "whatever_you_want.rake" in you

[rspec-users] rspec_resource error

2007-07-26 Thread Paul Brackenridge
First of all hi, I'm new to the list, and rather new to rspec as will probably show in myquestion. I have tried installing rspec and rspec_on_rails as plugs both using "script/install" and "piston import" commands using the "current release install instructions" here [1]. However, there doesn't s

[rspec-users] Coding standards and whitespace

2007-07-26 Thread Wincent Colaiuta
Recently as a result of using Git I've noticed a number of inconsistencies in the RSpec codebase with respect to whitespace (mixed line endings, mixed use of spaces and tabs for indentation, and trailing whitespace at the end of lines). I never would have noticed, but Git produces nice colo

[rspec-users] rspec_on_rails magical incantations

2007-07-26 Thread David Richards
I ran into something really puzzling today. I don't know exactly why it's happening, but I thought I'd share my experiences. I started a dummy app just to test an idea outside of the context of my real work today. So, I quickly get things started: * rails junk * cd junk * ruby script/plugin

Re: [rspec-users] Canonical way to generate RSpec HTML report in Rails app

2007-07-26 Thread Peter Marklund
Hi Don! Thanks, that looks nice. For now I'm just using this bash alias: alias specdoc='spec spec -f h:spec/spec_report.html; open spec/ spec_report.html' However, I guess it's nicer to have this be a Rake task so that it can be used by the whole development team. I was looking for an easy w