[rspec-users] how to mock active record relationships

2009-10-20 Thread Christoph ----
Hi I am new to Rspec and try to mock my controller that looks like def create @friendship = current_user.friendships.build(:friend_id => params[:friend_id]) if @friendship.save flash[:notice] = "Added friend." render :text => flash[:notice] else flash[:error] = "Erro

Re: [rspec-users] Stub that returns hash values

2009-10-20 Thread Carl Graff
Ashley Moran wrote: On 20 Oct 2009, at 17:36, Carl Graff wrote: Is it possible to create a stub that returns hash values. For example I would like to convert this: @siteItem = stub('plmSiteItem', :one => "uno") To something like this: @siteItem = stub('plmSiteItem', {'one' => 'uno', 'two' =>

Re: [rspec-users] undefined method `use_transactional_fixtures=' on windows with spec_server

2009-10-20 Thread David Chelimsky
On Tue, Oct 20, 2009 at 1:44 PM, mikev wrote: > Any suggestions for what to check when running on windows with: > rspec (1.2.9) > rspec-rails (1.2.9) > rails 2.3.3 > ruby 1.8.6 > spec_server > FYI - spec_server is removed from rspec-rails as of 1.2.9 and is no longer being maintained by me. If a

Re: [rspec-users] [ANN] rspec-rails 1.2.9 Released

2009-10-20 Thread mikev
Any suggestions for what to causes exception: undefined method `use_transactional_fixtures=' when running on windows with: rspec (1.2.9) rspec-rails (1.2.9) ruby script/spec_server autospec with --drb option ___ rspec-users mailing list rspec-users@ruby

[rspec-users] undefined method `use_transactional_fixtures=' on windows with spec_server

2009-10-20 Thread mikev
Any suggestions for what to check when running on windows with: rspec (1.2.9) rspec-rails (1.2.9) rails 2.3.3 ruby 1.8.6 spec_server Run autospec with --drb option and get the following exception. Run autospec or 'spec spec' works fine. /spec/spec_helper.rb:19: undefined method `use_transactiona

Re: [rspec-users] Help in Stubing is_admin? method

2009-10-20 Thread Ashley Moran
On 20 Oct 2009, at 19:31, elza.more...@tagview.com.br wrote: Thank you for your replay. I did not mention that I have a method called in before_filter to set @user. before_filter :find_current, :only => [:show, :edit, :update, :destroy] The method is def find_current @user = User.find(g

Re: [rspec-users] Stub that returns hash values

2009-10-20 Thread Ashley Moran
On 20 Oct 2009, at 17:36, Carl Graff wrote: Is it possible to create a stub that returns hash values. For example I would like to convert this: @siteItem = stub('plmSiteItem', :one => "uno") To something like this: @siteItem = stub('plmSiteItem', {'one' => 'uno', 'two' => 'dos'} ) So that

[rspec-users] Stub that returns hash values

2009-10-20 Thread Carl Graff
Is it possible to create a stub that returns hash values. For example I would like to convert this: @siteItem = stub('plmSiteItem', :one => "uno") To something like this: @siteItem = stub('plmSiteItem', {'one' => 'uno', 'two' => 'dos'} ) So that I can do this: @siteItem['one'] should ==

[rspec-users] be_none and be_any don't seem to work properly

2009-10-20 Thread iain
Hi all! I'm testing some named scopes. I use be_all(&:some_predicate) to test if all the elements in the collection are valid, which works, but when I try to test the inverse, it fails. You can see the complete code at: http://gist.github.com/213636 But in short: subject = User.active subject.s

[rspec-users] Can't get running a simple rspec test: assigns is always nil

2009-10-20 Thread Alexander Seidl
http://pastie.org/pastes/661816 hi, please have a look at my code. Perhaps anybody knows a solution for that problem. Attachments: http://www.ruby-forum.com/attachment/4165/pastie-661816.txt -- Posted via http://www.ruby-forum.com/. ___ rspec-users ma