[rspec-users] Refactoring and using each

2008-10-08 Thread Jeroen van Dijk
Hi all, I'm new to this list and new to RSpec so I have been trying out RSpec the last couple of days and I find it very a natural way of testing. So first of all thanks for providing this framework. Now, I have written some tests for my controllers and models and I saw myself writing similar

Re: [rspec-users] Refactoring and using each

2008-10-08 Thread David Chelimsky
On Wed, Oct 8, 2008 at 6:01 AM, Jeroen van Dijk [EMAIL PROTECTED] wrote: Hi all, I'm new to this list and new to RSpec so I have been trying out RSpec the last couple of days and I find it very a natural way of testing. So first of all thanks for providing this framework. Now, I have

[rspec-users] cucumber and fixtures

2008-10-08 Thread Daniel Higginbotham
Is it possible to use spec fixtures with Cucumber, and if so, how? Thanks, Daniel Higginbotham -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Adding Test Spy into Rspec mocking framework

2008-10-08 Thread Joseph Wilk
Brian Takita wrote: On Sun, Sep 21, 2008 at 11:17 AM, Joseph Wilk [EMAIL PROTECTED] wrote: I've been doing further work on adding the Test Spy to the RR mocking framework. Awesome! Do you have a clone available? I'm not quite ready to push my work up to Github. I've been trying lots

Re: [rspec-users] cucumber and printed step and line number

2008-10-08 Thread Joseph Wilk
aidy lewis wrote: Hi, Today I installed the latest cucumber gem. For some reason, the actual current step file and step line number is being printed to the right of the step in the console. E.g. And enters into job reference# steps/publish_content_steps.rb:134 Is this a switch I

[rspec-users] cucumber and printed step and line number

2008-10-08 Thread aidy lewis
Hi, Today I installed the latest cucumber gem. For some reason, the actual current step file and step line number is being printed to the right of the step in the console. E.g. And enters into job reference# steps/publish_content_steps.rb:134 Is this a switch I can turn off? Aidy

Re: [rspec-users] cucumber and printed step and line number

2008-10-08 Thread David Chelimsky
On Wed, Oct 8, 2008 at 6:56 AM, aidy lewis [EMAIL PROTECTED] wrote: Hi, Today I installed the latest cucumber gem. For some reason, the actual current step file and step line number is being printed to the right of the step in the console. E.g. And enters into job reference#

Re: [rspec-users] cucumber and fixtures

2008-10-08 Thread aslak hellesoy
On Wed, Oct 8, 2008 at 3:16 PM, Daniel Higginbotham [EMAIL PROTECTED] wrote: Is it possible to use spec fixtures with Cucumber, and if so, how? Google for cucumber fixtures http://www.ruby-forum.com/topic/165215 http://www.ruby-forum.com/topic/165777 Thanks, Daniel Higginbotham -- Posted

Re: [rspec-users] cucumber and fixtures

2008-10-08 Thread Daniel Higginbotham
aslak hellesoy wrote: On Wed, Oct 8, 2008 at 3:16 PM, Daniel Higginbotham [EMAIL PROTECTED] wrote: Is it possible to use spec fixtures with Cucumber, and if so, how? Google for cucumber fixtures http://www.ruby-forum.com/topic/165215 http://www.ruby-forum.com/topic/165777 Yep, I've

[rspec-users] Rspec: gem vs. plugin?

2008-10-08 Thread Wes Gamble
All, I have some experience with Rspec from about a year ago. At that time, there was a gem and a plugin, and a Rspec on Rails plugin. Should I only be using the gem? With the 1.1.8 gem, if I try to do rake rspec in my Rails app., nothing happens. Do I need to use the Rspec Rails plugin

[rspec-users] Basic Rspec operation questions

2008-10-08 Thread Wes Gamble
With Rails, is rake spec supposed to automatically run under the test environment? I have to do rake spec RAILS_ENV=test in order to get the environments/test.rb file to load. Also, are the standard Test::Unit fixtures automatically loaded before each test in each spec file? This appears to

Re: [rspec-users] Rspec: gem vs. plugin?

2008-10-08 Thread Wes Gamble
I, the OP, meant rake spec. Sorry for the confusion. Craig Demyanovich wrote: On Wed, Oct 8, 2008 at 3:09 PM, Pat Maddox [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: To OP: you said that rake spec doesn't do anything...did you run script/generate rspec to get the rspec rake

Re: [rspec-users] When is spec_helper.rb actually executed?

2008-10-08 Thread Scott Taylor
On Oct 8, 2008, at 6:26 PM, Wes Gamble wrote: I'm trying to debug what I suspect is a case where spec_helper.rb is not being executed. I put a puts statement inside the Spec::Runner.configure do |config| block, and I can't ever see the printout. When does spec_helper.rb get run during

Re: [rspec-users] When is spec_helper.rb actually executed?

2008-10-08 Thread Wes Gamble
Scott Taylor wrote: On Oct 8, 2008, at 6:26 PM, Wes Gamble wrote: I'm trying to debug what I suspect is a case where spec_helper.rb is not being executed. I put a puts statement inside the Spec::Runner.configure do |config| block, and I can't ever see the printout. When does spec_helper.rb

Re: [rspec-users] When is spec_helper.rb actually executed?

2008-10-08 Thread Pat Maddox
Wes Gamble [EMAIL PROTECTED] writes: Scott Taylor wrote: On Oct 8, 2008, at 6:26 PM, Wes Gamble wrote: I'm trying to debug what I suspect is a case where spec_helper.rb is not being executed. I put a puts statement inside the Spec::Runner.configure do |config| block, and I can't ever see

Re: [rspec-users] cucumber and fixtures

2008-10-08 Thread Daniel Higginbotham
Zach Dennis wrote: I use seed_fu with cucumber. http://github.com/mbleigh/seed-fu/tree To load them I use the following my features/steps/env.rb. I reload them for every scenarios: Before do ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])

Re: [rspec-users] cucumber and fixtures

2008-10-08 Thread Pat Maddox
Daniel Higginbotham [EMAIL PROTECTED] writes: Zach Dennis wrote: I use seed_fu with cucumber. http://github.com/mbleigh/seed-fu/tree To load them I use the following my features/steps/env.rb. I reload them for every scenarios: Before do

Re: [rspec-users] Basic Rspec operation questions

2008-10-08 Thread David Chelimsky
On Wed, Oct 8, 2008 at 3:41 PM, Wes Gamble [EMAIL PROTECTED] wrote: Zach, Zach Dennis wrote: # This file is copied to ~/spec when you run 'ruby script/generate rspec' # from the project root directory. ENV[RAILS_ENV] = test require File.expand_path(File.dirname(__FILE__) +

Re: [rspec-users] When is spec_helper.rb actually executed?

2008-10-08 Thread David Chelimsky
On Wed, Oct 8, 2008 at 5:58 PM, Pat Maddox [EMAIL PROTECTED] wrote: Wes Gamble [EMAIL PROTECTED] writes: Scott Taylor wrote: On Oct 8, 2008, at 6:26 PM, Wes Gamble wrote: I'm trying to debug what I suspect is a case where spec_helper.rb is not being executed. I put a puts statement

[rspec-users] Testing Views with Authentication

2008-10-08 Thread Donald French
I am trying to figure out how to properly test a view when part of the view is is protected with a role check % if current_user.admin? %.. How do I force a log in or mock the current user. I need to do it in a DRY way as this is used throughout the system checking various privileges.

Re: [rspec-users] When is spec_helper.rb actually executed?

2008-10-08 Thread Wes Gamble
OK, got it. I have a follow-up question though. If a given spec DID NOT require spec_helper.rb, doesn't that imply that the spec would be run against the Rails development environment. I just did a test where I printed out the configuration of one of my classes DB connnections (e.g.

Re: [rspec-users] Basic Rspec operation questions

2008-10-08 Thread Wes Gamble
David Chelimsky wrote: On Wed, Oct 8, 2008 at 3:41 PM, Wes Gamble [EMAIL PROTECTED] wrote: Zach, Zach Dennis wrote: # This file is copied to ~/spec when you run 'ruby script/generate rspec' # from the project root directory. ENV[RAILS_ENV] = test require

Re: [rspec-users] When is spec_helper.rb actually executed?

2008-10-08 Thread David Chelimsky
On Wed, Oct 8, 2008 at 6:40 PM, Wes Gamble [EMAIL PROTECTED] wrote: OK, got it. I have a follow-up question though. If a given spec DID NOT require spec_helper.rb, doesn't that imply that the spec would be run against the Rails development environment. Not necessarily. Depends on what was

Re: [rspec-users] Basic Rspec operation questions

2008-10-08 Thread David Chelimsky
On Wed, Oct 8, 2008 at 6:42 PM, Wes Gamble [EMAIL PROTECTED] wrote: David Chelimsky wrote: On Wed, Oct 8, 2008 at 3:41 PM, Wes Gamble [EMAIL PROTECTED] wrote: Zach, Zach Dennis wrote: # This file is copied to ~/spec when you run 'ruby script/generate rspec' # from the project root

[rspec-users] What makes specs run against the test database?

2008-10-08 Thread Wes Gamble
I just did a test where I ran one spec and deep deep within the code under test, I printed out the DB connection of the AR class of a given object, like so: puts invoice.class.connection.inspect My spec requires spec_helper.rb, which supposedly sets the Rails environment to be test. However,

Re: [rspec-users] What makes specs run against the test database?

2008-10-08 Thread Nick Hoffman
On 2008-10-08, at 19:50, Wes Gamble wrote: I just did a test where I ran one spec and deep deep within the code under test, I printed out the DB connection of the AR class of a given object, like so: ..snip.. which shows that I am hitting my development database. Why would I see this

Re: [rspec-users] Testing Views with Authentication

2008-10-08 Thread David Chelimsky
On Wed, Oct 8, 2008 at 6:31 PM, Donald French [EMAIL PROTECTED] wrote: I am trying to figure out how to properly test a view when part of the view is is protected with a role check % if current_user.admin? %.. How do I force a log in or mock the current user. I need to do it in a DRY way as

Re: [rspec-users] Basic Rspec operation questions

2008-10-08 Thread Wes Gamble
David Chelimsky wrote: On Wed, Oct 8, 2008 at 3:41 PM, Wes Gamble [EMAIL PROTECTED] wrote: Zach, Zach Dennis wrote: # This file is copied to ~/spec when you run 'ruby script/generate rspec' # from the project root directory. ENV[RAILS_ENV] = test require

Re: [rspec-users] What makes specs run against the test database?

2008-10-08 Thread Wes Gamble
Yes. Nick Hoffman wrote: On 2008-10-08, at 19:50, Wes Gamble wrote: I just did a test where I ran one spec and deep deep within the code under test, I printed out the DB connection of the AR class of a given object, like so: ..snip.. which shows that I am hitting my development database.

Re: [rspec-users] ArgumentError in is a pending example - block not supplied

2008-10-08 Thread David Chelimsky
On Wed, Oct 8, 2008 at 1:15 PM, Matt Wynne [EMAIL PROTECTED] wrote: We have a few unfinished examples in our code of the form it should and does do something do # stuff end it should do something someday it should and does do something else do