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

2008-10-13 Thread Chris Olsen
Oscar Del ben wrote: > David Chelimsky wrote: >> It's definitely happening. We've enlisted a few additional >> contributors and the wheels are spinning faster now. >> >> As for the beta book, I don't know if there will be on at this point. >> We may go straight to print. Either way, I'll update as

[rspec-users] Issues after removal of rpsec plugins and gem install

2008-11-01 Thread Chris Olsen
autotest will no longer run my tests after I installed the rpsec gem and removed the plugins. I did install the rspec-rails gem as well. Is anyone else having this issue? -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users

Re: [rspec-users] Issues after removal of rpsec plugins and gem install

2008-11-01 Thread Chris Olsen
I see that in 1.1.5 you are no longer supposed to use autotest. Things are now working using autospec. -- 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] Issues after removal of rpsec plugins and gem install

2008-11-01 Thread Chris Olsen
Chris Olsen wrote: > I see that in 1.1.5 you are no longer supposed to use autotest. Things > are now working using autospec. I now noticed that what you mentioned in your reply. I totally missed that point. Thanks again David. -- Posted via http://www.ruby-for

Re: [rspec-users] Issues after removal of rpsec plugins and gem install

2008-11-01 Thread Chris Olsen
David Chelimsky wrote: > On Sat, Nov 1, 2008 at 3:25 PM, Chris Olsen <[EMAIL PROTECTED]> > wrote: >> autotest will no longer run my tests after I installed the rpsec gem and >> removed the plugins. I did install the rspec-rails gem as well. >> >> Is anyone e

[rspec-users] RSpec seems to be having a hard time loading Helper classes

2007-10-10 Thread Chris Olsen
I am getting the error when I run the command: rake spec This is a new project with not current test written besides the ones auto-created for me. + $ rake spec (in /Users/chrisolsen/Projects/Rails/chrisolsen/trunk) /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/

Re: [rspec-users] RSpec seems to be having a hard time loading Helper clas

2007-10-11 Thread Chris Olsen
That was the problem. I didn't even occur to me that it was looking for that helper class. Thanks for the help. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspe

[rspec-users] Spec::Rails::DSL::HelperEvalContextController: missing defau

2007-10-15 Thread Chris Olsen
Just created a new project and this is the error that I am getting when I try to run my rspec tests: Spec::Rails::DSL::HelperEvalContextController: missing default helper path spec/rails/dsl/helper_eval_context_helper Spec::Rails::DSL::ViewExampleController: missing default helper path spec/rails/

Re: [rspec-users] Spec::Rails::DSL::HelperEvalContextController: missing d

2007-10-15 Thread Chris Olsen
> Please just call them "specs" :) done > What command are you using here? it happens for both "rake spec" and autotest -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/lis

[rspec-users] generate script_controller not creating test code

2007-10-15 Thread Chris Olsen
For some reason when I ran it this time it decided not to create any view or controller tests. I had already created the corresponding model with the rpsec_model script before trying to create the controller. I am not sure if there is something that I did incorrectly or not. Does anyone know why

Re: [rspec-users] generate script_controller not creating test code

2007-10-15 Thread Chris Olsen
please disregard this post. I got a little a head of myself and forgot that they were only created with the rspec_scaffold script. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/ma

Re: [rspec-users] generate script_controller not creating test code

2007-10-15 Thread Chris Olsen
Steve wrote: > On Tue, 16 Oct 2007 04:44:55 +0200, Chris Olsen wrote: > >> For some reason when I ran it this time it decided not to create any >> view or controller tests. I had already created the corresponding model >> with the rpsec_model script before trying to c

[rspec-users] Does a mock model have to satisfy contraints

2007-10-16 Thread Chris Olsen
I am a little confused to the what happens with the following: before do @site = mock_model(Site, :to_param => "1") Site.stub!(:new).and_return(@site) end def post_with_successful_save @site.should_receive(:save).and_return(true) post :create, :site => {} end I understand

Re: [rspec-users] Does a mock model have to satisfy contraints

2007-10-16 Thread Chris Olsen
That is what I thought (and was hoping for) Thanks David. > This is a bit tricky. What you're setting up here (which is true of > message expectations in general, not must mock_model) is an > expectation that @site will receive the message :save and that when it > does receive it, you are instru

[rspec-users] Can't delete app/helpers

2007-11-01 Thread Chris Olsen
I would like to remove some unused helpers from the app/helpers dir, but when I do so my specs fail. Why is this? I don't see where those helpers are referenced within the tests. Is there a way to delete these unused files? Thanks -- Posted via http://www.ruby-forum.com/. __

Re: [rspec-users] Can't delete app/helpers

2007-11-01 Thread Chris Olsen
> A stacktrace would help /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -S script/spec -O spec/spec.opts spec/views/addresses/show.rhtml_spec.rb spec/helpers/addresses_helper_spec.rb spec/views/addresses/index.rhtml_spec.rb spec/views/addresses/edit.rhtml_spec.rb spec

Re: [rspec-users] Can't delete app/helpers

2007-11-02 Thread Chris Olsen
Hans de Graaff wrote: > Looks like you still have a (possibly generated?) spec for this helper. > > Kind regards, > > Hans I do, but the issue is that it requires the app/helpers/addresses_helper.rb file, which is that one that I am trying to delete. `load_missing_constant': Expected /Users/c

[rspec-users] Why is this view spec failing?

2007-11-06 Thread Chris Olsen
I can't figure out why I am getting a failure. It renders out fine in the browser. New member <%= error_messages_for :member %> <% form_for(:member, :url => members_path) do |f| %> Member Info First Name: <%= f.text_field :first_name %> Last Name: <%= f.text_field :last_name %

Re: [rspec-users] Why is this view spec failing?

2007-11-06 Thread Chris Olsen
Thanks for the help David. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] Unexplainable failure...at least for me

2007-11-06 Thread Chris Olsen
I have an address model with country_id and province_id fields There is also a full_address method that returns an address that is in a format that the google maps api will be able to return a long-lat coords. Within the full_address method there is a call to obtain the province/state and country

Re: [rspec-users] Unexplainable failure...at least for me

2007-11-07 Thread Chris Olsen
That is the problem, which is clear now that I tested it with the script/console in test mode rather than development. So now the question is, why does the data not exist in the test database. The country and province data inserts exist within the migration files, ex for countries: class Crea

Re: [rspec-users] Unexplainable failure...at least for me

2007-11-07 Thread Chris Olsen
Chris Olsen wrote: > That is the problem, which is clear now that I tested it with the > script/console in test mode rather than development. > > So now the question is, why does the data not exist in the test > database. The country and province data inserts exist within t

Re: [rspec-users] Unexplainable failure...at least for me

2007-11-07 Thread Chris Olsen
That would make sense. Thanks for the help. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] Not sure why this is failing

2007-11-17 Thread Chris Olsen
I am not sure why the tests don't see the call of the new method for the Address class. It can be seen in the controller method where the Address.new is called. >> @address = Address.new(params[:address]) What am I doing wrong? Thanks for the help. Here is the error message: Spec::Mocks::MockEx

Re: [rspec-users] Not sure why this is failing

2007-11-17 Thread Chris Olsen
Steve Ross wrote: > Try with(nil) > > I think params[:user] will return nil. yip that works, after fooling with it I also found that :any_args works as well as any (I guess this one is more than just a symbol) Thanks for the help. -- Posted via http://www.ruby-forum.com/.

[rspec-users] How thorough do you test?

2007-11-21 Thread Chris Olsen
Testing models is great and would not be able to create anything without it, but I am finding testing the controllers and views is a pain. Rest based controllers don't seem to change that much when compared to the auto-generated code that obviously works. As for views I fail to see why testing it

Re: [rspec-users] How thorough do you test?

2007-11-21 Thread Chris Olsen
Thanks for the info. @Ben I like the top down approach that you mentioned. It definitely makes more sense to why I would test the views and how it will better define the model parameters. @Scott I think that I am currently on the same page as you. Right now I don't use a mock model in my cre

[rspec-users] route_for and nested resources

2007-11-21 Thread Chris Olsen
I can't figure out how to make the updates to allow for the route_form method to return a url that matches the expected. Here is a sample route_for(:controller => :task, :action => :new).should == "/task/new" If a task has to be created for a user, how exactly do I do this. The following doesn't

Re: [rspec-users] Creation of spec.opts spec_helper etc

2007-11-22 Thread Chris Olsen
Thanks Scott. And of course after you tell me, I now see it sitting on the rspec documentation page ever so elegantly. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listi

[rspec-users] Creation of spec.opts spec_helper etc

2007-11-22 Thread Chris Olsen
When do these files, along with lib/spec and lib/spec_server get created? I tried to create a quick test project and can't remember how they were created in a previous project. Thanks -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing li

[rspec-users] svn: Connection closed unexpectedly when getting trunk

2007-12-04 Thread Chris Olsen
Is anyone else getting this message? With rails 2.0 pre-releases it looks like you also have to be working with the latest version of rpsec. $ ruby script/plugin install svn://rubyforge.org/var/svn/rspec/trunk/rspec svn: Connection closed unexpectedly The above is what I get when I try to instal

Re: [rspec-users] svn: Connection closed unexpectedly when getting trunk

2007-12-04 Thread Chris Olsen
David Chelimsky wrote: > > Try: > > http://rspec.rubyforge.org/svn/trunk/rspec > http://rspec.rubyforge.org/svn/trunk/rspec_on_rails That worked much better. Thanks -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@r

[rspec-users] What to test for views?

2007-12-09 Thread Chris Olsen
When you guys test views, what are you testing? Do you just test that all the form fields exist in a new.rhtml, that all form fields are filled in an edit.rhtml, and that all the proper columns are are shown in a index.rhtml page, or is there something more that should be tested? Thanks. -- Poste

Re: [rspec-users] can't access helper methods for model testing

2007-12-11 Thread Chris Olsen
This isn't the best example, as I normally wouldn't validate a mock model, it was more for demonstration, although a bad one. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/l

[rspec-users] can't access helper methods for model testing

2007-12-11 Thread Chris Olsen
I would like to have some valid mock models readily available in the helper module, but when I try to access the helper I get the error saying that the method is not found. === describe MembersHelper do # Helper methods can be called directly in the examples (it blocks) def valid_member_mock

Re: [rspec-users] can't access helper methods for model testing

2007-12-13 Thread Chris Olsen
>> What am I missing? Are these helpers only for controller tests? > > Rails helpers are there for views and controllers, not for models. > > If you want an RSpec helper, something you use to set up state for > your examples, you can write a module and include it in the example > groups - but t

Re: [rspec-users] How do I mock params?

2007-12-13 Thread Chris Olsen
Ya, just ignore this post, except for the question regarding the rpsec book. I really do wish there was a way to delete your own posts :) -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge

[rspec-users] How do I mock params?

2007-12-13 Thread Chris Olsen
Here is the code within the controller: Line 69: @photo = @member.build_photo(params[:photo]) unless params[:photo][:uploaded_data].blank? I got a little ahead of myself and wrote the code, and now have a bunch of errors telling me that: --- 6) NoMethodError in 'Spec::Rails::Example::Control

[rspec-users] specs on private methods

2008-01-08 Thread Chris Olsen
How does a person test private methods? Is there a way to declare them as private, but retain any tests that were written during the initial development? Thanks. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyfor

Re: [rspec-users] specs on private methods

2008-01-08 Thread Chris Olsen
Will obj.send(:method) work in 1.9 or is it saying that the send call requires 2 params, the method and the object reference? -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman

[rspec-users] Could this controller test be made simpler?

2008-01-28 Thread Chris Olsen
In a create controller method I am testing the else clause that occurs when the model is unable to be saved. Sounds simple enough, but because model is created before the save and the form has to be re-filled I now have to stub a model and all the attributes. Since the error messages are displaye

Re: [rspec-users] Could this controller test be made simpler?

2008-01-28 Thread Chris Olsen
Good point. I guess it was the account.user, account.users.build and all the validation methods that I thought may be unnecessary. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/ma

[rspec-users] Stubbing controller methods vs model methods

2008-01-29 Thread Chris Olsen
I had an error that I couldn't figure out, then when writing up a question for the forum I figured it out. The thing is I don't understand why the change that was made works and why what existed before didn't. Here is the initial post when I had the error: -- In th

Re: [rspec-users] Stubbing controller methods vs model methods

2008-01-29 Thread Chris Olsen
Hey Ben, That makes perfect sense. Thanks for pointing out the error because I don't think I would've been able to figure it out. Thanks, as well, for the stubbing/mocking tip. I will keep my eyes open for that in the future. -- Posted via http://www.ruby-forum.com/.

[rspec-users] Order of the get call and xxx.should

2008-01-30 Thread Chris Olsen
Just out of curiosity, why is that the following .should calls have to differ to work? The first is a normal check on the if the user is redirected if not logged in = it "should redirect the user to the login screen" do do_get response.should redirect_to(new_session_url) end The

Re: [rspec-users] Order of the get call and xxx.should

2008-01-30 Thread Chris Olsen
> Because the response object doesn't exist before the 'get'. That makes things clearer. There have been a couple times that I have put the response.should call before the do_get based on the reason you mentioned, in setting up a stub before the call to the method is made. Then after getting

[rspec-users] Error on nil.build

2008-02-04 Thread Chris Olsen
I can't figure out why I am getting an error for one of the tests below: describe AccountsController, "POST" do before :each do @user = mock_model(User) @account = mock_model(Account, :id => 1, :valid => true, :save => true, :users => mock("users", :build => @user

Re: [rspec-users] Error on nil.build

2008-02-04 Thread Chris Olsen
Ooops there was a typo on the method causing the error. It should be: It is this test that fails it "should make the relation to the users" do @account.should_receive(:users) # removed the .and_return do_post end Is there a better way to test that the data is being loaded into the related

[rspec-users] How can you delete unused view helper files?

2008-04-07 Thread Chris Olsen
I would like to delete most of the view helper files from my project. Unfortunately, when I try to run my tests it throws an error saying that one of the files is missing. I find that all the non-required helper files clutter things up. Is there any way to remove them and still have your tests pa

Re: [rspec-users] How can you delete unused view helper files?

2008-04-07 Thread Chris Olsen
Scott Taylor wrote: > On Apr 7, 2008, at 9:34 AM, Chris Olsen wrote: > >> I would like to delete most of the view helper files from my project. >> Unfortunately, when I try to run my tests it throws an error saying >> that >> one of the files is missing. &

[rspec-users] Haml and View tests

2008-04-07 Thread Chris Olsen
Does Rspec work nicely with Haml for controller integrated view tests? I am getting the following error: === ActionView::TemplateError in 'Admin::ListingsController index should get a 200 OK' undefined method `photo' for true:TrueClass On line #2 of admin/listings/_listing.html.ham

[rspec-users] Is testing output within content_for possible?

2008-04-19 Thread Chris Olsen
I wanted to test that the links below were being rendered in the views. - content_for :sidebar do %ul.links %li= edit_link edit_admin_contact_url(@contact), "Contact" # view test it "should have the correct side bar links" do do_render response.should have_tag("ul.links") d

Re: [rspec-users] Is testing output within content_for possible?

2008-04-20 Thread Chris Olsen
Bryan Ray wrote: > This might be of some use: > > http://rubyforge.org/pipermail/rspec-users/2007-June/001954.html > That should do it! Thanks Bryan -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http

[rspec-users] Create haml files with rspec_controller command?

2008-06-15 Thread Chris Olsen
It is a nuisance to have to rename all of your files from .erb to .haml. Is there a quick way around this? -- 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] Create haml files with rspec_controller command?

2008-06-15 Thread Chris Olsen
Thanks for letting me know. A ticket has been created. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users