Re: [rspec-users] Unable to Run 'bundle exec cucumber'

2012-07-23 Thread Justin Ko
On Jul 23, 2012, at 10:32 AM, Ja Tse wrote: > Hi, > > I have a cucumber problem that is preventing me from running all my > feature files, anyone has come across to this problem ? > > On Windows with. > > cucumber (1.2.1, 0.9.4) > > Command: bundle exec cucumber > > C:/Ruby187/lib/ruby/gems

Re: [rspec-users] RSpec/rails & Capybara: #within

2012-07-23 Thread Justin Ko
On Jul 22, 2012, at 3:08 PM, Salvatore Pelligra wrote: > I'm new with Capybara and after a good amount of google, I still can't > figure out how the #within methods works! > I can use it only if I call visit before? There's no way to use it on a > string, like the `page = Capybara.string(html_str

Re: [rspec-users] How do I specify login with controller spec with rspec-rails?

2012-07-18 Thread Justin Ko
On Jul 18, 2012, at 9:30 AM, femto Zheng wrote: > yes, using devise. > > On Wed, Jul 18, 2012 at 11:21 PM, Justin Ko wrote: > > On Jul 18, 2012, at 4:42 AM, femto Zheng wrote: > >> Hello all, I'm new to rspec-rails, >> looking at rspec-rails's docume

Re: [rspec-users] How do I specify login with controller spec with rspec-rails?

2012-07-18 Thread Justin Ko
On Jul 18, 2012, at 4:42 AM, femto Zheng wrote: > Hello all, I'm new to rspec-rails, > looking at rspec-rails's documentation is a bit confusing, > I have an application, > where users needs to login to use, > so how do I specify login with controller spec with rspec-rails? > > like a config.(:b

Re: [rspec-users] describe, context, feature, scenario

2012-07-16 Thread Justin Ko
On Jul 15, 2012, at 7:28 PM, Mike Glaz wrote: > Describe, context, feature, scenario: what is the difference between the > four and when do I use each one? > > thanks, > mike > > -- > Posted via http://www.ruby-forum.com/. > ___ > rspec-users mailing

Re: [rspec-users] File not found

2012-06-21 Thread Justin Ko
On Jun 21, 2012, at 11:12 AM, n/a n/a wrote: > I've been trying to learn RSpec using the book The RSpec Book by David > Chelimsky but I've been having a problem in Chapter 5 around page 50. I > tried running "rspec spec/codebreaker/game_spec.rb --format doc" but it > said that codebreaker could n

Re: [rspec-users] Mock UploadedFile object in controller params

2012-06-21 Thread Justin Ko
On Jun 20, 2012, at 4:18 AM, David Piegza wrote: > Hi, > > I'm trying to mock an UploadedFile object and pass it to a controller action. > Unfortunately, the mocked object gets stringified in the params hash, so I'm > not able to use the mock object in a test. > > Is there any way to avoid th

Re: [rspec-users] Selenium+Autotest: how to run browser in background?

2012-06-18 Thread Justin Ko
On Jun 14, 2012, at 12:11 PM, Joshua Muheim wrote: > Hey guys > > After hours of hard work I finally managed to set up my development > environment to run cucumber scenarios using autotest and selenium. > > What's a bit bugging is the fact that Firefox always jumps to the > foreground when Auto

Re: [rspec-users] 2 almost identical tests need different assertions to work and I can't figure out why

2012-06-18 Thread Justin Ko
On Jun 16, 2012, at 3:38 PM, Tyrel R. wrote: > Hey everyone, I am learning bdd and do deffently like it on the whole. I > ran into a strange situation I got around it but it left a question in > my mind and I would appreciate help in removing it ;) > > So hear is what happened > > test for one

Re: [rspec-users] response.should have_content("1 movie") does not seem to work for me

2012-06-15 Thread Justin Ko
On Jun 14, 2012, at 1:40 AM, Joshua Muheim wrote: > Hey everybody > > I have worked quite to near the end of The RSpec Book, but now I'm > having some troubles. > > I'm trying to get the last few Cucumber steps to work, which are: > > Then /^Caddyshack should be in the Comedy genre$/ do > vis

Re: [rspec-users] RSpec testing update action with ajax

2012-05-30 Thread Justin Ko
On May 30, 2012, at 3:18 AM, zombiebit wrote: > Hey, > I want to test my Rails app. When you click the image ajax sends to data to > DB and the data is updated in there. When I try to test, I faced with this > problem, > > > 1) RwsController Update widget score takes widget rate information >

Re: [rspec-users] shared examples with a block for expects?

2012-05-23 Thread Justin Ko
On May 23, 2012, at 6:12 PM, Patrick J. Collins wrote: > Hi, > > Basically I want to do something like this: > > describe FancyThingsController do > > def do_new >get :new > end > > def do_create >post :create, :fancy_thing => { :some => "params" } > end > > shared_examples "an

Re: [rspec-users] received unexpected message :id= with (20)

2012-05-23 Thread Justin Ko
On May 23, 2012, at 4:27 PM, Kleber Shimabuku wrote: > Please help me to understand this error message: > > 1) PostsController#create when logged in should create a new post and > redirect to a successful message page > Failure/Error: post 'create', { post: {title: 'New post', > Mock P

Re: [rspec-users] bug: rspec rails generator generates a failing spec

2012-05-19 Thread Justin Ko
On May 19, 2012, at 11:46 AM, survivorist wrote: > What was the specific issue with this and how did you resolve it, I'm having > the exact same error and can't find the root of the issue? Thanks > > -- > View this message in context: > http://ruby.11.n6.nabble.com/bug-rspec-rails-generator-ge

Re: [rspec-users] how can I do an "or" within the context of a matcher?

2012-05-15 Thread Justin Ko
On May 15, 2012, at 12:47 AM, Patrick J. Collins wrote: > Capybara has two methods: > > page.has_button? > > and > > page.has_link? > > ... I am wondering, how can I make a helper method that will be > satisfied by one or the other? In other words, I want to be able to do: > > page.should

Re: [rspec-users] Access controller object in controller macro

2012-04-18 Thread Justin Ko
On Apr 17, 2012, at 1:30 PM, Nasir Jamal wrote: > > Hi > > We have just upgraded our Rails 2.3.11 app to Rails 3.0.0 and Rspec 1.3.2 to > 2.6. We are having two problems with rspec currently and any help would be > great. > > 1) We have some controller macros where we have been using the con

Re: [rspec-users] SOAP / VCR / General Advice

2012-04-15 Thread Justin Ko
Sent from my iPhone On Apr 15, 2012, at 4:04 PM, Michael Guterl wrote: > On Fri, Apr 13, 2012 at 2:24 AM, Justin Ko wrote: >> >> On Apr 11, 2012, at 7:08 AM, Michael Guterl wrote: >> >>> I'm building a ruby wrapper for a SOAP service using savon and I&

Re: [rspec-users] Rspec with Nested Resources

2012-04-13 Thread Justin Ko
On Apr 12, 2012, at 11:32 AM, Arnaldo Junior wrote: > Hi, I have problems to implement the tests with RSpec with nested > routes in views, as I implement these tests? > Always gives error that it can not find the routes. > > #config/routes.rb > > resources :controller1 do >resources :contro

Re: [rspec-users] SOAP / VCR / General Advice

2012-04-12 Thread Justin Ko
On Apr 11, 2012, at 7:08 AM, Michael Guterl wrote: > I'm building a ruby wrapper for a SOAP service using savon and I'm > running into some issues with testing and I would love some feedback. > I have added some tests with the help of VCR, but unfortunately that > doesn't feel right given some of

Re: [rspec-users] Argument Non-Matchers

2012-04-10 Thread Justin Ko
On Apr 9, 2012, at 2:41 PM, Matt Hauck wrote: > Is there a way to specify a message expectation on an object to occur > _without_ a particular argument? > > There is a particular function, which in some special circumstance takes a > unique argument, but in normal circumstances does not take t

Re: [rspec-users] i've been in activeadmin hell...

2012-04-06 Thread Justin Ko
On Apr 6, 2012, at 1:40 PM, Patrick J. Collins wrote: >> On Apr 6, 2012, at 11:21 AM, Patrick J. Collins wrote: >>> ... Changing the filename app/admin/users.rb to app/admin/wtfs.rb >>> >>> makes this error go away... so--- wtfs indeed! > > On Fri, 6 A

Re: [rspec-users] i've been in activeadmin hell...

2012-04-06 Thread Justin Ko
On Apr 6, 2012, at 11:21 AM, Patrick J. Collins wrote: > I am working on a project that uses active_admin, and I found once > building out all of the admin resource files, running rspec causes the > following error: > > /Users/patrick/.rvm/gems/ruby-1.9.3-p125@foobar/gems/activesupport-3.2.2/lib

Re: [rspec-users] Stub conflict?

2012-04-06 Thread Justin Ko
On Apr 5, 2012, at 6:03 PM, James wrote: > Hi, > I have two stubs in two different specs (one model, one controller). > For some reason they are causing some strange conflict with one > another. > If I comment out the controller stub, the model spec passes. > > Controller Spec >

Re: [rspec-users] Stub conflict?

2012-04-06 Thread Justin Ko
On Apr 5, 2012, at 6:03 PM, James wrote: > Hi, > I have two stubs in two different specs (one model, one controller). > For some reason they are causing some strange conflict with one > another. It's not strange at all. Your child classes will inherit the stubs of the parent class. > If I comm

Re: [rspec-users] isolating controller tests from models

2012-03-31 Thread Justin Ko
Sent from my iPhone On Mar 31, 2012, at 5:50 AM, David Chelimsky wrote: > On Sat, Mar 31, 2012 at 2:49 AM, Justin Ko wrote: >> >> On Mar 30, 2012, at 11:11 PM, Fearless Fool wrote: >> >>> This is a rehash of a question I posed at: >>> http://stacko

Re: [rspec-users] isolating controller tests from models

2012-03-30 Thread Justin Ko
On Mar 30, 2012, at 11:11 PM, Fearless Fool wrote: > This is a rehash of a question I posed at: > http://stackoverflow.com/questions/9952317/isolating-controller-tests-from-models > The basic question: If I have a FoosController and a Foo model, can I > run FoosController rspec tests without crea

Re: [rspec-users] validating if a cell has any of the options.

2012-03-30 Thread Justin Ko
On Mar 30, 2012, at 10:52 AM, Hillary Hueter wrote: > > The example as it exists today: >it "should show all applications" do > I.new do |c| > c.login_flow(:userid => $support, :password => $password) ## Logs in > c.manage_application_page.filter.when_present.flash >

Re: [rspec-users] Asserting on a yield

2012-03-17 Thread Justin Ko
On Mar 17, 2012, at 3:51 PM, Myron Marston wrote: > I've been thinking about this a bit ever since Zach Dennis brought up > the issue on another rspec-expectations ticket [1]. I've come up with > a proof-of-concept matcher that works pretty well, I think [2]. > Here's how you use it: > > expect

Re: [rspec-users] RSpec & JRuby

2012-03-14 Thread Justin Ko
On Mar 14, 2012, at 1:15 AM, Srushti Ambekallu wrote: > We're working on a project with a bunch of padrino services running on JRuby > 1.6.5. Currently, the tests are written Test::Unit, but we want to move to > writing specs. We tried rspec but that seemed to fail, until we looked closer > an

Re: [rspec-users] color option

2012-03-07 Thread Justin Ko
On Feb 27, 2012, at 10:58 AM, jed schneider wrote: > we are on rspec 2.6.4 and for awhile my color flag seems to be ignored when > running specs in my .rspec file but my formatting option is picking up. Did > the --color flag get changed? > > my .rspec file > --color > -f d > > thanks! > >

Re: [rspec-users] syntax for custom messages

2012-03-05 Thread Justin Ko
On Mar 5, 2012, at 1:18 AM, ruud144 wrote: > hi group, > > I read that expectations can print a custom message on failure using a > syntax like > > cars.should be_empty, "Cars left" This is because RSpec predicate matchers can accept a block: https://github.com/rspec/rspec-expectations/blob/ma

Re: [rspec-users] what RSpec approach could I use for this.

2012-03-05 Thread Justin Ko
On Mar 5, 2012, at 5:05 AM, Andrew Premdas wrote: > > On 3 March 2012 21:55, Greg C. wrote: > Background: So I have roughly: > > class A > def calculate_input_datetimes > # do stuff to calculate datetimes - then for each one identified > process_datetimes(my_datetime_start, my_dat

Re: [rspec-users] mimicking a logged in user

2012-03-03 Thread Justin Ko
On Mar 3, 2012, at 12:35 PM, S Ahmed wrote: > I'm testing my controller, and confirming that a logged-in user can view the > page. > > I have a session_helper that does this: > > def signed_in? > !current_user.nil? > end > > And the current_user is set with: > > def user_from_remember_to

Re: [rspec-users] what RSpec approach could I use for this.

2012-03-03 Thread Justin Ko
On Mar 3, 2012, at 2:55 PM, Greg C. wrote: > Background: So I have roughly: > > class A > def calculate_input_datetimes > # do stuff to calculate datetimes - then for each one identified > process_datetimes(my_datetime_start, my_datetime_end) > end > > def process_datetimes(inp

Re: [rspec-users] Can anyone tell me why this test is failing?

2012-02-29 Thread Justin Ko
estart my > terminal more often! > > On Wednesday, February 29, 2012 6:18:10 AM UTC-3, Justin Ko wrote: > > On Feb 28, 2012, at 9:43 PM, Mohamad El-Husseini wrote: > > I ran this scenario in the console and it works as expected. But RSpec > > keeps failing the test and I can

Re: [rspec-users] Can anyone tell me why this test is failing?

2012-02-29 Thread Justin Ko
On Feb 28, 2012, at 9:43 PM, Mohamad El-Husseini wrote: > I ran this scenario in the console and it works as expected. But RSpec keeps > failing the test and I can't understand why. > > describe User do > > before do > @user = User.new(name: "Mickey Mouse", email: "mic...@disney.com", >

Re: [rspec-users] Can someone clarify this RSpec block?

2012-02-23 Thread Justin Ko
On Feb 23, 2012, at 4:38 PM, Mohamad El-Husseini wrote: > I'm new to RSpec, Rails, and Ruby. I'm following the Rails Tutorial. I was > going over some RSpec code and go wanted some clarification: > > describe "User pages" do > subject { page } > > describe "sign up" do > describe "

Re: [rspec-users] Testing Signin for Admin_Employee

2012-02-23 Thread Justin Ko
On Feb 23, 2012, at 9:32 AM, Tom Tom wrote: > I am following railstutorial 2nd edition and in it we have a Signin test > in our integration tests as follows: > > require 'spec_helper' > > describe "Authentication" do > >subject { page } > > describe "signin" do > before { visi

Re: [rspec-users] should_receive_chain

2012-02-22 Thread Justin Ko
On Feb 22, 2012, at 9:00 AM, Matt Wynne wrote: > > On 22 Feb 2012, at 15:41, David Chelimsky wrote: > >> On Tue, Feb 21, 2012 at 2:48 PM, Mike Pack wrote: >>> Yup, I find myself doing this all the time. I think it should be considered >>> that too deep of a stub chain could be a sign of poor >

[rspec-users] should_receive_chain

2012-02-21 Thread Justin Ko
Do you often find yourself doing this: active = double('active') active.should_receive(:first) users = double('users', active: active) account.should_receive(:users).and_return(users) for this: account.users.active.first ? Of course, we could use stub_chain, but that doesn't let us know *where

Re: [rspec-users] Such a simple test fails. But why ?

2012-02-15 Thread Justin Ko
On Feb 15, 2012, at 9:57 AM, Serguei Cambour wrote: > I just tried to integrate a simple test to check some options passed as > argument to a class to be executed: > [code] > require 'spec_helper' > > module PropertyInjector > describe Options do >describe "#source folder option" do >

Re: [rspec-users] stale records with integration testing?

2012-02-14 Thread Justin Ko
On Feb 14, 2012, at 9:23 AM, David Chelimsky wrote: > On Tue, Feb 14, 2012 at 9:28 AM, Justin Ko wrote: >> >> On Feb 13, 2012, at 10:35 PM, David Chelimsky wrote: >> >>> On Mon, Feb 13, 2012 at 9:04 PM, Justin Ko wrote: >>>> >>>>

Re: [rspec-users] Formatting Pending/Failures Output

2012-02-14 Thread Justin Ko
On Feb 14, 2012, at 9:57 AM, John Chow wrote: > Hey Everyone, > > Quick question: is there a way to format the example text such that it's in > nested format (much like the option rspec -cfn)? It's visually easier for me > to read and comprehend the failures and pending examples. I think "rsp

Re: [rspec-users] stale records with integration testing?

2012-02-14 Thread Justin Ko
On Feb 13, 2012, at 10:35 PM, David Chelimsky wrote: > On Mon, Feb 13, 2012 at 9:04 PM, Justin Ko wrote: >> >> On Feb 13, 2012, at 1:16 PM, Patrick J. Collins wrote: >> >>> Hi, >>> >>> I was writing an integration test for my user signup form

Re: [rspec-users] Should I use cucumber or Controller RSpecs or both?

2012-02-13 Thread Justin Ko
On Feb 13, 2012, at 3:46 PM, Cathal Curtis wrote: > Hi All, > > I'd like to get some other's opinions on testing controllers. > > Say I have a model and I want to prevent deletion of instances of it. > The controllers's destroy action simply redirects to an error page - > nothing else. > Lets a

Re: [rspec-users] stale records with integration testing?

2012-02-13 Thread Justin Ko
On Feb 13, 2012, at 1:16 PM, Patrick J. Collins wrote: > Hi, > > I was writing an integration test for my user signup form (with > capybara), and found that my test was failing due to a validation error: > "email is already taken". I'm a bit confused because I thought when I > run "rspec spec/s

Re: [rspec-users] Autorun Picks Up Options

2012-02-10 Thread Justin Ko
On Feb 9, 2012, at 1:42 PM, Bryan Baugher wrote: > Hi, > > I was trying to use the autorun feature of rspec but noticed that when I run > the command to kick off the ruby scripts it picks up the options that I give > to the command. > > 'myRubyBin -j optionValue' > > This then fails with thi

Re: [rspec-users] nested route not receiving :id parameter within controller spec

2012-02-06 Thread Justin Ko
On Feb 6, 2012, at 6:45 PM, Patrick J. Collins wrote: > I've got a share method in my controller, and I have the following spec: > > describe PostsController do > >describe "#share" do > > it "doesn't blow up" do >post :share, :id => @post.id Does @post actually have an id?

Re: [rspec-users] rails memoize and reload class => error raised

2012-02-03 Thread Justin Ko
On Feb 3, 2012, at 3:29 PM, apneadiving wrote: > Hi, > > That's a bit off topic but since I use Spork + Rspec... > > Well, my classes are reloaded between each test wave so Rails' > "memoize" method raises an error (which is expected, see code: > http://rubydoc.info/docs/rails/3.0.0/ActiveSuppo

Re: [rspec-users] Game development: how to test interactions like an attack?

2012-02-02 Thread Justin Ko
On Feb 2, 2012, at 2:20 AM, Romain Tribes wrote: > Hello, > > I'm writing webgames with Rails and I want to test my code (and even TDD) but > I'm really stuck figuring what to test. > I read a lot of articles on the subject but I still don't know what to do in > my case: how to start? > > For

Re: [rspec-users] getting ActionController::RoutingError when I test namespaced controllers

2012-02-01 Thread Justin Ko
On Feb 1, 2012, at 6:26 PM, Lille wrote: > Hey folks, > > Using 2.6, I have functional tests arranged in my spec/controllers > directory according to their namespace in my Rails 3 app/controllers > directory, e.g., > > api/some_controller_spec.rb > > describe Api::SomeController, ... > > We

Re: [rspec-users] What is the pattern for testing a time argument using argument matcher

2012-01-26 Thread Justin Ko
On Jan 26, 2012, at 8:44 AM, Yi Wen wrote: > Say I do: > > ```ruby > object.method 5.days.ago > ``` > > In the test I want to test using should_receive like: > > ```ruby > object.should_receive(:method).with(5.days.ago) > ``` > > This will fail since two time objects aren't exact the same. >

Re: [rspec-users] id getting overwritten with 0 when testing

2012-01-25 Thread Justin Ko
On Jan 25, 2012, at 6:20 PM, Guyren Howe wrote: > On Jan 25, 2012, at 4:50 PM, Guyren G Howe wrote: > >> On Jan 25, 2012, at 1:56 PM, David Chelimsky wrote: >> >>> I'd start by debugging to see where the wheels fall off. Are you >>> familiar/comfortable with Ruby's debugger? >> >> Sure. >> >>

Re: [rspec-users] id getting overwritten with 0 when testing

2012-01-25 Thread Justin Ko
On Jan 25, 2012, at 1:42 AM, Patrick J. Collins wrote: > On Wed, 25 Jan 2012, Justin Ko wrote: > >> >> http://ariejan.net/2008/08/12/ruby-on-rails-uuid-as-your-activerecord-primary-key >> >> Make sure the column is 16-byte binary >> > > And be sur

Re: [rspec-users] id getting overwritten with 0 when testing

2012-01-25 Thread Justin Ko
On Jan 25, 2012, at 12:43 AM, Guyren G Howe wrote: > > On Jan 24, 2012, at 11:27 PM, Julian Leviston wrote: > >> On 25/01/2012, at 5:24 PM, Guyren G Howe wrote: >> >>> My code that saves a record works fine in development or production, or >>> from the console. I can take the code in my test

Re: [rspec-users] does jruby rspec have to use selenium?

2012-01-16 Thread Justin Ko
On Jan 16, 2012, at 7:35 PM, S Ahmed wrote: > With jruby and rspec requests, do you have to use selenium webdriver? > > I'm confused, with ruby and rubyonrails using cucumber with capybara, I > didn't have to set the default driver, what was it using and can i use that > with jruby? Things ju

Re: [rspec-users] stub().and_raise() ain't raising?

2012-01-12 Thread Justin Ko
On Jan 12, 2012, at 5:32 PM, Fearless Fool wrote: > I have two blocks of tests: one for testing positive outcomes and one > for testing negative. After poking around, I've concluded that the > underlying :verify_credentials method is getting called, despite the > stub: > > describe 'electricit

Re: [rspec-users] where does cucumber.yml live?

2012-01-06 Thread Justin Ko
On Jan 6, 2012, at 3:49 PM, Gayle C. wrote: > David Chelimsky wrote in post #790531: >>> http://wiki.github.com/aslakhellesoy/cucumber/running-features >> >> Since ppl are having a hard time finding this, I added >> http://wiki.github.com/aslakhellesoy/cucumber/cucumberyml, which >> references >

Re: [rspec-users] Sending rails errors to rspec output

2011-12-22 Thread Justin Ko
On Dec 22, 2011, at 11:33 AM, LeeQ wrote: > Ah, I see what you are saying. But no, I still want the exception to act > like an exception. My problem is that I'll have a test fail for reasons > unknown, and I then I need to open the test logs to find the exception. I'd > like those exception

Re: [rspec-users] Sending rails errors to rspec output

2011-12-22 Thread Justin Ko
On Dec 22, 2011, at 8:25 AM, LeeQ wrote: > Puts does work. That's not what I'm looking for. > > I want all error messages (like `undefined local variable or method `junk' > for...` ) to show up in my rspec out put in the same way as `puts`. > ___ > r

Re: [rspec-users] render_template on create and update action - unexpected result with namespaced controllers

2011-12-22 Thread Justin Ko
On Dec 12, 2011, at 10:16 AM, astjohn wrote: > All, > > I've been having issues with my namespaced controllers and specs. I > receive the following errors only on my create and update actions > (with invalid parameters) and only on my namespaced controllers. My > non-namespaced controllers hav

Re: [rspec-users] Sending rails errors to rspec output

2011-12-21 Thread Justin Ko
On Dec 16, 2011, at 8:46 AM, LeeQ wrote: > I am using Capybara in combination with rspec for integration testing > of rails apps. Even though you are using Capybara, they are still just specs. No reason why "puts" won't work. > > I would like any errors (routing errors, errors in a controller

Re: [rspec-users] How to extend common helper methods to view specs?

2011-12-05 Thread Justin Ko
On Dec 5, 2011, at 3:53 PM, Gordon wrote: > Hi, there, > > I have some methods which I have written as helpers. > They are in spec/support/controller_macros.rb (yes, I will change the > name soon). > > The 2 methods, login_user and login_admin_user works in the > controller specs BUT fail to wo

Re: [rspec-users] oddness with messages_path

2011-11-26 Thread Justin Ko
On Nov 26, 2011, at 8:03 PM, Cynthia Kiser wrote: > Quoting Patrick J. Collins : >>> I can work around it by constructing the url myself with >>> "/messages/#{message.id}" but I am curious where the period is coming >>> from in the constructed url. >> >> It's because you should be using a singu

Re: [rspec-users] Rails code reloading in RSpec test environment?

2011-11-22 Thread Justin Ko
On Nov 22, 2011, at 4:52 PM, Andrew Premdas wrote: > On 22 November 2011 20:31, Ash Moran wrote: >> Hi >> >> I've worked on a couple of Rails 3 apps recently and the test feedback loop >> is killing me. With no modifications, it takes 15-25 seconds to run a single >> example. I've avoided Spo

Re: [rspec-users] testing a post to a controller's create action

2011-11-20 Thread Justin Ko
On Nov 19, 2011, at 11:14 PM, Patrick J. Collins wrote: >> Please post the backtrace. > > Failures: > > 1) PostsController#store_post_params stores the last post params in the > session > Failure/Error: post :create, { :submit_action => submit_type.to_s, :post > => { :foo => "bar" } } >

Re: [rspec-users] testing a post to a controller's create action

2011-11-19 Thread Justin Ko
On Nov 19, 2011, at 4:03 PM, Patrick J. Collins wrote: >> #store_params is not an "action", therefore I would make it private. > > I agree completely, and probably should have specified that in my sample code > (it certainly is private in my real non-hypothetical implementation). > >> Since it

Re: [rspec-users] testing a post to a controller's create action

2011-11-19 Thread Justin Ko
On Nov 19, 2011, at 9:57 AM, Patrick J. Collins wrote: >>> I never see the debugger prompt.. Can anyone PLEASE tell me why this is not >>> working? In any other test, binding.pry or debugger interrupts the test >>> flow >>> and gives me access to the current scope of the debugger call. >> >>

Re: [rspec-users] Testing Custom Methods

2011-11-15 Thread Justin Ko
Tony, this text right here is considered "top posting" because it is *above* the previous posts. Now, scroll down and you'll see my "bottom post". On Nov 13, 2011, at 11:03 PM, Tony Spore wrote: > Thanks David. > I am getting a long way now. > -Thanks, > Tony Spore > CEO > SaasSoft LLC > (805)

Re: [rspec-users] Setting expections on chained calls

2011-11-08 Thread Justin Ko
On Nov 8, 2011, at 3:29 AM, Rob Aldred wrote: > On Tue, Nov 08, 2011 at 12:36:22AM +0000, Justin Ko wrote: >> >> On Nov 7, 2011, at 4:13 PM, Matt Wynne wrote: >> >>> >>> On 7 Nov 2011, at 18:37, Justin Ko wrote: >>> >>>> On Nov 2,

Re: [rspec-users] Setting expections on chained calls

2011-11-07 Thread Justin Ko
On Nov 7, 2011, at 4:13 PM, Matt Wynne wrote: > > On 7 Nov 2011, at 18:37, Justin Ko wrote: > >> On Nov 2, 2011, at 12:01 PM, Rob Aldred wrote: >> >>> >>> I'm pretty sure this has probably been discussed before. >>> I'm using couchd

Re: [rspec-users] Setting expections on chained calls

2011-11-07 Thread Justin Ko
On Nov 2, 2011, at 12:01 PM, Rob Aldred wrote: > > I'm pretty sure this has probably been discussed before. > I'm using couchdb (couchrest_model) > > When speccing my controller i want to set expectations that im calling my > couch views correctly. > The query interface has recently been update

Re: [rspec-users] Noob (mock/stub) ActiveMerchant..

2011-10-31 Thread Justin Ko
On Oct 28, 2011, at 10:16 AM, internetchris wrote: > Hi Group > > I'm still waiting for the light to come on with stubbing/mocking and > the syntax for each. I have simple method in my Order class like > so > > def credit_card >ActiveMerchant::Billing::CreditCard.new( > :type

Re: [rspec-users] Database custom formatter

2011-10-21 Thread Justin Ko
On Oct 18, 2011, at 9:03 AM, Bill Christian wrote: > I am trying to write a custom formatter to update a database record based on > example results. Having a lot of trouble, so I thought to ask if anyone has a > custom formatter that writes results to a database or outputs results in JSON > or

Re: [rspec-users] Ignoring certain files?

2011-10-16 Thread Justin Ko
On Oct 16, 2011, at 3:47 AM, Marten Veldthuis wrote: > Hey guys, > > Is there any way I can get rspec to ignore all files in spec/fixtures when it > does a recursive search for all spec/**/*_spec.rb files? > > The problem I'm facing is that the fixtures for my code are project > structures on

Re: [rspec-users] How do we include support helpers in request specs?

2011-10-14 Thread Justin Ko
On Oct 13, 2011, at 10:40 PM, Gordon wrote: > Hi, all :) > > I have some working support helpers defined in spec/support/ > controller_macros.rb. > > I'm running "rake spec" before a 'git commit' and observed that the > spec request for my 'brands' controller, > spec/requests/brands_spec.rb fai

Re: [rspec-users] running rspec causes errror => no such file to load -- rspec/rails

2011-10-13 Thread Justin Ko
On Oct 13, 2011, at 9:43 PM, slavix wrote: > strange install related problems in my rails 3.1 app > gemfile > group :test, :development do > .. > gem "rspec" > gem "rspec-rails" > gem 'rspec-rails-ext' > gem 'rspec-rails-matchers' > .. > end > >>> bundle show rspec-rails > /home/slava/.rvm/

Re: [rspec-users] Helper methods can't be called within before hooks. Help, please.

2011-10-13 Thread Justin Ko
On Oct 13, 2011, at 8:59 PM, Gordon wrote: > > > Hi, there, > > > I believe I have some problem with scoping. > > I have a controller spec file which tests a brands resource. > At the start of the file, I test the resource's access for different > users in a context block > a) not signed in

Re: [rspec-users] Scope problems for before hooks using helper methods?

2011-10-13 Thread Justin Ko
On Oct 13, 2011, at 7:35 PM, Gordon wrote: > > > Hi, there, > > > I believe I have some problem with scoping. > > I have a controller spec file which tests a brands resource. > At the start of the file, I test the resource's access for different > users in a context block > a) not signed in

Re: [rspec-users] Override tests (of a core rails app from a plugin)

2011-10-01 Thread Justin Ko
On Oct 1, 2011, at 7:03 AM, Felix Schäfer wrote: > Hello, > > Is there some way to override a spec and more specifically parts of spec, > ideally down to a specific example? I've been looking and googling for > something like this, but I haven't found a good strategy for it. > > The use-case

Re: [rspec-users] Access to asset_path helper in a Rails 3.1 application request spec

2011-09-25 Thread Justin Ko
On Sep 15, 2011, at 3:08 AM, Silumesii Maboshe wrote: > Hello! > > I am learning to use RSpec for testing Rails 3.1 applications - really > enjoying using it so far. > In testing for the presence of assets (e.g rails.png), I've been using: > > get "/assets/rails.png" > response.status.shou

Re: [rspec-users] shared examples in test unit?

2011-09-25 Thread Justin Ko
On Sep 16, 2011, at 4:40 AM, Joaquin Rivera Padron wrote: > hi, > at work we use TestUnit, and I miss there a lot the shared_examples from > RSpec, do you know if is there something alike for TestUnit? > > I know this might be a bit OT but I thought you probably might know :-) > > tia, > joaqui

Re: [rspec-users] How to stub ApplicationController method in request spec

2011-09-25 Thread Justin Ko
On Sep 16, 2011, at 12:33 PM, mattf wrote: > Hey there, > > I am needing to stub a 'current_user' method in an Rspec/capybara > request spec. The method is defined in ApplicationController and is > using helper_method. The method should simply return a user id. > > Alternatively, I could fix my

Re: [rspec-users] using rspec to verify an xpath (via capybara/cucumber)

2011-09-20 Thread Justin Ko
"have_[xpath]" is a custom matcher in Capybara. So, the answer would be no. https://github.com/jnicklas/capybara/blob/master/lib/capybara/rspec/matchers.rb On Sep 20, 2011, at 3:45 PM, Patrick J. Collins wrote: > I am doing: > > page.should have_xpath("//img[contains(@class, 'foobar')]",

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

2011-09-15 Thread Justin Ko
nfidence and are intended solely for the use of the individual or > entity to whom they are addressed. If you have received this email > in error please notify the system manager at i...@stardotstar.com > > On Thursday, 15 September 2011 at 01:52, Justin Ko wrote: > > >

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 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 that the calls

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 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 :source, :polymor

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-13 Thread Justin Ko
On Tue, Sep 13, 2011 at 6:56 AM, Matt Wynne 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 have an equiva

Re: [rspec-users] rspec and testing IO

2011-09-08 Thread Justin Ko
On Thu, Sep 8, 2011 at 3:03 PM, Justin Beck 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 asks > a seri

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 wrote: > 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 running time for tha

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 wrote: > 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: > > shared_context "wit

Re: [rspec-users] rspec testing inheritance

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

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 wrote: > > On 25/08/2011, at 11:45 PM, Justin Ko wrote: > > > > On Thu, Aug 25, 2011 at 7:38 AM, Matthias Siegel > wrote: > >> >> On 25/08/2011, at 11:10 AM, Justin Ko wrote: >> >> >&g

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 wrote: > > On 25/08/2011, at 11:10 AM, Justin Ko wrote: > > > > On Wed, Aug 24, 2011 at 6:40 PM, Matthias Siegel > wrote: > >> Hi, >> >> I'm fairly new to RSpec with Rails and I'm trying to wor

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 wrote: > 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 "should have

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 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 (ie. how thin

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 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 > app/controllers/parts_co

Re: [rspec-users] Cucumber: Running a single feature / scenario

2011-08-23 Thread Justin Ko
Sent from my iPhone On Aug 22, 2011, at 11:25 PM, "Nishith R." wrote: > For sake of completeness, if you are using bundle in rails3, and don't > want to invoke rake [to save init time], you can also execute it the > following way: > > bundle exec cucumber --guess --profile default > path/f

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 wrote: > > > On Aug 23, 1:55 pm, Justin Ko wrote: >> On Mon, Aug 22, 2011 at 9:09 PM, ct9a wrote: >> >>> Thanks, Justin. >> >>> I have the part object mocked up before e

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 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 >Part.stub(:new).and_return(par

  1   2   >