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

2012-03-22 Thread Chris Habgood
Are you really sure you need a polymorphic table? On Thu, Mar 22, 2012 at 12: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 >

Re: [rspec-users] cucumber is_admin? testing

2011-12-07 Thread Chris Habgood
This is an rspec mailing list. On Wed, Dec 7, 2011 at 12:48, Alex Whiteland wrote: > hmm... > > I changed 2 servers to friend with google. wtf? > > first - 37.com, > second - hushmail.com > > Maybe, google think it is spam and sends to it folder. Can yo find my > letters in it? > > -- > Posted v

Re: [rspec-users] newbie cucumber tutorial

2011-11-16 Thread Chris Habgood
this group is for rspec On Wed, Nov 16, 2011 at 11:34, Vin MR wrote: > I'm new with Ruby and Cucumber. I've tried this simple test, but it > didn't work for me > > Given > When I enter ABC on keyboard > Then ... > > > And here is the ruby code > When /^I enter "([^\"]*) on keyboard$/ do |i

Re: [rspec-users] mongo_mapper validations, rpsec

2011-09-04 Thread Chris Habgood
MongoMapper::DocumentNotValid: Validation failed: Password can't be blank, Email can't be blank, Password digest can't be blank On Sun, Sep 4, 2011 at 19:06, Nick wrote: > What does the backtrace say? > ___ > rspec-users mailing list > rspec-us

Re: [rspec-users] mongo_mapper validations, rpsec

2011-09-04 Thread Chris Habgood
Sorry, it fails validation which it should but it errors out in the cli as opposed to going along and checking, it does not get past the inital factory new line: Failure/Error: user = Factory(:user, :email=> '', :password => '') MongoMapper::DocumentNotValid: Validation failed: Passwo

[rspec-users] mongo_mapper validations, rpsec

2011-09-04 Thread Chris Habgood
I have a basic user class and doing rspec validations. When I do a factory create to produce validations it blows up before I can get to the second line to check for errors. Ideas how to get this to perform like AR Validations? MongoMapper::DocumentNotValid: Validation failed: Password

Re: [rspec-users] rails 3.1 with guard, not detecting changes

2011-09-01 Thread Chris Habgood
Yes I needed to run the guard with bundle exec. On Thu, Sep 1, 2011 at 09:58, Tim Gremore wrote: > Have you added any of the available Guards (guard-rails) to your project? > https://github.com/guard/guard/wiki/List-of-available-Guards > > On Sun, Aug 28, 2011 at 9:36 PM, Chris Ha

[rspec-users] rails 3.1 with guard, not detecting changes

2011-09-01 Thread Chris Habgood
I am using guard to detect changes and run rspec automatically. It doe snot seem to see my changes in a model when guard is run. When I run "rake spec" from the cli rspec runs fine. Does anyone know why this might be happening? ___ rspec-users mailin

[rspec-users] mongo_mapper

2011-08-28 Thread Chris Habgood
I have a rails 3.1 app. I am using mongo_mapper, but when I run rake rspec it says: Mongoid is not installed (gem install mongoid) Any idea where this could be coming from. I am using: gem 'machinist', '>= 2.0.0.beta2' gem 'machinist2_mongomapper', :require => "machinist_mongomapper" gem

Re: [rspec-users] RSpec 2 not finding specs from subdirectories when trying to run specs from there

2011-06-01 Thread Chris Habgood
Try this in your spec helper file: Dir[Rails.root.join("spec/factories/**/*.rb")].each {|f| require f} On Wed, Jun 1, 2011 at 09:14, Jarmo Pertman wrote: > Hi! > > When having a file structure like this: > project > -spec >-subdir > -my_spec.rb > > and then being in directory "project

Re: [rspec-users] [rails] undefined method `model_name' for NilClass:Class

2011-05-31 Thread Chris Habgood
yes On Tue, May 31, 2011 at 15:33, Ken Egervari wrote: > Dumb question, do you have required "spec_helper" at the top of the file? > > Ken > > > > On Tue, May 31, 2011 at 4:03 PM, Chris Habgood wrote: > >> Ya, that is not working. The code I gave

Re: [rspec-users] [rails] undefined method `model_name' for NilClass:Class

2011-05-31 Thread Chris Habgood
Ya, that is not working. The code I gave you I was trying different things out. Rails 3.0 Rspec rspec (2.6.0.rc6) On Tue, May 31, 2011 at 14:35, Ken Egervari wrote: > Oh, don't forget the :id in the call to edit > > > before(:each) do > @food = Food.new > @food.id = 1 > end > > d

Re: [rspec-users] [rails] undefined method `model_name' for NilClass:Class

2011-05-31 Thread Chris Habgood
quot;).and_return(@food) puts @food get :edit, :id => @food.id assigns(:food).should be(@food) end end end On Tue, May 31, 2011 at 13:50, Ken Egervari wrote: > > On Tue, May 31, 2011 at 2:38 PM, Chris Habgood wrote: > >> Still g

Re: [rspec-users] [rails] undefined method `model_name' for NilClass:Class

2011-05-31 Thread Chris Habgood
s_controller_spec.rb:21:in `block (2 levels) in ' On Tue, May 31, 2011 at 13:57, Chris Habgood wrote: > The program works when I run it on the server. > > describe FoodsController do > render_views > >before(:each) do > Food.delete_all > login_as_ad

Re: [rspec-users] [rails] undefined method `model_name' for NilClass:Class

2011-05-31 Thread Chris Habgood
find).with("1").and_return(@food) >> >> get :edit, :id => "1" >> >> assigns(:food).should be(@food) >> end >> end >> >> This is still very fast, and it has the added benefit that you can use >>

[rspec-users] [rails] undefined method `model_name' for NilClass:Class

2011-05-28 Thread Chris Habgood
Never seen the error above before, code: describe "edit action" do it "edit action should render edit template" do food = Food.create(:name=>'mooo') # Food.any_instance.stubs(:valid?).returns(true) get :edit, :id => food.id response.should render_template(:edit)

Re: [rspec-users] [rails] expecting <"edit"> but rendering with <"">.

2011-05-24 Thread Chris Habgood
action should render edit template" do #Food.stub(:find_by_id).and_return(food) Food.any_instance.stubs(:valid?).returns(true) response.should render_template(:edit) end end On Tue, May 24, 2011 at 19:38, Chris Habgood wrote: > no. > > > On Tu

Re: [rspec-users] [rails] expecting <"edit"> but rendering with <"">.

2011-05-24 Thread Chris Habgood
no. On Tue, May 24, 2011 at 19:21, Justin Ko wrote: > > > On Tue, May 24, 2011 at 6:10 PM, Chris Habgood wrote: > >> It is already there. >> >> On Tue, May 24, 2011 at 19:05, Justin Ko wrote: >> >>> >>> >>> On Tue, May 24

Re: [rspec-users] [rails] expecting <"edit"> but rendering with <"">.

2011-05-24 Thread Chris Habgood
It is already there. On Tue, May 24, 2011 at 19:05, Justin Ko wrote: > > > On Tue, May 24, 2011 at 2:25 PM, Chris Habgood wrote: > >> I keep getting "" returned when looking for a template: >> >> describe "edit action" do >>

[rspec-users] [rails] expecting <"edit"> but rendering with <"">.

2011-05-24 Thread Chris Habgood
I keep getting "" returned when looking for a template: describe "edit action" do it "edit action should render edit template" do Food.stub(:find_by_id).and_return(food) response.should render_template(:edit) end end __

Re: [rspec-users] autorun?

2011-05-24 Thread Chris Habgood
I am running rspec2 with a rails 3 app no autorun required. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] [rails] cannot find id

2011-05-24 Thread Chris Habgood
No idea why this is not working: describe "stub_model(Food) with a hash of stubs" do let(:food) do stub_model Food end it "edit action should render edit template" do get :edit, :id => food response.should render_template(:edit) end Says cannot find a

Re: [rspec-users] rails3 session issue i think

2011-05-17 Thread Chris Habgood
I have this in my admin controller: before_filter :login_required before_filter :admin_required def admin_required current_user.is_admin? end ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/

[rspec-users] rails3 session issue i think

2011-05-17 Thread Chris Habgood
I just started using rspec. I have controllers that inherit from an admin controller. If I modify them to inherit from applicationcontroller the rspec test works. If I inherit from admincontroller i get "" back for a new template. Is there something I am missing to get this to work? The pro