Re: [rspec-users] stack level too deep

2010-08-27 Thread Justin Ko
One thing I notice is you have get '/' yet you don't have a root route. You can define a root route like so: root :to = pages#home Also, you can run your requests by doing rake spec:requests On Aug 27, 4:12 pm, Daniel Lidström dlidst...@gmail.com wrote: Hello, I am trying to run my first

Re: [rspec-users] Default format for all requests in a spec

2010-08-27 Thread Justin Ko
Well, you could setup a default parameter hash: describe MyController do let(:params) { {:format = 'js'} } describe '#show' do it '...' do get :show, params.merge(:id = 1) end end end You could also take it another level: describe MyController do let(:params) { {:format =

Re: [rspec-users] there should be one test or two?

2010-08-27 Thread Justin Ko
The best practice in your situation is to have two specs like so: describe #deposit do it 'adds $10 to a savings account' do user.bank.deposit(10) user.bank.deposit.saving.should == 10 end it 'creates a deposit record' do user.bank.deposit(10) user.deposit_record.should ==

Re: [rspec-users] Controller spec with devise.

2010-08-27 Thread Justin Ko
This is how I do it: before { sign_in(user_record) } describe #index do before do controller.current_user.stub(:orders) { ... } end it ... do get :index end end Hope that helps. On Aug 24, 7:51 pm, Titinux jeremie.horh...@titinux.net wrote: Hello, I'm new in using RSpec and

Re: [rspec-users] respond_to? check in rspec-mocks

2010-08-27 Thread Justin Ko
On Aug 27, 8:18 pm, Myron Marston myron.mars...@gmail.com wrote: One of the primary dangers of using mocks is that your unit tests may be testing against an interface that is different from that of your production objects.  You may simply have misspelled the method (e.g.

Re: [rspec-users] respond_to? check in rspec-mocks

2010-08-27 Thread Justin Ko
On Aug 27, 8:24 pm, Justin Ko jko...@gmail.com wrote: On Aug 27, 8:18 pm, Myron Marston myron.mars...@gmail.com wrote: One of the primary dangers of using mocks is that your unit tests may be testing against an interface that is different from that of your production objects.  You

Re: [rspec-users] stack level too deep

2010-08-27 Thread Justin Ko
On Aug 27, 4:12 pm, Daniel Lidström dlidst...@gmail.com wrote: Hello, I am trying to run my first integration tests of my rails 3 application. All tests fail with an error stack level too deep. The tests are intended to verify the link routes and look like this:

Re: [rspec-users] stack level too deep

2010-08-27 Thread Justin Ko
On Aug 27, 8:44 pm, Justin Ko jko...@gmail.com wrote: On Aug 27, 4:12 pm, Daniel Lidström dlidst...@gmail.com wrote: Hello, I am trying to run my first integration tests of my rails 3 application. All tests fail with an error stack level too deep. The tests are intended to verify

Re: [rspec-users] respond_to? check in rspec-mocks

2010-08-27 Thread Justin Ko
On Aug 27, 8:18 pm, Myron Marston myron.mars...@gmail.com wrote: One of the primary dangers of using mocks is that your unit tests may be testing against an interface that is different from that of your production objects.  You may simply have misspelled the method (e.g.

Re: [rspec-users] respond_to? check in rspec-mocks

2010-08-28 Thread Justin Ko
Not necessarily. In the case of a stub on a real object, the purpose is to control the environment in which the example runs. Consider a method on an object that returns one value before noon and a different value at noon and after. In an example for another object that depends on the

Re: [rspec-users] stack level too deep

2010-08-28 Thread Justin Ko
On Aug 28, 6:59 am, Daniel Lidström dlidst...@gmail.com wrote: On 28 Aug, 04:13, Justin Ko jko...@gmail.com wrote: I would suggest switching to capybara. Hi Justin, I tried changing a part of my Gemfile to this: group :development, :test do   gem 'rspec-rails', '= 2.0.0.beta.19

Re: [rspec-users] stack level too deep

2010-08-28 Thread Justin Ko
On Aug 28, 2:44 pm, Daniel Lidström dlidst...@gmail.com wrote: On 28 Aug, 19:32, David Chelimsky dchelim...@gmail.com wrote: On Aug 28, 2010, at 11:33 AM, Justin Ko wrote: Did you remove webrat from the Gemfile? That won't help with beta.19, which has a hard dependency on webrat

Re: [rspec-users] rspec2: autotest keeps rerunning failing tests

2010-08-30 Thread Justin Ko
Following the instructions in the README, I still have this problem. Downgrading to RSpec beta 19 fixes it. On Aug 30, 11:08 am, David Chelimsky dchelim...@gmail.com wrote: On Aug 30, 2010, at 9:56 AM, Justin Ko wrote: On Aug 30, 8:00 am, nathanvda nathan...@gmail.com wrote: I can't

Re: [rspec-users] Factories vs. stubs/mocks

2010-08-30 Thread Justin Ko
On Aug 30, 11:59 am, Brennon Bortz bren...@brennonbortz.com wrote: I am, as usual, assigning an instance variable in a controller's index action to find all instances of a model in the database.  I want to write a spec that checks that this variable is assigned correctly.  I can do: it

Re: [rspec-users] Factories vs. stubs/mocks

2010-08-30 Thread Justin Ko
On Aug 30, 12:54 pm, Brennon Bortz bren...@brennonbortz.com wrote: On 30 Aug 2010, at 17:17, Justin Ko wrote: On Aug 30, 11:59 am, Brennon Bortz bren...@brennonbortz.com wrote: I am, as usual, assigning an instance variable in a controller's index action to find all instances

Re: [rspec-users] Factories vs. stubs/mocks

2010-08-30 Thread Justin Ko
On Aug 30, 1:09 pm, Rob Biedenharn r...@agileconsultingllc.com wrote: On Aug 30, 2010, at 12:54 PM, Brennon Bortz wrote: On 30 Aug 2010, at 17:17, Justin Ko wrote: On Aug 30, 11:59 am, Brennon Bortz bren...@brennonbortz.com wrote: I am, as usual, assigning an instance variable

Re: [rspec-users] Factories vs. stubs/mocks

2010-08-30 Thread Justin Ko
On Aug 30, 1:32 pm, Justin Ko jko...@gmail.com wrote: On Aug 30, 1:09 pm, Rob Biedenharn r...@agileconsultingllc.com wrote: On Aug 30, 2010, at 12:54 PM, Brennon Bortz wrote: On 30 Aug 2010, at 17:17, Justin Ko wrote: On Aug 30, 11:59 am, Brennon Bortz bren...@brennonbortz.com

Re: [rspec-users] rails3/rspec2: how to write mailer tests?

2010-09-02 Thread Justin Ko
On Sep 2, 11:24 am, Toni Tuominen tjt...@utu.fi wrote: On Thu, Sep 2, 2010 at 6:16 PM, nathanvda nathan...@gmail.com wrote: This will sound awfully stupid, but i have no idea how to start writing any mailer tests. I have a mailer class    class SmsMailer ActionMailer::Base      

Re: [rspec-users] rails3: in production i get uninitialised constant rspec?

2010-09-13 Thread Justin Ko
On Sep 13, 3:58 am, nathanvda nathan...@gmail.com wrote: Whoops. Found it! I have a rcov.rake inside my lib/tasks like this: desc  Run all specs with rcov RSpec::Core::RakeTask.new(test_cov) do |t|   t.rcov = true   t.rcov_opts = %w{--rails --include views --exclude gems\/,spec

Re: [rspec-users] rspec-rails setup in Rails 3

2010-09-13 Thread Justin Ko
Hello, It looks like you started your integration spec with context. Try starting it (top level) with describe. Think of context as setting the context for what you are describing. Let us know if that fixes it. On Sep 9, 1:46 pm, Lee Smith autige...@gmail.com wrote: I'm missing something in my

Re: [rspec-users] passing a block to a stub method

2010-09-13 Thread Justin Ko
On Sep 13, 6:32 pm, nicolas nicolas.br...@gmail.com wrote: It seems that rspec doesn't support passing a block to a stub method. This code fails: def call_build_with_block(o)   o.build do     puts hello   end end describe call_build_with_block do   it should call build with block do  

Re: [rspec-users] Behavior of object.foo(x) when you've stubbed it using object.stub(:foo).with(y)

2010-09-19 Thread Justin Ko
On Sep 19, 8:08 pm, Myron Marston myron.mars...@gmail.com wrote: The current behavior of rspec-mocks causes a NoMethodError when you call object.foo(x) after setting up a stub using object.stub(:foo).with(y).  Here's an example for when this has caused me a problem: - In a before(:each)

Re: [rspec-users] having some issues with factory_girl and bundler...

2010-09-27 Thread Justin Ko
On Sep 27, 4:11 pm, Carmen Díaz Echauri cdecha...@gmail.com wrote: Hi All Need some brilliants minds here :) I'm using Rails 2.3.8 ruby 1.8 (I know, I know... ) I've move my gems from .gems to Bundler, but I'm having some issues with Factory_girl when I rake spec uninitialized constant

Re: [rspec-users] having some issues with factory_girl and bundler...

2010-09-27 Thread Justin Ko
On Sep 27, 6:22 pm, Craig Demyanovich cdemyanov...@gmail.com wrote: On Mon, Sep 27, 2010 at 5:05 PM, Justin Ko jko...@gmail.com wrote: On Sep 27, 4:11 pm, Carmen Díaz Echauri cdecha...@gmail.com wrote: Hi All Need some brilliants minds here :) I'm using Rails 2.3.8 ruby 1.8 (I

Re: [rspec-users] Could not find shared example group named an admin is logged in

2010-10-07 Thread Justin Ko
On Oct 7, 5:36 pm, Tim Gremore timgrem...@gmail.com wrote: I'm stuck! Not sure what I'm missing but I'm struggling to get a shared example group working with my controller specs.  Here is a piece of the backtrace: /Users/20217633/.rvm/gems/ruby-1.9.2...@rails3/gems/rspec-core-2.0.0.rc/lib

Re: [rspec-users] RSpec-2.0.0 is released!

2010-10-11 Thread Justin Ko
-rails. * Myron Marston for a wealth of thoughtful contributions including Cucumber features that we can all learn from * Justin Ko for his direct contributions to rspec, and for relish ( http://relishapp.com/), which makes executable documentation act more like documentation. ### What's

Re: [rspec-users] Testing initialize methods and chained methods

2010-10-19 Thread Justin Ko
On Oct 19, 3:56 am, Oscar Del Ben thehcdrea...@gmail.com wrote: I'm having some troubles understanding how to test a couple of things. Usually, if I'm having trouble testing something, it means that my design could probably be improved or changed, but in these cases I think I'm doing the

Re: [rspec-users] Not sure why let is not doing the same thing as traditional test

2010-11-02 Thread Justin Ko
I'm under the weather so I won't be able to give you a thorough answer. #let - The block is executed when you call it. #let! - The block is wrapped in a before(:each) filter. So, you want to use #let! On Nov 2, 7:55 pm, Nadal node.j...@gmail.com wrote: Here is my test which passes.    before

Re: [rspec-users] Constant resolution fails in describes inside of modules using rspec 2 on ruby 1.9.1

2010-11-03 Thread Justin Ko
Use ruby 1.9.2 - sorry on my iphone On Nov 3, 4:49 pm, Rhett Sutphin rh...@detailedbalance.net wrote: Hi, I've converted a couple of my smaller libraries' spec suites to rspec 2 with no trouble.  (I'm enjoying the new version -- thanks to all involved.)  I'm trying to convert one a larger

Re: [rspec-users] Excluding a spec subdirectory from rake spec

2011-02-08 Thread Justin Ko
On Feb 8, 6:49 pm, Corey Haines coreyhai...@gmail.com wrote: I have a directory in my spec directory that I want to exclude from rake spec That is, I have spec/lib_no_rails And I don't want it to run when I do rake spec Best way? Thanks. -Corey --http://www.coreyhaines.com The

Re: [rspec-users] stubbing out after_create AR method?

2011-02-14 Thread Justin Ko
On Feb 14, 11:31 am, Fearless Fool li...@ruby-forum.com wrote: I have a Premise model with an after_create method, along the lines of: class Premise ActiveRecord::Base   ...   after_create :etl_attributes   ... end In production code, etl_attributes accesses the web.  For testing I'm

Re: [rspec-users] Stubbing Scopes

2011-02-15 Thread Justin Ko
Your expectation (should_receive) is expecting start_of_day, which uses Time.zone. The actual on_day scope does day.to_time.beginning_of_day, which does not use any time zone. Therefore, the arguments to in_interval are not the same as the expectation. And because they are not the same, the mock

Re: [rspec-users] Stubbing Scopes

2011-02-15 Thread Justin Ko
and (2) is failing. Output as before:   Failure/Error: Allocation.on_day(start_of_day + 3.hours).should == result   NoMethodError:     undefined method `includes_values' for result:String Any ideas? Best regards, Christoph Schiessl On Feb 15, 2011, at 18:51 , Justin Ko wrote

Re: [rspec-users] [rspec-rails] Exception catching in controller

2011-02-17 Thread Justin Ko
On Feb 17, 7:36 am, Avdi Grimm gro...@inbox.avdi.org wrote: On Wed, Feb 16, 2011 at 7:24 AM, Yuriy Naidyon yuro...@gmail.com wrote: def some_action   raise Exception if some_falsy_value rescue   @message = 'Error' end Don't raise Exception. Raise some descendant of StandardError,

Re: [rspec-users] it_behaves_like and running single examples

2011-02-17 Thread Justin Ko
On Feb 16, 7:34 am, Andrew Vargo ajva...@gmail.com wrote: Hello, I am running rspec 2 and rails 3 in a project. When I have a shared example being used in a spec file, I loose the ability to run a single test in that file. rspec spec/controllers/proposals_controller_spec.rb:13  for

Re: [rspec-users] Order of execution of specs

2011-02-17 Thread Justin Ko
On Feb 16, 4:31 pm, LesNightingill codehac...@comcast.net wrote: ...trying to debug some interaction between my model specs, a particular spec passes by itself but fails when I run all my model specs. Whenever this happens to me, 90% of the time the cause of the problem is database state.

Re: [rspec-users] [rspec-rails] Exception catching in controller

2011-02-18 Thread Justin Ko
On Feb 17, 7:34 pm, Avdi Grimm gro...@inbox.avdi.org wrote: On Thu, Feb 17, 2011 at 11:46 AM, Justin Ko jko...@gmail.com wrote: A straight-up exception will bypass all default rescue clauses - I learn something everyday! If you will forgive a brief moment of self-promotion, I recently

Re: [rspec-users] What are all available config options?

2011-02-20 Thread Justin Ko
On Feb 20, 12:54 pm, Rodrigo Alves Vieira rodrig...@gmail.com wrote: Hello everyone, what are all the configuration options available for the .rspec file? Currently I only know --colour. Thanks! Rodrigo Alves

Re: [rspec-users] rspec not loading rails files- uninitialized constant error

2011-02-20 Thread Justin Ko
On Feb 20, 5:07 pm, Samantha John li...@ruby-forum.com wrote: Additional info: Rails 3.0.3 Ruby 1.8.7 Gemfile: gem rspec-rails,        = 2.0.0.beta.10, :git = git://github.com/rspec/rspec-rails.git gem rspec,              = 2.0.0.beta.10, :git = git://github.com/rspec/rspec.git gem

Re: [rspec-users] TypeError: can't convert RSpec::Mocks::Mock to Hash

2011-02-20 Thread Justin Ko
On Feb 15, 10:25 am, Karl threadh...@gmail.com wrote: In MoneyOrdersController controller: def create   @money_order = current_user.money_orders.build(params[:money_order])   if @money_order.save     flash.now[:msg_ok] = Added money order for: #{number_to_currency(@money_order.amount)}  

Re: [rspec-users] object_instance.reload and print out a message placed in the model

2011-02-21 Thread Justin Ko
On Mon, Feb 21, 2011 at 5:18 AM, Daniel Salmeron Amselem daniel.amse...@gmail.com wrote: I'm trying to test this with Ruby 1.9.2, RSpec 2.5.0, and Rails 3.0.4: context toggle_resource method do it should remove the resource from the group do group = Factory(:unique_group)

Re: [rspec-users] object_instance.reload and print out a message placed in the model

2011-02-22 Thread Justin Ko
better the way ARel works. On Tue, Feb 22, 2011 at 2:25 AM, Justin Ko jko...@gmail.com wrote: On Mon, Feb 21, 2011 at 5:18 AM, Daniel Salmeron Amselem daniel.amse...@gmail.com wrote: I'm trying to test this with Ruby 1.9.2, RSpec 2.5.0, and Rails 3.0.4: context toggle_resource

Re: [rspec-users] Rspec2 for rails 2.3.8?

2011-02-25 Thread Justin Ko
On Fri, Feb 25, 2011 at 2:30 PM, Radhesh Kamath li...@ruby-forum.comwrote: Hi experts, I picked up a copy of the rspec book and wrote some tests in spec/lib and spec/models for my Rails 2.3.8 code. I was using rspec 2.5.1, rspec-core 2.5.0, rspec-expectations 2.5.0 et. al. But I realised

Re: [rspec-users] unless filter

2011-03-11 Thread Justin Ko
On Thu, Mar 10, 2011 at 2:32 AM, Shamaoke shama...@hotmail.com wrote: Hi. Why doesn't the following filter work? ~~~ # encoding: utf-8 # ./example_spec.rb RSpec.configure do |config| config.filter = { unless: :condition_acceptable } end describe 'some code' do it 'does one',

Re: [rspec-users] Counter.should_not_receive(:message) not working?

2011-03-17 Thread Justin Ko
On Thu, Mar 17, 2011 at 2:55 PM, Pete Campbell li...@ruby-forum.com wrote: Even simpler... describe 'Show' do it 'should fail because increment is called' do Counter.should_not_receive(:increment)# Incorrectly passes get :show, :count_me = 'true' end it 'should fail because

Re: [rspec-users] Is it possible to run rspec continuously?

2011-03-22 Thread Justin Ko
On Tue, Mar 22, 2011 at 2:37 PM, Benyi Wang bewang.t...@gmail.com wrote: When I run rspec in Rails, it seems that a ruby process is created and loaded with rails components due to the statement require 'spec_helper'. This usually takes a while to run even a single spec. Does a tool for rspec

Re: [rspec-users] Testing routes with a prefix

2011-03-23 Thread Justin Ko
On Tue, Mar 22, 2011 at 6:50 PM, Radhesh Kamath li...@ruby-forum.comwrote: Hi experts, I am trying to test routing in my application, where all routes are enclosed in a namespace like so: scope 'v1' do resource :blah end collection do something end end end Is there a

Re: [rspec-users] RSPEC how to post to a controller? What's wrong with this?

2011-03-23 Thread Justin Ko
On Sat, Mar 19, 2011 at 2:32 PM, Mobyye bhellm...@gmail.com wrote: I'm trying to post to my controller in RSPEC by doing: it should store create an IncomingMail record do lambda { post :create, :from = 'xx', :to = 'xx', :cc = 'xx',

Re: [rspec-users] Testing routes with a prefix

2011-03-23 Thread Justin Ko
On Wed, Mar 23, 2011 at 10:16 AM, Radhesh Kamath li...@ruby-forum.comwrote: Justin Ko wrote in post #988825: On Tue, Mar 22, 2011 at 6:50 PM, Radhesh Kamath li...@ruby-forum.comwrote: end rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users You're

Re: [rspec-users] stubbing mongoid::criteria in view code

2011-03-24 Thread Justin Ko
On Thu, Mar 24, 2011 at 10:22 AM, amkirwan amkir...@gmail.com wrote: I'm try to stub the following in my view code but keep running into problems with unexpected messages. I've tried stubbing and mocking in many combinations but can't find away past this. Here is the code below I am trying to

Re: [rspec-users] calbacks on models

2011-03-26 Thread Justin Ko
On Mar 26, 2011, at 12:36 PM, Huw Nichols huw.nich...@gmail.com wrote: Hi, Just been looking for answers to this very question: I have a User model (using devise) and the same problem. Both the before_create and after_create callbacks fail to run from within Rspec2 I can even put

Re: [rspec-users] [HOOKS] spec_helper aware of full test suite being run? After hook to run code after running all specs?

2011-03-31 Thread Justin Ko
On Thu, Mar 31, 2011 at 11:16 AM, Peter Boling peter.bol...@gmail.comwrote: I have implemented a full solution. Had to persist the list of unused VCR cassettes to the file system. Cheers! It would be still be cool if there was an after hook on rspec, as there is on capistrano!

Re: [rspec-users] [HOOKS] spec_helper aware of full test suite being run? After hook to run code after running all specs?

2011-04-01 Thread Justin Ko
On Fri, Apr 1, 2011 at 8:34 AM, Peter Boling peter.bol...@gmail.com wrote: The before and after :suite hooks work for running code before and after rspec runs all the tests specified, but I need it to explicitly *not run* when anything less than every single spec is being run. In other words

Re: [rspec-users] Metadata raises CompatibilityError when I try to inspect it

2011-04-06 Thread Justin Ko
On Wed, Apr 6, 2011 at 12:53 AM, Shamaoke shama...@hotmail.com wrote: Hi. When I try to inspect example metadata, for some reason it raises the encoding compatibility exception. ~~~ describe RSpec::Core::Metadata do describe '#inspect' do it 'raises Encoding::CompatibilityError' do

Re: [rspec-users] added new cool matcher into my framework WatirSplash - #in

2011-04-17 Thread Justin Ko
On Sun, Apr 17, 2011 at 10:01 AM, David Chelimsky dchelim...@gmail.comwrote: On Apr 16, 2011, at 4:56 PM, Jarmo Pertman wrote: Hello! I've just added a new cool matcher #in into my framework WatirSplash and thought that this could be integrated into RSpec directly actually if there's

Re: [rspec-users] difference between validate and validate_on_create

2011-04-28 Thread Justin Ko
On Thu, Apr 28, 2011 at 2:06 PM, Sergio Ruiz li...@ruby-forum.com wrote: i just ran into a problem with some test, and i am not exactly sure why, but the difference happened when i changed my model validation from: validate :custom_validation to: validate_on_create :custom_validation

Re: [rspec-users] RSpec stub question

2011-05-17 Thread Justin Ko
On Sat, May 14, 2011 at 12:13 AM, arunsark arun.vydianat...@gmail.comwrote: Hi I am using Mongoid. In Mongoid while saving a record we typically give like in the controller @post.safely.save For a model class Post I am writing rspecs for my controller and want to mock the model. So what

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

2011-05-17 Thread Justin Ko
On Tue, May 17, 2011 at 11:18 PM, Justin Ko jko...@gmail.com wrote: On Thu, May 12, 2011 at 10:32 AM, Chris Habgood chabg...@gmail.comwrote: I have this in my admin controller: before_filter :login_required before_filter :admin_required def admin_required

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

2011-05-17 Thread Justin Ko
On Thu, May 12, 2011 at 10:32 AM, Chris Habgood chabg...@gmail.com wrote: I have this in my admin controller: before_filter :login_required before_filter :admin_required def admin_required current_user.is_admin? end ___

Re: [rspec-users] Reusing Spec's

2011-05-18 Thread Justin Ko
On Wed, May 18, 2011 at 10:23 AM, Ken Egervari ken.egerv...@gmail.comwrote: Hello, Is there any way to reuse spec definitions, perhaps through some kind of inheritance? For example, in rails, every time it generates a Spec I must tell it to 1) Include Devise::TestHelpers you can do:

Re: [rspec-users] Reusing Spec's

2011-05-18 Thread Justin Ko
look at shared state to log the user in and other things. Ken On Wed, May 18, 2011 at 4:06 PM, Justin Ko jko...@gmail.com wrote: On Wed, May 18, 2011 at 10:23 AM, Ken Egervari ken.egerv...@gmail.comwrote: Hello, Is there any way to reuse spec definitions, perhaps through some kind

Re: [rspec-users] rspec help for create user test

2011-05-19 Thread Justin Ko
On Thu, May 19, 2011 at 1:18 PM, S Ahmed sahmed1...@gmail.com wrote: My user controllers 'create' action looks like: def create @user = User.new(params[:user]) @user.user_name = params[:user][:user_name] @user.email = params[:user][:email] if @user.is_valid? @user.status

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

2011-05-24 Thread Justin Ko
On Tue, May 24, 2011 at 2:25 PM, Chris Habgood chabg...@gmail.com wrote: 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

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

2011-05-24 Thread Justin Ko
On Tue, May 24, 2011 at 6:10 PM, Chris Habgood chabg...@gmail.com wrote: It is already there. On Tue, May 24, 2011 at 19:05, Justin Ko jko...@gmail.com wrote: On Tue, May 24, 2011 at 2:25 PM, Chris Habgood chabg...@gmail.comwrote: I keep getting returned when looking for a template

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

2011-05-24 Thread Justin Ko
) response.should render_template(:edit) end end On Tue, May 24, 2011 at 19:38, Chris Habgood chabg...@gmail.com wrote: no. On Tue, May 24, 2011 at 19:21, Justin Ko jko...@gmail.com wrote: On Tue, May 24, 2011 at 6:10 PM, Chris Habgood chabg...@gmail.com wrote

Re: [rspec-users] Help to spec a rails helper method that uses content_for

2011-05-25 Thread Justin Ko
On Tue, May 24, 2011 at 10:34 PM, Paul P. li...@ruby-forum.com wrote: John, I know this is quite old, but I wanted to apply your same example in Rspec 2. I'm getting the following when I attempt to do so. application_helper.rb === module ApplicationHelper #

Re: [rspec-users] fluent chaining drying

2011-05-25 Thread Justin Ko
On Wed, May 25, 2011 at 11:20 AM, David Chelimsky dchelim...@gmail.comwrote: On May 25, 2011, at 10:07 AM, Gustavo Delfino wrote: Hello all. Thanks to subjects, custom matchers and fluent chaining I was able to greatly simplify my spec. But now I want to DRY my custom matchers. I have

Re: [rspec-users] For those using Rails with RSpec... what do you guys use for creating Factories?

2011-05-25 Thread Justin Ko
On Wed, May 25, 2011 at 1:00 PM, Ken Egervari ken.egerv...@gmail.comwrote: I am using factory_girl, and I have discovered that it is chiefly responsible for making my tests run slow. I have posted a question about this on Stack Overflow:

Re: [rspec-users] For those using Rails with RSpec... what do you guys use for creating Factories?

2011-05-25 Thread Justin Ko
so thrilled. I have not really lost anything in terms of expressiveness. Sure, I have to add a pieces of data to make render_views comply, but it's not much. It is a *very small* price to pay for this much performance gain. Ken On Wed, May 25, 2011 at 5:45 PM, Justin Ko jko...@gmail.com

Re: [rspec-users] fluent chaining drying

2011-05-25 Thread Justin Ko
to a class method? Regards, Gustavo Delfino On May 25, 2011, at 2:04 PM, Justin Ko wrote: On Wed, May 25, 2011 at 11:20 AM, David Chelimsky dchelim...@gmail.com wrote: On May 25, 2011, at 10:07 AM, Gustavo Delfino wrote: Hello all. Thanks to subjects, custom matchers and fluent chaining

Re: [rspec-users] Rspec or Test:Unit

2011-07-10 Thread Justin Ko
On Fri, Jul 8, 2011 at 2:59 AM, Chandu80 chandu.she...@gmail.com wrote: Hello All, I want to know which out of Rspec and Test:Unit is the most used in the industry for unit/integration testing and why? http://22ideastreet.com/blog/2011/06/02/the-state-of-ruby-and-testing/ As for whytry

Re: [rspec-users] rails: action helper for controller specs

2011-07-13 Thread Justin Ko
On Wed, Jul 13, 2011 at 11:06 AM, Alexander Glushkov cutal...@gmail.comwrote: Hey guys, just wrote a helper for controller specs in the rails. Link to the gist - https://gist.github.com/1080421 - to view with syntax highlight. # Helper +action+ allows you to write something like # #

Re: [rspec-users] eq or == which is the preferred idiom?

2011-07-20 Thread Justin Ko
On Wed, Jul 20, 2011 at 10:29 AM, Jed Schneider jed.schnei...@gmail.comwrote: for comparing objects properties, which notation is considered most idiomatic and best practice? Thanks, Jed Schneider ___ rspec-users mailing list

Re: [rspec-users] Adding a folder to my rspec execution path

2011-07-25 Thread Justin Ko
On Mon, Jul 25, 2011 at 8:16 AM, Pablo L. de Miranda pablolmira...@gmail.com wrote: Hi guys, I'm using RSpec with Capybara, and for that I created the spec/integration folder. But when I execute the command bundle exec rspec spec RSpec don't execute my files on integration folder. I need

Re: [rspec-users] Adding a folder to my rspec execution path

2011-07-25 Thread Justin Ko
On Mon, Jul 25, 2011 at 9:03 AM, Pablo L. de Miranda pablolmira...@gmail.com wrote: Hi Justin, I'm using RSpec 2.6.0, RSpec-Rails 2.6.1, Capybara 1.0.0 and Rails 3.0.7. Att, Pablo ___ rspec-users mailing list rspec-users@rubyforge.org

Re: [rspec-users] Adding a folder to my rspec execution path

2011-07-25 Thread Justin Ko
On Mon, Jul 25, 2011 at 9:59 AM, Pablo L. de Miranda pablolmira...@gmail.com wrote: Justin, Bellow is my directory tree for spec: |-- spec | |-- controllers | | `-- site_controller_spec.rb | |-- factories.rb | |-- fixtures | | `-- avatar.jpg | |-- helpers | | |--

Re: [rspec-users] Keeping my integration specs DRY..

2011-07-25 Thread Justin Ko
On Fri, Jul 22, 2011 at 1:50 PM, internetchris ch...@utilitygo.net wrote: Hi Group, I'm finally taking the time to implement tests in some of my old apps. I'm using Rails 2.3.5, Rspec 1.3.1, Rspec-rails 1.3.3, and capybara. Here's an example of my first test, but I'm wondering how I setup

Re: [rspec-users] Testing Routing Constraint = redirect example.com to www.example.com

2011-08-02 Thread Justin Ko
On Mon, Aug 1, 2011 at 8:29 PM, Shane Mingins e...@mingins.com wrote: Hi All With the following route constraints(:host = example.com) do match (*x) = redirect { |params, request| URI.parse(request.url).tap { |x| x.host = www.example.com }.to_s } end I am wondering

Re: [rspec-users] Best way to test tasks

2011-08-02 Thread Justin Ko
On Tue, Aug 2, 2011 at 5:52 PM, Piter Fcbk piter.f...@gmail.com wrote: You are right, I'm talking about rake task. So the idea is to make an Importer object, do the unit test for that object and then the task just calls the methods of the objects right? Thanks a lot for the help, really

Re: [rspec-users] Testing Routing Constraint = redirect example.com to www.example.com

2011-08-02 Thread Justin Ko
} end On 2 August 2011 21:37, Justin Ko jko...@gmail.com wrote: On Mon, Aug 1, 2011 at 8:29 PM, Shane Mingins e...@mingins.com wrote: Hi All With the following route constraints(:host = example.com) do match (*x) = redirect { |params, request| URI.parse(request.url

Re: [rspec-users] ControllerExampleGroup.bypass_rescue

2011-08-11 Thread Justin Ko
If you are rescuing an exception, test what the rescue does. Purposely cause the exception, then check the rescue does what it's supposed to. Sent from my iPhone On Aug 10, 2011, at 11:13 AM, Lenny Marks le...@aps.org wrote: As best I can tell, bypass_rescue from rspec-rails-1 is no longer

Re: [rspec-users] ControllerExampleGroup.bypass_rescue

2011-08-11 Thread Justin Ko
On Thu, Aug 11, 2011 at 8:40 AM, David Chelimsky dchelim...@gmail.comwrote: On Aug 11, 2011, at 7:17 AM, Justin Ko wrote: On Aug 10, 2011, at 11:13 AM, Lenny Marks le...@aps.org wrote: As best I can tell, bypass_rescue from rspec-rails-1 is no longer part of rspec-rails, ' 2'. I had been

Re: [rspec-users] stub in config.before

2011-08-14 Thread Justin Ko
On Sun, Aug 14, 2011 at 3:48 PM, John Hinnegan john.hinne...@gmail.comwrote: I was trying to stub something globally, across all tests today, and had some trouble. I tried RSpec.configure do |config| config.before(:all) do MyClass.stub(:my_method) end end seems that stub is

Re: [rspec-users] problem with rspec test, undefined method 'post'

2011-08-21 Thread Justin Ko
On Sun, Aug 21, 2011 at 1:34 PM, Michael Hickman li...@ruby-forum.comwrote: I am writing a spec to test the behavior of the mashup_controller when someone sends a query through a URL. I need to simulate the parameters contained in the URL, and i read that the post() method will do that,

Re: [rspec-users] inheriting test cases vs. mixing them in

2011-08-22 Thread Justin Ko
On Sat, Aug 20, 2011 at 7:53 PM, braver delivera...@gmail.com wrote: I've come across an interesting blog post showing how to inherit tests: http://benbiddington.wordpress.com/2010/11/06/rspec-common-base-specs/ How does it stack against the usual mixing/shared_examples_for, beautifully

Re: [rspec-users] Route is valid but not found :(

2011-08-22 Thread Justin Ko
On Mon, Aug 22, 2011 at 12:14 AM, ct9a anexi...@gmail.com wrote: Hi, guys, After reading the rspec book (dec 2010 edition), I went on to write controller specs for an application I'm porting over from rails 2.3.x to rails 3. 1) I ran 'rake routes' and got the following: parts GET

Re: [rspec-users] Route is valid but not found :(

2011-08-22 Thread Justin Ko
On Mon, Aug 22, 2011 at 9:09 PM, ct9a anexi...@gmail.com wrote: Thanks, Justin. I have the part object mocked up before each spec runs. --- Extract begins - let(:part){ mock_model('Part').as_null_object } before do

Re: [rspec-users] Route is valid but not found :(

2011-08-23 Thread Justin Ko
Sent from my iPhone On Aug 22, 2011, at 10:14 PM, ct9a anexi...@gmail.com wrote: On Aug 23, 1:55 pm, Justin Ko jko...@gmail.com wrote: On Mon, Aug 22, 2011 at 9:09 PM, ct9a anexi...@gmail.com wrote: Thanks, Justin. I have the part object mocked up before each spec runs

Re: [rspec-users] Route is valid but not found :(

2011-08-23 Thread Justin Ko
On Tue, Aug 23, 2011 at 6:11 AM, Gordon Yeong anexi...@gmail.com wrote: Do you have a before filter somewhere that is preventing the :update_attributes message from being received? I have checked my application's controllers (app/controllers/application_controller.rb and

Re: [rspec-users] Route is valid but not found :(

2011-08-23 Thread Justin Ko
On Tue, Aug 23, 2011 at 6:22 AM, Gordon Yeong anexi...@gmail.com wrote: I found out why it was not working. The line, 'Part.should_receive(:update_attributes).with('title' = 'Brake pads').and_return(part)' should not be there because the controller specs should not care about implementation

Re: [rspec-users] Tests that require a logged in user / session cookie

2011-08-24 Thread Justin Ko
On Wed, Aug 24, 2011 at 6:40 PM, Matthias Siegel matthiassie...@gmail.comwrote: Hi, I'm fairly new to RSpec with Rails and I'm trying to work out how I can write request specs for resources that require a logged in user. I can't get this one to pass: describe GET /admin/account do it

Re: [rspec-users] Tests that require a logged in user / session cookie

2011-08-25 Thread Justin Ko
On Thu, Aug 25, 2011 at 7:38 AM, Matthias Siegel matthiassie...@gmail.comwrote: On 25/08/2011, at 11:10 AM, Justin Ko wrote: On Wed, Aug 24, 2011 at 6:40 PM, Matthias Siegel matthiassie...@gmail.com wrote: Hi, I'm fairly new to RSpec with Rails and I'm trying to work out how I can

Re: [rspec-users] Tests that require a logged in user / session cookie

2011-08-26 Thread Justin Ko
On Fri, Aug 26, 2011 at 12:12 AM, Matthias Siegel matthiassie...@gmail.comwrote: On 25/08/2011, at 11:45 PM, Justin Ko wrote: On Thu, Aug 25, 2011 at 7:38 AM, Matthias Siegel matthiassie...@gmail.com wrote: On 25/08/2011, at 11:10 AM, Justin Ko wrote: On Wed, Aug 24, 2011 at 6:40

Re: [rspec-users] rspec testing inheritance

2011-09-06 Thread Justin Ko
On Tue, Sep 6, 2011 at 9:40 PM, slavix mikerin.sl...@gmail.com wrote: Hello, Is there any way to test model inheritance in spec? something like.. it { ChildModel.should ParentModel } thanks. ___ rspec-users mailing list

Re: [rspec-users] Warning (but not failing) if a method wasn't called?

2011-09-07 Thread Justin Ko
On Wed, Sep 7, 2011 at 6:08 AM, John Feminella jo...@bitsbuilder.comwrote: Is there a way to warn but not fail if a particular method wasn't called? That is, I'm looking for something that's halfway between obj.stub(...) and obj.should_receive(...). I'm trying to do something like this:

Re: [rspec-users] Is there a way to get an around hook for each spec file?

2011-09-07 Thread Justin Ko
On Wed, Sep 7, 2011 at 5:50 AM, John Feminella jo...@bitsbuilder.comwrote: Is there a way to run an `around` block once for every spec *file* (not spec)? (I want to measure which files take the longest amount of time, count the number of specs in each file, and then report the average spec

Re: [rspec-users] rspec and testing IO

2011-09-08 Thread Justin Ko
On Thu, Sep 8, 2011 at 3:03 PM, Justin Beck justinb...@mac.com wrote: I have a class that expects some input via 'gets'. I found that, when testing, I can do something as simple as this: @foo.stub!(:gets) { stuff\n } However that only works in the most simple case. In my case the class

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-13 Thread Justin Ko
On Tue, Sep 13, 2011 at 6:56 AM, Matt Wynne m...@mattwynne.net wrote: Hi all, In GOOS[1] they use an assertion called assertEventually which samples the system for a success state until a certain timeout has elapsed. This allows you to synchronise the tests with asynchronous code. Do we

Re: [rspec-users] rspec and should have_many through

2011-09-13 Thread Justin Ko
On Tue, Sep 13, 2011 at 8:53 PM, slavix mikerin.sl...@gmail.com wrote: Hi, Anyone can help me with rspec shoulda validations please. I can't get the syntax right for these validations. Please correct me it { should have_one :tradable, :through = :trade_order} it { should belong_to

Re: [rspec-users] Mocking expectations on I/O operations

2011-09-14 Thread Justin Ko
On Wed, Sep 14, 2011 at 6:51 AM, Rob Aldred r...@stardotstar.com wrote: I'm speccing a small lib which manipulates image files using mini_magick. The lib creates various temporary files during the process, the lib then cleans up the temporary files at the end. I'm trying to mock expectations

  1   2   >