Re: [Rails] Rspec: expect(response).to have one of several valid values

2017-07-15 Thread Ralph Shnelvar
Very close! expect([200, 302]).to include response.status Thank you so much! Your suggestion gave me a whole new understanding of Rspec Ralph On Saturday, July 15, 2017 at 7:48:49 PM UTC-6, Dave Aronson wrote: > > On Saturday, July 15, 2017, Ralph Shnelvar wrote: > > I've tried >> expect(re

Re: [Rails] Rspec: expect(response).to have one of several valid values

2017-07-15 Thread Dave Aronson
On Saturday, July 15, 2017, Ralph Shnelvar wrote: I've tried > expect(response).to (have_http_status(200) || have_http_status(302)) > > While syntactically valid, this doesn't work because have_http_status(200)will > throw an exception before it gets to the have_http_status(302) . > Maybe someth

[Rails] Rspec: expect(response).to have one of several valid values

2017-07-15 Thread Ralph Shnelvar
I'm a novice at Rspec. Let's say I have expect(response).to have_http_status(200) But what I want is to say that either 200 or 302 is valid. How would I do that? Assume (byebug) response.status 302 I've tried expect(response).to (have_http_status(200) || have_http_status(302)) While syntac

[Rails] Rspec. Is 302 a success? Why 302?

2017-07-14 Thread Ralph Shnelvar
I have the following code, which was automagically created, in ~/controllers/articles_controller_spec.rb describe "GET #new" do it "returns a success response" do # See Hassan's answer in # https://groups.google.com/forum/#!topic/rubyonrails-talk/OQIYz9mnBXU byebug

[Rails] Rspec. assert_select deprecated?

2017-07-14 Thread Ralph Shnelvar
In https://apidock.com/rails/ActionController/Assertions/SelectorAssertions/assert_select I see that assert_select was deprecated. Yes, when I run rails generate scaffold SqlStatement \ title:text{120} \ description:text \ sql_stmt:text I find the following code generated in ~/spec/vie

Re: [Rails] Rspec =begin =end

2017-07-11 Thread Jim Ruther Nill
On Tue, Jul 11, 2017 at 9:27 PM, Ralph Shnelvar wrote: > In a file named spec/spec_helper.rb I see > # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration > RSpec.configure do |config| > # The settings below are suggested to provide a good initial experience > # with RSpec, but feel

[Rails] Rspec =begin =end

2017-07-11 Thread Ralph Shnelvar
In a file named spec/spec_helper.rb I see # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| # The settings below are suggested to provide a good initial experience # with RSpec, but feel free to customize to your heart's content. =begin # These two set

Re: [Rails] Rspec =begin =end

2017-07-10 Thread Mugurel Chirica
That is a multi line ruby comment, but it's not that popular, you are better off using multiple single line comments #comment. The reason is there is so you can remove them and that block will have the comments and the config.filter_run :focus (...) lines working properly. -- You received this me

[Rails] Rspec =begin =end

2017-07-10 Thread Ralph Shnelvar
Title: Rspec =begin =end I don't know if this is a Rails, Ruby, or Rspec question. In a file named spec/spec_helper.rb I have RSpec.configure do |config| # The settings below are suggested to provide a good initial experience # with RSpec, but feel free to customize to your heart's content. =beg

Re: [Rails] Rspec failure with :get. :get documentation?

2017-07-09 Thread Hassan Schroeder
On Sun, Jul 9, 2017 at 12:58 PM, Ralph Shnelvar wrote: > Is there documentation I can look at that explains what "get" does? I'll assume not meaning "get" the HTTP verb, but rather how rspec implements it for test purposes? Dunno about the latter, probably need to dig into the source for that.

Re: [Rails] Rspec failure with :get. :get documentation?

2017-07-09 Thread Ralph Shnelvar
Thank you so much, Hassan. I didn't see any warnings. Is there documentation I can look at that explains what "get" does? Ralph On Sunday, July 9, 2017 at 9:34:25 AM UTC-6, Hassan Schroeder wrote: > > On Sat, Jul 8, 2017 at 11:26 PM, Ralph Shnelvar > wrote: > > > I'm converting some code fro

Re: [Rails] Rspec failure with :get. :get documentation?

2017-07-09 Thread Hassan Schroeder
On Sat, Jul 8, 2017 at 11:26 PM, Ralph Shnelvar wrote: > I'm converting some code from Rails 4 to Rails 5.1.1 so that may be where > the following problems lies. > > > Part of the Rspec messages I'm getting is: > 1) ArticlesController GET #new returns a success response > Failure/Error: get

[Rails] Rspec failure with :get. :get documentation?

2017-07-09 Thread Ralph Shnelvar
Title: Rspec failure with :get. :get documentation? I'm trying to simultaneously learn Rspec as well as implement a Rails app.  I am a complete Rspec novice. I'm converting some code from Rails 4 to Rails 5.1.1 so that may be where the following problems lies. Part of the Rspec messages I'm g

Re: [Rails] Rspec | Missing id for create controller

2016-06-29 Thread Hassan Schroeder
On Tue, Jun 28, 2016 at 11:21 AM, Deepak Sharma wrote: > > Any help on this. I tried so many attempts to solve it but no luck. Providing a link to a reproducible test case would be a good start... -- Hassan Schroeder hassan.schroe...@gmail.com http://about.me/hassanschr

Re: [Rails] Rspec | Missing id for create controller

2016-06-28 Thread Deepak Sharma
On Sun, Jun 26, 2016 at 11:51 PM, Deepak Sharma wrote: > I tried above option but getting same error. Any help on this. I tried so many attempts to solve it but no luck. Thank You! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To uns

Re: [Rails] Rspec | Missing id for create controller

2016-06-26 Thread Deepak Sharma
On Sat, Jun 25, 2016 at 7:01 PM, tamouse pontiki wrote: > > Looks like right here: > >> >> expect(response).to redirect_to(student_path(assigns[:student])) > > > Should be `assigns(:student)`. I tried above option but getting same error. -- Cheers! Deepak Kumar Sharma Guru Nanak Dev En

Re: [Rails] Rspec | Missing id for create controller

2016-06-25 Thread tamouse pontiki
On Sat, Jun 25, 2016 at 4:08 AM, Deepak Sharma wrote: > I am getting Id missing nil error in my create controller spec. Yet I have > passed ID stuff in it still facing same everything. Here my create spec and > controller file > > *Create Spec* > > > describe 'POST :create' do > context 'wi

[Rails] Rspec | Missing id for create controller

2016-06-25 Thread Deepak Sharma
I am getting Id missing nil error in my create controller spec. Yet I have passed ID stuff in it still facing same everything. Here my create spec and controller file *Create Spec* describe 'POST :create' do context 'with valid data' do let(:valid_data) { FactoryGirl.attributes_for(:

[Rails] Rspec passes test only for one time

2016-06-21 Thread Deepak Sharma
In my application I'm using devise for authentication and rspec, capybara for testing. Here are my files *new_student_spec.rb* require 'rails_helper' require_relative '../support/new_student_form_spec' require_relative '../support/login_form_spec' feature 'New Student', type: :feature do let(:

Re: [Rails] Rspec for Pinning App

2016-06-03 Thread Hassan Schroeder
On Fri, Jun 3, 2016 at 8:21 AM, Michelle McManus wrote: > have a reached a point where I cannot figure out what I'm doing wrong. > 1) UsersController PUT #update with invalid params re-renders the 'edit' > template > Failure/Error: expect(response).to render_template("edit") >expec

[Rails] Rspec for Pinning App

2016-06-03 Thread Michelle McManus
Hi, all! I am very new to Ruby and working my way through a course and have a reached a point where I cannot figure out what I'm doing wrong. Here is a link to my project on GitHub . When running the /rspec/controllers/users_controller_sp

Re: [Rails] Rspec Testing issues -- Beginner Coder and not sure where to start in troubleshooting this.

2015-03-24 Thread bacrossland
Hassan is correct. I would check the value used in the name property of the field. First_Name is not the same as first_name. On Sunday, March 22, 2015 at 3:36:25 PM UTC-5, Hassan Schroeder wrote: > > On Sun, Mar 22, 2015 at 9:41 AM, Shawn Wilson wrote: > > > 1) Create User lists redirects to

Re: [Rails] Rspec Testing issues -- Beginner Coder and not sure where to start in troubleshooting this.

2015-03-22 Thread Hassan Schroeder
On Sun, Mar 22, 2015 at 9:41 AM, Shawn Wilson wrote: > 1) Create User lists redirects to the users list index page on success > Failure/Error: fill_in "First_Name", with: "Shawn" > Capybara::ElementNotFound: >Unable to find field "First_Name" The message seems pretty straight

[Rails] Rspec Testing issues -- Beginner Coder and not sure where to start in troubleshooting this.

2015-03-22 Thread Shawn Wilson
Im a noob to ROR and programming in general. i know enough to be dangerous but not enough to figure out where the hell i'm going wrong here. so this is what ive done so far. - wrote test: - tried to run test to enter text into 2 string fields (see below for errors) thanks for your help with

[Rails] Rspec ActiveJob and ActionMailer

2015-01-05 Thread Kaluzny Olivier
Hi, Since Rails 4.2, ActionMailer is integrate with ActiveJob. So this code UserMailer.sponsorship_accepted(invitation).deliver_later create a queue 'mailers' and add it automatically, So, no class UserMailerWorker is needed. How can I test without class worker ? Before I do expect(UserM

Re: [Rails] Rspec for polymorphic classes

2014-09-26 Thread Jason Fleetwood-Boldt
I'm not sure why you can't write a normal rspec against these objects--- generally rspec tests the objects themselves and how their public methods are implemented (and, when appropriate, the internals of the object implementation). The decision to make the attachment polymorphic -- which incide

[Rails] Rspec for polymorphic classes

2014-09-25 Thread Jan Yo
Rspec forum has troubles Does anyone have examples for rspec model for a polymorphic class? Since attributes get dynamically created into the db, this is different to test than normal rspec models. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscrib

Re: [Rails] Rspec Active Record Problem

2014-09-24 Thread Jason Fleetwood-Boldt
I think what apot...@gmail.com pointed out is most poignant, you can accomplish what you are trying to accomplish with this (ruby 2 syntax) scope :low_level, -> { where(:level => 1) } The you reference this scope as Article.low_level as you get your hands dirty with AR scopes, read & understa

Re: [Rails] Rspec Active Record Problem

2014-09-24 Thread Alexandre Calvão
Try using scope . === *Alexandre Mondaini Calvão* "*Nossa recompensa se encontra no esforço e não no resultado. Um esforço total é uma vitória completa*." [Ghandi] 2014-09-24 12:52 GMT-03:00 Jason Fleetwood-Boldt

Re: [Rails] Rspec Active Record Problem

2014-09-24 Thread Jason Fleetwood-Boldt
Jan, That is pretty strange-- but it looks like you're doing something non-standard and you've gotten yourself into a pickle. I notice that the error message says there's no method 'where' on an instance of an Article. Normally you call where on the class itself. First of all, why is your c

[Rails] Rspec Active Record Problem

2014-09-24 Thread Jan Yo
Rspec forum isn't working Rspec is having trouble recognizing where method. Here's the rspec output: NoMethodError: undefined method `where' for # # /apps/rvm/gems/ruby-2.0.0-p481/gems/activemodel-4.0.10/lib/active_model/attribute_methods.rb:439:in `method_missing' # /apps/rvm

[Rails] Rspec failing to find the model

2014-07-21 Thread Sjouke Fikse
I'm trying to create an instance of a class in a spec file, but I'm failing to do this. These two files exists: app/models/street.rb spec/models/street_spec.rb Within street_spec.rb, I'm trying to create a new instance of the street class, but it doesn't know what street is. That's accept

[Rails] Rspec testing in rails3

2014-04-26 Thread ruby rails
Hi, I have a Queues controller and and QueueItems controller in my rails application. In routes I have defined as below `match 'queues/:queue_id/next', :to=> 'queueitems#next'` In my QueueItems Controller I have a next action and it assigns an instance variable. def next @queue = "Regular

[Rails] Rspec testing in rails3

2014-04-26 Thread ruby rails
Hi, I have a Queues controller and and QueueItems controller in my rails application. In routes I have defined as below `match 'queues/:queue_id/next', :to=> 'queueitems#next'` In my QueueItems Controller I have a next action and it assigns an instance variable. def next @queue = "Regular

Re: [Rails] Rspec not running properly

2014-04-04 Thread Tommaso Visconti
it seems your tests are failing, could you link a gist with the tests? 2014-04-04 5:35 GMT+02:00 Kamal Bender : > Hello everybody, > > Being a new user of RoR, i'm experiencing a problem using Rspec, it > should end without errors but I still get this result: > > > PS C:\RubyTools\rubygems-2.2.2

[Rails] Rspec not running properly

2014-04-03 Thread Kamal Bender
Hello everybody, Being a new user of RoR, i'm experiencing a problem using Rspec, it should end without errors but I still get this result: PS C:\RubyTools\rubygems-2.2.2\rails_projects\sample_app> rspec spec Called from: C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/actionpack-3.

Re: [Rails] RSpec vs. Cucumber

2013-09-08 Thread Emil S
I meant to say simply use Rack::Test to make the requests while testing, Capybara isn't useful for interacting with an API directly. On 8 September 2013 23:43, Tamara Temple wrote: > > On Sep 8, 2013, at 12:41 AM, Emil S wrote: > > > Andre, what you need is Rack::Test, not capybara. > > Not su

Re: [Rails] RSpec vs. Cucumber

2013-09-08 Thread Tamara Temple
On Sep 8, 2013, at 12:41 AM, Emil S wrote: > Andre, what you need is Rack::Test, not capybara. Not sure what you mean here. Capy uses Rack::Test by default: https://github.com/jnicklas/capybara#selecting-the-driver -- You received this message because you are subscribed to the Google Groups

Re: [Rails] RSpec vs. Cucumber

2013-08-23 Thread Dave Aronson
On Fri, Aug 23, 2013 at 4:15 AM, Ilya Igonkin wrote: > using Cucumber is counterproductive as writing plain English > text and then parsing it with regular expressions is somewhat > overkill and error prone. I think anyone should use Cucumber > only if they have a strong reason to. Agreed! I us

Re: [Rails] RSpec vs. Cucumber

2013-08-23 Thread Ilya Igonkin
I know a lot people may disagree, but I believe that using Cucumber is counterproductive as writing plain English text and then parsing it with regular expressions is somewhat overkill and error prone. I think anyone should use Cucumber only if they have a strong reason to. And some well known Rail

Re: [Rails] RSpec vs. Cucumber

2013-08-22 Thread Emil S
My rule of thumb : Cucumber for integration testing ( output = documentation of features ) and RSpec for unit testing ( output = documentation of code ) On 23 August 2013 03:18, Tamara Temple wrote: > > On Aug 22, 2013, at 4:29 PM, "Jason Hsu, Android developer" < > jhsu802...@gmail.com> wrote:

Re: [Rails] RSpec vs. Cucumber

2013-08-22 Thread Tamara Temple
On Aug 22, 2013, at 4:29 PM, "Jason Hsu, Android developer" wrote: > So far, I've been using RSpec for testing my Rails apps simply because that's > what railstutorial.org emphasizes. > > However, I am in the process of trying out Cucumber. I like the fact that > it's in plain English, and

[Rails] RSpec vs. Cucumber

2013-08-22 Thread Jason Hsu, Android developer
So far, I've been using RSpec for testing my Rails apps simply because that's what railstutorial.org emphasizes. However, I am in the process of trying out Cucumber. I like the fact that it's in plain English, and this is an asset for communicating with clients or other people who aren't Rubyi

Re: [Rails] Rspec devise, testing extended RegistrationController action destroy

2013-07-09 Thread Colin Law
On 9 July 2013 14:48, wrote: > Colin, > > Thanks very much, I should have done that and understood right away why it > was not working. > > I forgot I had to login the user and that was the difference between the new > and create actions to the update and destroy for the registrations > controlle

Re: [Rails] Rspec devise, testing extended RegistrationController action destroy

2013-07-09 Thread andreo
Colin, Thanks very much, I should have done that and understood right away why it was not working. I forgot I had to login the user and that was the difference between the new and create actions to the update and destroy for the registrations controller on devise! sometimes you just need anot

Re: [Rails] Rspec devise, testing extended RegistrationController action destroy

2013-07-04 Thread Colin Law
On 4 July 2013 16:18, wrote: > Hi everyone, > > I have devise 1.5.4 working with rails 3.0.20 and ruby 1.8.7 . > > I have extended the destroy action from the RegistrationController, to soft > delete users instead of really deleting them from the database. > > def destroy > # raise resouce.in

[Rails] Rspec devise, testing extended RegistrationController action destroy

2013-07-04 Thread andreo
Hi everyone, I have devise 1.5.4 working with rails 3.0.20 and ruby 1.8.7 . I have extended the destroy action from the RegistrationController, to soft delete users instead of really deleting them from the database. def destroy # raise resouce.inspect # this is just to see if the test hits

[Rails] rspec rails 3 views authenticate

2013-05-24 Thread Aashish Kiran
Hi, I am stuck at the following. Can anyone help. I am writting a spec for views. home/index_html_haml_rspec.rb require 'spec_helper' describe "home/index.html.haml" do include Devise::TestHelpers login_user it "should display header with search form" do render :handlers => "hom

Re: [Rails] Rspec test fails

2013-03-29 Thread Frederick Cheung
On Friday, March 29, 2013 7:32:36 AM UTC, Jussi Hirvi wrote: > > On Thursday, March 28, 2013 4:06:09 PM UTC+2, Dihital wrote: >> >> Redirect ends current request and starts a new one, so you are right that >> that's the case (another action isn't called nor its template rendered). > > > That le

Re: [Rails] Rspec test fails

2013-03-29 Thread Jussi Hirvi
On Thursday, March 28, 2013 4:06:09 PM UTC+2, Dihital wrote: > > Redirect ends current request and starts a new one, so you are right that > that's the case (another action isn't called nor its template rendered). That left me pondering, why does it matter that a new request is started. Anyway

Re: [Rails] Rspec test fails

2013-03-28 Thread Gintautas Šimkus
Redirect ends current request and starts a new one, so you are right that that's the case (another action isn't called nor its template rendered). But shouldn't you also test that admin user is still there (wasn't deleted) after redirect happened? You could have very easily have him deleted in your

[Rails] Rspec test fails

2013-03-28 Thread Jussi Hirvi
Ok, now I have to ask. I am doing exercise 9.9 from the RoR tutorial (3.2). I have this rspec/capybara test to make sure that admin user cannot delete him/herself: subject { page } . . . describe "as admin user" do let(:admin) { FactoryGirl.create(:admin) } before { sign_in a

Re: [Rails] Rspec not able to detect existing route

2013-02-13 Thread sumit srivastava
On 13 February 2013 18:32, Colin Law wrote: > On 13 February 2013 12:31, Sumit Srivastava > wrote: > > Hi, > > > > I have added a route to my routes.rb as following, > > > > get "/order/:player_id/:order", :to => 'share#order_renderer', :as => > > :order_feed > > > > It works for me in the app b

Re: [Rails] Rspec not able to detect existing route

2013-02-13 Thread Colin Law
On 13 February 2013 12:31, Sumit Srivastava wrote: > Hi, > > I have added a route to my routes.rb as following, > > get "/order/:player_id/:order", :to => 'share#order_renderer', :as => > :order_feed > > It works for me in the app but when I am running the spec file for, it says, > not route match

[Rails] Rspec not able to detect existing route

2013-02-13 Thread Sumit Srivastava
Hi, I have added a route to my routes.rb as following, get "/order/:player_id/:order", :to => 'share#order_renderer', :as => :order_feed It works for me in the app but when I am running the spec file for, it says, not route matches for this controller, action, parameters. Regards, Sumit --

[Rails] Rspec Test Failing?

2013-01-15 Thread fuzzy
Hi, rails 3.2.11 and Capybara 2.0.2 and the latest rspec. I have another test that has me searching for a solution ... just now, I do not have one and I have spent a number of days trying out different solutions. If I may ... here is the test, spec/features: describe "submittin

Re: [Rails] Rspec: How to test create action in controller

2013-01-13 Thread Jordon Bedwell
On Sun, Jan 13, 2013 at 9:17 AM, Jordon Bedwell wrote: > MyController < ApplicationController > def my_action > redirect_to :back unless params["blah"] == "blah" > render :my_template > end > end > > Should be: > > MyController < ApplicationController > def my_action > return

Re: [Rails] Rspec: How to test create action in controller

2013-01-13 Thread Jordon Bedwell
On Sun, Jan 13, 2013 at 5:23 AM, Peter wrote: > I've searched high and low for the answer to this, so now I have to submit a > question... > >> # describe "POST on Users#create" do >> # before { post users_path } >> # specify { response.should redirect_to(root_path) } >>

[Rails] Rspec: How to test create action in controller

2013-01-13 Thread Peter
Hi Everyone, (using rails 3.2.11) I've searched high and low for the answer to this, so now I have to submit a question... # describe "POST on Users#create" do > # before { post users_path } > # specify { response.should redirect_to(root_path) } > # end Every time

Re: [Rails] Rspec post controller failure

2012-11-29 Thread Raul Sanchez
Done and green :) Thank you again 2012/11/29 Colin Law > On 29 November 2012 11:58, Raul Sanchez wrote: > > A :-) > > > > Thank you. > > > > Which will be the right way to do it? > > Just fetch it from the db again before tesating it > > Colin > > > > > El 29/11/2012 12:42, "Colin Law" e

Re: [Rails] Rspec post controller failure

2012-11-29 Thread Colin Law
On 29 November 2012 11:58, Raul Sanchez wrote: > A :-) > > Thank you. > > Which will be the right way to do it? Just fetch it from the db again before tesating it Colin > > El 29/11/2012 12:42, "Colin Law" escribió: >> >> On 29 November 2012 11:30, Raul Sanchez wrote: >> > Hello: >> > >>

Re: [Rails] Rspec post controller failure

2012-11-29 Thread Raul Sanchez
A :-) Thank you. Which will be the right way to do it? El 29/11/2012 12:42, "Colin Law" escribió: > On 29 November 2012 11:30, Raul Sanchez wrote: > > Hello: > > > > I'm going crazy with a test of a controller action. > > > > This is the test > > > > describe "POST changetipo" do > > i

Re: [Rails] Rspec post controller failure

2012-11-29 Thread Colin Law
On 29 November 2012 11:30, Raul Sanchez wrote: > Hello: > > I'm going crazy with a test of a controller action. > > This is the test > > describe "POST changetipo" do > it "toggle tipo of tije" do > tije = FactoryGirl.create(:tije) > puts "--- #{tije.inspect}---

[Rails] Rspec post controller failure

2012-11-29 Thread Raul Sanchez
Hello: I'm going crazy with a test of a controller action. This is the test describe "POST changetipo" do it "toggle tipo of tije" do tije = FactoryGirl.create(:tije) puts "--- #{tije.inspect}--" post :changetipo, :id => tije.id puts "+

Re: [Rails] RSpec: controller POST create

2012-11-12 Thread Mirri Kim
On your controller, use `create!` to see what is preventing the save. On Mon, Nov 12, 2012 at 5:19 PM, Soichi Ishida wrote: > Rails 3.1.3 > rspec-rails (2.11.4) > rspec 2.11.1 > > I am new to rspec. I don't quite understand tests for POST create part. > > I have generated scaffold, and simultan

Re: [Rails] RSpec: controller POST create

2012-11-12 Thread Norbert Melzer
Where do you define valid attributes? Have you tried post :plan => Factory(:plan)? Am 12.11.2012 10:19 schrieb "Soichi Ishida" : > Rails 3.1.3 > rspec-rails (2.11.4) > rspec 2.11.1 > > I am new to rspec. I don't quite understand tests for POST create part. > > I have generated scaffold, and simu

[Rails] RSpec: controller POST create

2012-11-12 Thread Soichi Ishida
Rails 3.1.3 rspec-rails (2.11.4) rspec 2.11.1 I am new to rspec. I don't quite understand tests for POST create part. I have generated scaffold, and simultaneously it generated controller_spec.rb as well. it "assigns a newly created plan as @plan" do post :create, {:plan => valid

[Rails] RSpec: scaffold index undefined method create

2012-11-11 Thread Soichi Ishida
Rails 3.1.3 rspec-rails (2.11.4) rspec 2.11.1 I have generated a scaffold named Plan. And I have not done RSpec tests for controllers at all. schema.rb create_table "plans", :force => true do |t| t.integer "give_take" t.integer "weight" t.boolean "check_in" t.datetime "cre

[Rails] rspec failure upon revisit

2012-11-06 Thread Drew Davis
I just returned from a different project after taking a few weeks off of my tutorial. I'm using Ruby on Rails 3 Tutorial - Learn Rails by Example by Michael Hartl. After rebooting my server I ran an rspec spec/ command to check to see if there were any problems and this is what I received. I did

Re: [Rails] rspec : how to I do this ?

2012-10-30 Thread Rodrigo Martins
You can use the gem shoulda-matchers[1] to test it. She works very well with rspec. And it is very easy to test this. With it you can test the attributes, calls from models and stuff ... You can use the gem-rails factory-girl, best to test the interactions, writing less and being more efficient

Re: [Rails] rspec : how to I do this ?

2012-10-30 Thread Colin Law
On 30 October 2012 15:47, roelof wrote: > Thanks for the answer. > I will try to find out how this works. As far as I can find it this is not > covered in this code school course. Try railstutorial.org, which is free to use online. It gives a good introduction to testing. Colin > > Roelof > >

Re: [Rails] rspec : how to I do this ?

2012-10-30 Thread roelof
Thanks for the answer. I will try to find out how this works. As far as I can find it this is not covered in this code school course. Roelof Op dinsdag 30 oktober 2012 14:48:47 UTC+1 schreef Hassan Schroeder het volgende: > On Tue, Oct 30, 2012 at 6:29 AM, roelof > > wrote: > > > I have fol

Re: [Rails] rspec : how to I do this ?

2012-10-30 Thread Hassan Schroeder
On Tue, Oct 30, 2012 at 6:29 AM, roelof wrote: > I have followed the rspec course on code-school. > Now I try to make a test so I can verify that a message has a title and a > body. > > How can I do this ? I would suggest you use the rspec generators to create a model or scaffold and then use t

[Rails] rspec : how to I do this ?

2012-10-30 Thread roelof
Hello, I have followed the rspec course on code-school. Now I try to make it work on my own project. Let's say I have this model : class message < ActiveRecord::Base attr_accessible :bericht, :user belongs_to :user belongs_to :category end Now I try to make a test so I can ver

Re: [Rails] [RSpec Testing] Methods take two arguments

2012-09-15 Thread Mirri Kim
P.S. But still, this will probably fail because you're not actually doing anything (at least that's obvious) to trigger PdfHelper.create_pdf. "user" has no knowledge of "file" assuming you have a callback to create a pdf when a user is created. The first test is also weird, it's like saying a = 1;

Re: [Rails] [RSpec Testing] Methods take two arguments

2012-09-15 Thread Mirri Kim
Hi there, try: PdfHelper.should_recieve(:create_pdf).with(user, file) On Sun, Sep 16, 2012 at 1:01 AM, Adnan wrote: > Hello, > > Here is my *pdf_helper.rb* => http://pastebin.com/QU1kTKXk. I want to > test, if self.create method can take more than two arguments. But, when I > try to run my test

[Rails] [RSpec Testing] Methods take two arguments

2012-09-15 Thread Adnan
Hello, Here is my *pdf_helper.rb* => http://pastebin.com/QU1kTKXk. I want to test, if self.create method can take more than two arguments. But, when I try to run my test. It showed *PdfHelper Should have two arguments Failure/Error: create_pdf.should_receive(object,template).with(user,fi

Re: [Rails] Rspec

2012-08-04 Thread hanish jadala
My Response was just a reply to borken attitude person. On Sat, Aug 4, 2012 at 1:26 PM, Colin Law wrote: > On 4 August 2012 08:51, hanish jadala wrote: > > Mr.Michael Pavling my google is fine. i posted this for help so that > other > > who read different books on Rspec can suggest me one good

Re: [Rails] Rspec

2012-08-04 Thread Colin Law
On 4 August 2012 08:51, hanish jadala wrote: > Mr.Michael Pavling my google is fine. i posted this for help so that other > who read different books on Rspec can suggest me one good book or nice blog. > Seems your attitude is broken.. It is foolish to bite the hand that feeds you. It will soon g

Re: [Rails] Rspec

2012-08-04 Thread hanish jadala
Mr.Michael Pavling my google is fine. i posted this for help so that other who read different books on Rspec can suggest me one good book or nice blog. Seems your attitude is broken.. On Sat, Aug 4, 2012 at 1:05 PM, Michael Pavling wrote: > On 4 August 2012 06:30, honey ruby wrote: > > Hi all i

Re: [Rails] Rspec

2012-08-04 Thread Michael Pavling
On 4 August 2012 06:30, honey ruby wrote: > Hi all i'm trying to learn Rspec testing can anyone suggest me the best > book to learn Rspec with good sample code. "The RSpec Book", maybe? http://www.google.co.uk/search?q=rspec+book Is your Google broken... -- You received this message because

[Rails] Rspec

2012-08-03 Thread honey ruby
Hi all i'm trying to learn Rspec testing can anyone suggest me the best book to learn Rspec with good sample code. Thanks in advance -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@

Re: [Rails] Rspec failure on rails 3.2.6

2012-07-03 Thread Colin Law
On 3 July 2012 12:21, venkata reddy wrote: > I have a simple rspec test which is failing in after i upgrade to > 3.2.6. > > here is the spec in users_controller_spec.rb > > describe "show action" do > before(:each) do > User.stub!(:find).with(@user.id).and_return(@user) > end > > def do_

Re: [Rails] Rspec failure on rails 3.2.6

2012-07-03 Thread Oscar Del Ben
it looks like parameters are now passed as strings. -- Oscar Del Ben Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Tuesday, July 3, 2012 at 4:21 AM, venkata reddy wrote: > I have a simple rspec test which is failing in after i upgrade to > 3.2.6. > > here is the spec in users_cont

[Rails] Rspec failure on rails 3.2.6

2012-07-03 Thread venkata reddy
I have a simple rspec test which is failing in after i upgrade to 3.2.6. here is the spec in users_controller_spec.rb describe "show action" do before(:each) do User.stub!(:find).with(@user.id).and_return(@user) end def do_get get :show, :id => @user.id end it "should be succe

Re: [Rails] Rspec

2012-07-02 Thread thil
Hi Colin, Thanks for your reply. Thanks, Senthil On Monday, 2 July 2012 15:10:07 UTC+5:30, Colin Law wrote: > > On 2 July 2012 08:07, thil wrote: > > Hi All , > > > > I am working in rails past 1+ years but still I didn't used any Unit > testing > > in my project. > > > > Can any one h

Re: [Rails] Rspec

2012-07-02 Thread Colin Law
On 2 July 2012 08:07, thil wrote: > Hi All , > > I am working in rails past 1+ years but still I didn't used any Unit testing > in my project. > > Can any one help me to know where I can learn the Rspec or basic things to > start. Work through the tutorial railstutorial.org which is free to use

[Rails] Rspec

2012-07-02 Thread thil
Hi All , I am working in rails past 1+ years but still I didn't used any Unit testing in my project. Can any one help me to know where I can learn the Rspec or basic things to start. Thanks, Senthil -- You received this message because you are subscribed to the Google Groups "Ruby on Rai

[Rails] Rspec - want to NOT clear database between tests

2012-06-29 Thread Carilda Thomas
Rails 3.2.1 Ruby 1.9.3p125 Rspec 2.8.0 I have a utility written in ruby that executes within a Rails environment. It creates database records in one table based on the info in other tables. A date and a name determine uniqueness of these created records. To test this, I have to run the utility giv

Re: [Rails] Rspec tests passing individually but passing on a whole

2012-06-27 Thread Colin Law
On 27 June 2012 11:21, venkata reddy wrote: > Hi All, >         I found a weird thing happening with rspec tests. One of the tests > is passing individually but failing when run all the tests in the > application. Even to debug that, i have to run the whole tests which is > taking more time to run

[Rails] Rspec tests passing individually but passing on a whole

2012-06-27 Thread venkata reddy
Hi All, I found a weird thing happening with rspec tests. One of the tests is passing individually but failing when run all the tests in the application. Even to debug that, i have to run the whole tests which is taking more time to run. Anybody come across such thing? Any idea what's i

Re: [Rails] RSpec test model and mailer

2012-06-20 Thread David Angga
it "should sent an email confirmation" do @user = User.first ActionMailer::Base.delivery_method = :test ActionMailer::Base.perform_deliveries = true ActionMailer::Base.deliveries.clear @user.create_reset_code @email_confirmation = ActionMailer::Base.deliveries.first @email_confirma

[Rails] RSpec test model and mailer

2012-06-20 Thread Danko Danko
I have method in model (User Model) def create_reset_code self.attributes = {:reset_code => Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )} save(:validate=>false) UserMailer.reset_password_email(self).deliver end How can I test it in RSpec? I want to t

[Rails] Rspec for custom validations

2012-05-10 Thread venkata reddy
Hi all, i am very new when it comes to writing tests, can anyone give me an idea how to write RSpec test for the following custom validation. def validate_campaign_and_ad unless self.ad.nil? || self.ad.campaign_id == self.campaign_id errors.add(:campaign_id, "ad.campaign (#{self.ad.camp

[Rails] rspec-mocks and rspec-rails-2.10.1 are released!

2012-05-04 Thread David Chelimsky
These are patch releases recommended for anybody who has already upgraded to 2.10. ### rspec-mocks-2.10.1 full changelog: http://github.com/rspec/rspec-mocks/compare/v2.10.0...v2.10.1 Bug fixes * fix [regression of edge case behavior](https://github.com/rspec/rspec-mocks/issues/132) * fixed

[Rails] Rspec

2012-04-18 Thread Jeff Kyzer
Hello all Something that once worked is no longer. I am learning Rails from the book "Ruby On Rails 3 by Michael hartl, so i am going "by the book" I am using rspec to run tests. I believe i have downloaded all the necessary gems and run bundle install. I am using windows 7. When I run rspec

[Rails] rspec: identical tests fails when repeated

2012-04-05 Thread Fearless Fool
I'm doing RSpec controller testing with CanCan authorization, and I'm seeing something I've never seen in RSpec before: the same test run twice fails on the second one. I am NOT doing before(:all) or other things that should cause state to persist between tests: Here's the relevant code: conte

[Rails] rspec-expectations-2.9.1 is released!

2012-04-03 Thread David Chelimsky
rspec-expectations-2.9.1 is released! This is a bug-fix only release, and is recommended for everybody using rspec-2.9. ### rspec-expectations-2.9.1 / 2012-04-03 [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.9.0...2.9.1) Bug fixes * Provide a helpful message if the di

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

2012-03-29 Thread David Chelimsky
On Thu, Mar 22, 2012 at 7:23 AM, Fearless Fool wrote: > The basic question: how do you mock (or stub) a reference to a > polymorphic class in RSpec?  Trying the obvious thing leads to an error > of the form: > >   undefined method `base_class' for Post:Class > > === The details: > > # file: app/mo

[Rails] rspec: mocking a reference to a polymorphic model?

2012-03-22 Thread Fearless Fool
The basic question: how do you mock (or stub) a reference to a polymorphic class in RSpec? Trying the obvious thing leads to an error of the form: undefined method `base_class' for Post:Class === The details: # file: app/models/relation.rb class Relation < ActiveRecord::Base belongs_to :en

  1   2   3   >