From lists at ruby-forum.com Wed Jul 4 08:24:56 2012 From: lists at ruby-forum.com (Gintautas S.) Date: Wed, 04 Jul 2012 10:24:56 +0200 Subject: [rspec-users] Rails validation spec fails (but code works in development env) In-Reply-To: <0b8fb34e2bf66fb3234379560c3e2dac@ruby-forum.com> References: <0b8fb34e2bf66fb3234379560c3e2dac@ruby-forum.com> Message-ID: <3664a1b93034b5e8b4ee8f6574004bb2@ruby-forum.com> I came across the same issue. I was trying to accomplish exactly the same thing like the original poster (make sure that association is with an actual record in the DB). I came across the same issue too, and after a little debugging the core the solution is to use Proc. This has to do with loading mechanics, IMO: when you run the spec, first the model definition is loaded, there are no records in the DB yet, so :in option is just empty array (I debugged this to be true). But if you use Proc in that place, then the query to get records from DB is executed "lazily"; by that time your spec has correct context setup (manufacturers table populated) and thus you get correct behavior from spec. In your case you should use: validates :manufacturer_id, :inclusion => { :in => Proc.new { Manufacturer.all.collect { |m| m.id } } } -- Posted via http://www.ruby-forum.com/. From matt at mattwynne.net Thu Jul 5 09:13:21 2012 From: matt at mattwynne.net (Matt Wynne) Date: Thu, 5 Jul 2012 10:13:21 +0100 Subject: [rspec-users] Selenium+Autotest: how to run browser in background? In-Reply-To: <0b345acb4d606b41648764b5effa7520@ruby-forum.com> References: <0b345acb4d606b41648764b5effa7520@ruby-forum.com> Message-ID: <551DAF80-8FBA-4A2F-906B-2E9F4F10E37E@mattwynne.net> On 22 Jun 2012, at 10:38, Joshua Muheim wrote: > Well, didn't find a solution, but using the :chrome driver lets Chrome > be activated in the background... > > See > http://collectiveidea.com/blog/archives/2011/09/27/use-chrome-with-cucumber-capybara/ capybara-webkit is best for this. It's fast and you never see it. cheers, Matt -- Freelance programmer & coach Author, http://pragprog.com/book/hwcuc/the-cucumber-book Founder, http://www.relishapp.com/ Twitter, https://twitter.com/mattwynne -------------- next part -------------- An HTML attachment was scrubbed... URL: From clifford.heath at gmail.com Thu Jul 5 11:03:45 2012 From: clifford.heath at gmail.com (Clifford Heath) Date: Thu, 5 Jul 2012 21:03:45 +1000 Subject: [rspec-users] Twister - a replacement for Heckle Message-ID: <93DCD2D0-8B87-4DF3-8F32-405812D2C93D@gmail.com> Folk, You might be interested in my modification to Ruby to support code mutation testing. See the blog posting here to get started: This work was almost all done at the recent RailsCamp in Queensland, so it doesn't represent a large development effort yet. I've started on changes to RSpec to make use of the new Twister hook, see . I'm currently paused trying to figure out how to modify the formatters (or whether to simply replace them) during mutation runs. I'd appreciate some of your thoughts and perhaps some pull requests to show how you think mutation testing should be done. There are limitations to mutation testing by re-loading code. I undefine any new constants and reload. That doesn't work if your code has applied any monkey patches, or if instances of classes it defined are still extant. Perhaps you have some ideas on how to make this part smoother? Anyhow, take a look, tell me what you think. Clifford Heath, Data Constellation, http://dataconstellation.com Agile Information Management and Design Skype: cjheath, Ph: (+61/0)401-533-540 From lists at ruby-forum.com Fri Jul 6 19:41:31 2012 From: lists at ruby-forum.com (Serguei Cambour) Date: Fri, 06 Jul 2012 21:41:31 +0200 Subject: [rspec-users] Running Rspec tests with JRuby fails Message-ID: <8bd15ef67e60a60dd1e48564e90f34f6@ruby-forum.com> How to run RSpec tests with JRuby in a Java project? I tried to run it with JRuby 1.7.0.preview1, rspec (2.10.0) rspec-core (2.10.1) rspec-expectations (2.10.0) rspec-mocks (2.10.1) rspec-rails (2.10.1) as follows: jruby -S rspec and got the error: javix at ubuntu:~/Development/rspec_jruby$ jruby -S rspec spec NameError: cannot load Java class com.models.Calculator for_name at org/jruby/javasupport/JavaClass.java:1206 get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34 java_import at file:/home/javix/.rvm/rubies/jruby-1.7.0.preview1/lib/jruby.jar!/jruby/java/core_ext/object.rb:45 map at org/jruby/RubyArray.java:2350 java_import at file:/home/javix/.rvm/rubies/jruby-1.7.0.preview1/lib/jruby.jar!/jruby/java/core_ext/object.rb:41 (root) at /home/javix/Development/rspec_jruby/spec/com/models/calculator_spec.rb:3 load at org/jruby/RubyKernel.java:1017 (root) at /home/javix/.rvm/gems/jruby-1.7.0.preview1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:1 map at org/jruby/RubyArray.java:2350 load_spec_files at /home/javix/.rvm/gems/jruby-1.7.0.preview1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746 load_spec_files at /home/javix/.rvm/gems/jruby-1.7.0.preview1/gems/rspec-core-2.10.1/lib/rspec/core/configuration.rb:746 run at /home/javix/.rvm/gems/jruby-1.7.0.preview1/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:22 run at /home/javix/.rvm/gems/jruby-1.7.0.preview1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:69 javix at ubuntu:~/Development/rspec_jruby$ Here is the java class, too simple just to be able to test if all works: in [project_root-src-com-models]: package com.models; public class Calculator { public int sum(int x, int y){ return x+y; } } Here is the rspec file in [project_root-spec-com-models-calculator_spec.rb]: require 'java' require 'rubygems' java_import 'com.models.Calculator' describe "Calculator" do it "should add numbers correctly" do calc = Calculator.new calc.sum(1,3).should == 4 end end Any idea? Thank you in advance. -- Posted via http://www.ruby-forum.com/. From kris.luminar at gmail.com Tue Jul 10 17:08:12 2012 From: kris.luminar at gmail.com (Kris Luminar) Date: Tue, 10 Jul 2012 10:08:12 -0700 (PDT) Subject: [rspec-users] No examples were matched. In-Reply-To: References: Message-ID: <774cda2f-b2eb-4d6a-a3fc-c0903bba695f@googlegroups.com> I have this issue also; were you able to resolve it? On Wednesday, January 12, 2011 9:42:03 AM UTC-8, Nadal wrote: > > I am using rspec-rails 2.4.1 on a rails3 (3.0.3) app. I have around 20 > specs. When I run rake spec all 20 specs run fine. > > However when I do bundle exec rspec then I get this message. > > No examples were matched. Perhaps {:unless=># Users/nadal/.rvm/gems/ree-1.8.7-2010.02 at rails3/gems/rspec-core-2.4.0/ > lib/rspec/core/configuration.rb:51>, :if=># Users/nadal/.rvm/gems/ree-1.8.7-2010.02 at rails3/gems/rspec-core-2.4.0/ > lib/rspec/core/configuration.rb:50>} is excluding everything? > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Sat Jul 14 15:16:25 2012 From: lists at ruby-forum.com (sports huntr) Date: Sat, 14 Jul 2012 17:16:25 +0200 Subject: [rspec-users] Watch NFL Preseason 2012 Live Stream Online NFL Football ESPN HDQ FREE In-Reply-To: References: Message-ID: <74836803a5b7c865abff88af11c047d9@ruby-forum.com> http://footballtv247.com/ -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sat Jul 14 15:16:48 2012 From: lists at ruby-forum.com (sports huntr) Date: Sat, 14 Jul 2012 17:16:48 +0200 Subject: [rspec-users] Watch NFL Preseason 2012 Live Stream Online NFL Football ESPN HDQ FREE In-Reply-To: References: Message-ID: <1bfaac511d317bb13e67ccdf275f22d9@ruby-forum.com> http://footballtv247.com/ -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jul 16 01:28:21 2012 From: lists at ruby-forum.com (Mike Glaz) Date: Mon, 16 Jul 2012 03:28:21 +0200 Subject: [rspec-users] describe, context, feature, scenario Message-ID: <9a0a3850a4e4d7cbcd80ac5e32ccd99a@ruby-forum.com> 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/. From matt at mattwynne.net Mon Jul 16 09:50:14 2012 From: matt at mattwynne.net (Matt Wynne) Date: Mon, 16 Jul 2012 10:50:14 +0100 Subject: [rspec-users] describe, context, feature, scenario In-Reply-To: <9a0a3850a4e4d7cbcd80ac5e32ccd99a@ruby-forum.com> References: <9a0a3850a4e4d7cbcd80ac5e32ccd99a@ruby-forum.com> Message-ID: On 16 Jul 2012, at 02:28, Mike Glaz wrote: > Describe, context, feature, scenario: what is the difference between the > four and when do I use each one? Feature and Scenario are Cucumber keywords and AFAIK have nothing to do with RSpec. #describe and #context are both aliases for the same method which creates a new (anonymous) subclass of RSpec::ExampleGroup. This is essentially the same thing as sublcassing Test::Unit::TestCase as you would in a bog standard test-unit test. So #describe and #context do the same thing. I tend to use #describe on the top level (what is the thing I'm describing in this spec), then use #context inside that to explain the different hoops I'm making that thing jump through in my examples. cheers, Matt -- Freelance programmer & coach Author, http://pragprog.com/book/hwcuc/the-cucumber-book Founder, http://www.relishapp.com/ Twitter, https://twitter.com/mattwynne -------------- next part -------------- An HTML attachment was scrubbed... URL: From jko170 at gmail.com Mon Jul 16 15:18:09 2012 From: jko170 at gmail.com (Justin Ko) Date: Mon, 16 Jul 2012 09:18:09 -0600 Subject: [rspec-users] describe, context, feature, scenario In-Reply-To: <9a0a3850a4e4d7cbcd80ac5e32ccd99a@ruby-forum.com> References: <9a0a3850a4e4d7cbcd80ac5e32ccd99a@ruby-forum.com> Message-ID: 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 list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users #feature & #scenario come from the "steak" gem or maybe the Capybara RSpec API (if it still exists). They do not exist in RSpec. I use #context to "setup" different paths/scenarios of what I'm _describing_. Here is an example: describe Dog do describe '#beg' do context 'presented with a slice of steak' do it 'puts its chin on the floor' do end end context 'presented with a carrot' do it 'does nothing' do end end end end Always start off (top level) with #describe From groups at inbox.avdi.org Mon Jul 16 15:39:38 2012 From: groups at inbox.avdi.org (Avdi Grimm) Date: Mon, 16 Jul 2012 11:39:38 -0400 Subject: [rspec-users] describe, context, feature, scenario In-Reply-To: References: <9a0a3850a4e4d7cbcd80ac5e32ccd99a@ruby-forum.com> Message-ID: Feature and scenario are aliases defined by capybara. On Jul 16, 2012 5:50 AM, "Matt Wynne" wrote: > > On 16 Jul 2012, at 02:28, Mike Glaz wrote: > > Describe, context, feature, scenario: what is the difference between the > four and when do I use each one? > > > Feature and Scenario are Cucumber keywords and AFAIK have nothing to do > with RSpec. > > #describe and #context are both aliases for the same method which creates > a new (anonymous) subclass of RSpec::ExampleGroup. This is essentially the > same thing as sublcassing Test::Unit::TestCase as you would in a bog > standard test-unit test. > > So #describe and #context do the same thing. I tend to use #describe on > the top level (what is the thing I'm describing in this spec), then use > #context inside that to explain the different hoops I'm making that thing > jump through in my examples. > > cheers, > Matt > > -- > Freelance programmer & coach > Author, http://pragprog.com/book/hwcuc/the-cucumber-book > Founder, http://www.relishapp.com/ > Twitter, https://twitter.com/mattwynne > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ossareh at twitch.tv Tue Jul 17 18:59:02 2012 From: ossareh at twitch.tv (Mike Ossareh) Date: Tue, 17 Jul 2012 11:59:02 -0700 Subject: [rspec-users] describe, context, feature, scenario In-Reply-To: <9a0a3850a4e4d7cbcd80ac5e32ccd99a@ruby-forum.com> References: <9a0a3850a4e4d7cbcd80ac5e32ccd99a@ruby-forum.com> Message-ID: On Sun, Jul 15, 2012 at 6:28 PM, Mike Glaz wrote: > Describe, context, feature, scenario: what is the difference between the > four and when do I use each one? > Hi Mike, We've been writing tests a lot over the past year, and one of our devs wrote up some details about the now preferred RSpec DSL. It skims over the top of your question, and I hope it provides you with some high level concepts: http://twitchtv.github.com/blog/2012/07/04/rspec-tech-talk/ > > thanks, > mike > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From femtowin at gmail.com Wed Jul 18 10:42:39 2012 From: femtowin at gmail.com (femto Zheng) Date: Wed, 18 Jul 2012 18:42:39 +0800 Subject: [rspec-users] How do I specify login with controller spec with rspec-rails? Message-ID: 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.(:before_every_example) login something? could someone provide some information? thanks. -- http://hi.baidu.com/femto http://www.aisiming.com/ http://maptu.heroku.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jko170 at gmail.com Wed Jul 18 15:21:33 2012 From: jko170 at gmail.com (Justin Ko) Date: Wed, 18 Jul 2012 09:21:33 -0600 Subject: [rspec-users] How do I specify login with controller spec with rspec-rails? In-Reply-To: References: Message-ID: 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.(:before_every_example) login something? > could someone provide some information? thanks. > > -- > http://hi.baidu.com/femto > http://www.aisiming.com/ > http://maptu.heroku.com/ > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users Are you using an authentication gem/engine? -------------- next part -------------- An HTML attachment was scrubbed... URL: From femtowin at gmail.com Wed Jul 18 15:30:45 2012 From: femtowin at gmail.com (femto Zheng) Date: Wed, 18 Jul 2012 23:30:45 +0800 Subject: [rspec-users] How do I specify login with controller spec with rspec-rails? In-Reply-To: References: Message-ID: 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 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.(:before_every_example) login something? > could someone provide some information? thanks. > > -- > http://hi.baidu.com/femto > http://www.aisiming.com/ > http://maptu.heroku.com/ > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > > Are you using an authentication gem/engine? > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -- http://hi.baidu.com/femto http://www.aisiming.com/ http://maptu.heroku.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jko170 at gmail.com Wed Jul 18 15:57:49 2012 From: jko170 at gmail.com (Justin Ko) Date: Wed, 18 Jul 2012 09:57:49 -0600 Subject: [rspec-users] How do I specify login with controller spec with rspec-rails? In-Reply-To: References: Message-ID: <310A2309-699B-42E1-A7D8-046B8E17A41C@gmail.com> 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 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.(:before_every_example) login something? >> could someone provide some information? thanks. >> >> -- >> http://hi.baidu.com/femto >> http://www.aisiming.com/ >> http://maptu.heroku.com/ >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > Are you using an authentication gem/engine? > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > > > -- > http://hi.baidu.com/femto > http://www.aisiming.com/ > http://maptu.heroku.com/ > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users https://github.com/plataformatec/devise/wiki/_pages https://github.com/plataformatec/devise/wiki/How-To:-Stub-authentication-in-controller-specs -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Sun Jul 22 21:08:23 2012 From: lists at ruby-forum.com (Salvatore Pelligra) Date: Sun, 22 Jul 2012 23:08:23 +0200 Subject: [rspec-users] RSpec/rails & Capybara: #within Message-ID: 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_string)` trick? When describe a view, I want something like that: describe "path/to/view.html.erb" do it "should pass" do render within('form#id') { should have_selector 'input', type: 'submit' should have_selector 'input', type: 'text', value: 'default' # ... } end end PS: Hope this is the right sections! ^^" -- Posted via http://www.ruby-forum.com/. From james at imaj.es Mon Jul 23 16:19:58 2012 From: james at imaj.es (James Cox) Date: Mon, 23 Jul 2012 12:19:58 -0400 Subject: [rspec-users] A recently observed anti pattern: commented out tests Message-ID: Hey, in a bunch of the rescues i've recently done, I see a pretty big anti pattern: tests don't work, and so rather than making them work, the dev team just comments them out till 'later'. Does anyone think it'd be useful/interesting to get a flag for rspec which would compare lines vs lines-commented, and if the percentage was higher than xx, it'd issue some kind of warning? Best, james From lists at ruby-forum.com Mon Jul 23 16:32:25 2012 From: lists at ruby-forum.com (Ja Tse) Date: Mon, 23 Jul 2012 18:32:25 +0200 Subject: [rspec-users] Unable to Run 'bundle exec cucumber' Message-ID: 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/1.8/gems/gherkin-2.2.9-x86-mingw32/lib/gherkin/lexer/i18n_lexer.rb:23: [BUG] Segmentation fault ruby 1.8.7 (2012-06-29 patchlevel 370) [i386-mingw32] Thanks -- Posted via http://www.ruby-forum.com/. From todd.sedano at sv.cmu.edu Mon Jul 23 17:07:06 2012 From: todd.sedano at sv.cmu.edu (Todd Sedano) Date: Mon, 23 Jul 2012 10:07:06 -0700 Subject: [rspec-users] A recently observed anti pattern: commented out tests In-Reply-To: References: Message-ID: I must admit that I'm guilting of commenting out tests. I often do this when I know that the code works, and I just upgraded some gem, and now one of my tests no longer passes. I look at the test and realize that the effort it would take to get the test to work outweighs the value that the test provides me. (This is a general frustration for me that testing takes more time than coding.) I just did a quick scan of my main rails project (one that's been around for four years) and has ~700 tests. I found two kinds of commented out tests. About 12 of these commented tests look real and I should spend some time and see why they are there. About 10 of these commented tests look like I was brainstorming pending tests, I implemented them another way, but never bothered cleaning them up. In the spirit of clean code, I'll take a moment to clean house. Thanks James! Todd Sedano Director of Software Engineering Carnegie Mellon University Silicon Valley Campus Developing Software Leaders (TM) T: 650-335-2812 On Mon, Jul 23, 2012 at 9:19 AM, James Cox wrote: > Hey, > > in a bunch of the rescues i've recently done, I see a pretty big anti > pattern: tests don't work, and so rather than making them work, the > dev team just comments them out till 'later'. > > Does anyone think it'd be useful/interesting to get a flag for rspec > which would compare lines vs lines-commented, and if the percentage > was higher than xx, it'd issue some kind of warning? > > Best, > james > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dchelimsky at gmail.com Tue Jul 24 01:54:41 2012 From: dchelimsky at gmail.com (David Chelimsky) Date: Mon, 23 Jul 2012 20:54:41 -0500 Subject: [rspec-users] A recently observed anti pattern: commented out tests In-Reply-To: References: Message-ID: On Mon, Jul 23, 2012 at 11:19 AM, James Cox wrote: > Hey, > > in a bunch of the rescues i've recently done, I see a pretty big anti > pattern: tests don't work, and so rather than making them work, the > dev team just comments them out till 'later'. > > Does anyone think it'd be useful/interesting to get a flag for rspec > which would compare lines vs lines-commented, and if the percentage > was higher than xx, it'd issue some kind of warning? The pending feature is designed to help with this problem by allowing you to disable an example while still keeping it visible. If we were to do what you propose, we'd need to offer an opt-out and/or the ability to configure the percentage. Consider a suite that uses a lot of comments to annotate the specs. The problem with making it configurable is that the folks who's priorities lead them to comment out examples instead of fixing them will likely just disable this feature. I'd say, let's encourage people to use 'pending' correctly. WDYT? Cheers, David From jko170 at gmail.com Tue Jul 24 02:50:58 2012 From: jko170 at gmail.com (Justin Ko) Date: Mon, 23 Jul 2012 20:50:58 -0600 Subject: [rspec-users] RSpec/rails & Capybara: #within In-Reply-To: References: Message-ID: <0AAF94B2-449F-41F3-ADEA-30B7274957AF@gmail.com> 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_string)` trick? > > When describe a view, I want something like that: > describe "path/to/view.html.erb" do > it "should pass" do > render > within('form#id') { > should have_selector 'input', type: 'submit' > should have_selector 'input', type: 'text', value: 'default' > # ... > } > end > end > > PS: Hope this is the right sections! ^^" > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users Please post this to the Capybara group, thanks. https://groups.google.com/forum/?fromgroups#!forum/ruby-capybara From adam.sroka at gmail.com Tue Jul 24 02:58:58 2012 From: adam.sroka at gmail.com (Adam Sroka) Date: Mon, 23 Jul 2012 22:58:58 -0400 Subject: [rspec-users] A recently observed anti pattern: commented out tests In-Reply-To: References: Message-ID: I haven't posted in a while, but I want to say that as someone who spends a significant portion of his time teaching (T/B)DD I am totally in love with pending specs. There are analogous concepts in nearly every xUnit/xSpec, but pending is by far the best. Kudos. On Jul 23, 2012 9:57 PM, "David Chelimsky" wrote: > On Mon, Jul 23, 2012 at 11:19 AM, James Cox wrote: > > Hey, > > > > in a bunch of the rescues i've recently done, I see a pretty big anti > > pattern: tests don't work, and so rather than making them work, the > > dev team just comments them out till 'later'. > > > > Does anyone think it'd be useful/interesting to get a flag for rspec > > which would compare lines vs lines-commented, and if the percentage > > was higher than xx, it'd issue some kind of warning? > > The pending feature is designed to help with this problem by allowing > you to disable an example while still keeping it visible. > > If we were to do what you propose, we'd need to offer an opt-out > and/or the ability to configure the percentage. Consider a suite that > uses a lot of comments to annotate the specs. The problem with making > it configurable is that the folks who's priorities lead them to > comment out examples instead of fixing them will likely just disable > this feature. > > I'd say, let's encourage people to use 'pending' correctly. WDYT? > > Cheers, > David > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jko170 at gmail.com Tue Jul 24 03:08:34 2012 From: jko170 at gmail.com (Justin Ko) Date: Mon, 23 Jul 2012 21:08:34 -0600 Subject: [rspec-users] Unable to Run 'bundle exec cucumber' In-Reply-To: References: Message-ID: <76B7672C-8B49-4C08-A64C-78FBEA02AC02@gmail.com> 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/1.8/gems/gherkin-2.2.9-x86-mingw32/lib/gherkin/lexer/i18n_lexer.rb:23: > [BUG] Segmentation fault > ruby 1.8.7 (2012-06-29 patchlevel 370) [i386-mingw32] > > > Thanks > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users Please post this to the Cucumber group, thanks. https://groups.google.com/forum/?fromgroups#!forum/cukes From james at imaj.es Tue Jul 24 17:55:57 2012 From: james at imaj.es (James Cox) Date: Tue, 24 Jul 2012 13:55:57 -0400 Subject: [rspec-users] A recently observed anti pattern: commented out tests In-Reply-To: References: Message-ID: Yeah, I love pending too. but it doesn't help me get a sense of the state of a suite before I start. now it's part of my practice to go in and find out how much is commented out. David, three concerns with pending as an option: a. it won't help the people who think it's ok to comment out whole tests. If you make that choice it's not a good thing (?). I don't think there's enough evangelism in the world to change them. b. how do you distinguish between a pending and a broken-but-fixing test? one means, "i've got no coverage here, and i haven't thought about it' whereas the other says, 'i used to have coverage, and i need to fix it'. I know it's semantics, but that's important here: i need to know where no effort for testing has been made vs where testing existed (which may imply some domain knowledge which was at one point true). c. if you see # it 'should ?' or similar, that's a commented test, not a test comment. This metric is always going to be loose? but it may give an indication, a sniff test. some kind of idea of what the state of a test is. It's the same as running rake stats - you and I know it's a bullshit metric (it can't possibly tell me how good the tests are), but it tells me at least if any effort to test has happened. Then, I run coverage and figure out how exercised the code is.. somewhere along that line, it'd be good to know if there used to be tests but they are commented out. an anecdote? i experienced this recently with a project, and a significant majority of the tests were just commented out. They used to work, and a lot of it modeled the domain reasonably well - but either due to a breaking gem upgrade or a refactor or something - the original dev just didn't move/fix the test. So, on the face of it, the test scenario looked horrible, but in the end, for the key components, fixing the tests wasn't that painful. Regardless, I got a pretty fast sense of how much water he was treading at the time (or, how much he was under it :/) so yes, pending is ok, but a second keyword "broken" might be nicer, which would act the same but output different info. -james On Mon, Jul 23, 2012 at 10:58 PM, Adam Sroka wrote: > I haven't posted in a while, but I want to say that as someone who spends a > significant portion of his time teaching (T/B)DD I am totally in love with > pending specs. There are analogous concepts in nearly every xUnit/xSpec, but > pending is by far the best. Kudos. > > On Jul 23, 2012 9:57 PM, "David Chelimsky" wrote: >> >> On Mon, Jul 23, 2012 at 11:19 AM, James Cox wrote: >> > Hey, >> > >> > in a bunch of the rescues i've recently done, I see a pretty big anti >> > pattern: tests don't work, and so rather than making them work, the >> > dev team just comments them out till 'later'. >> > >> > Does anyone think it'd be useful/interesting to get a flag for rspec >> > which would compare lines vs lines-commented, and if the percentage >> > was higher than xx, it'd issue some kind of warning? >> >> The pending feature is designed to help with this problem by allowing >> you to disable an example while still keeping it visible. >> >> If we were to do what you propose, we'd need to offer an opt-out >> and/or the ability to configure the percentage. Consider a suite that >> uses a lot of comments to annotate the specs. The problem with making >> it configurable is that the folks who's priorities lead them to >> comment out examples instead of fixing them will likely just disable >> this feature. >> >> I'd say, let's encourage people to use 'pending' correctly. WDYT? >> >> Cheers, >> David >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users -- James Cox, Consultant, Raconteur, Photographer, Entrepreneur t: +1 347 433 0567 e: james at imaj.es w: http://imaj.es/ talk: http://twitter.com/imajes photos: http://500px.com/imajes From cflipse at gmail.com Tue Jul 24 20:54:31 2012 From: cflipse at gmail.com (Chris Flipse) Date: Tue, 24 Jul 2012 16:54:31 -0400 Subject: [rspec-users] A recently observed anti pattern: commented out tests In-Reply-To: References: Message-ID: On Tue, Jul 24, 2012 at 1:55 PM, James Cox wrote: > so yes, pending is ok, but a second keyword "broken" might be nicer, > which would act the same but output different info.-- > There is a block form of pending. It actually executes the contents of the block, but outputs as a pending test -- unless the test passes, in which case it fails with a differing message: it "is a broken test that I need to fix sometime" do pending("broke on nonesuch upgrade") { domain.do_failing_thing } end So, that shows up in test output just like every other pending note. Whenever someone gets around to fixing whatever failed, the contents of the block start passing -- and the test will fail. The failure is a signal to remove the pending block from around the test. This may not be as helpful as you like, if it's drowning in a sea of true "pending" tests ... but I feel that leaving unimplemented, pending tests in the suite for a long time is a Bad Thing -- precisely because you loose useful information like this. :wq -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam.sroka at gmail.com Wed Jul 25 03:31:40 2012 From: adam.sroka at gmail.com (Adam Sroka) Date: Tue, 24 Jul 2012 23:31:40 -0400 Subject: [rspec-users] A recently observed anti pattern: commented out tests In-Reply-To: References: Message-ID: AFAIK, there is no framework or tool that can prevent people from doing stupid things. I actually only use pending for one thing: in the morning it reminds me where I was heading the prior evening. On Jul 24, 2012 1:57 PM, "James Cox" wrote: > Yeah, I love pending too. but it doesn't help me get a sense of the > state of a suite before I start. now it's part of my practice to go in > and find out how much is commented out. > > David, > > three concerns with pending as an option: > > a. it won't help the people who think it's ok to comment out whole > tests. If you make that choice it's not a good thing (?). I don't > think there's enough evangelism in the world to change them. > > b. how do you distinguish between a pending and a broken-but-fixing > test? one means, "i've got no coverage here, and i haven't thought > about it' whereas the other says, 'i used to have coverage, and i need > to fix it'. I know it's semantics, but that's important here: i need > to know where no effort for testing has been made vs where testing > existed (which may imply some domain knowledge which was at one point > true). > > c. if you see # it 'should ?' or similar, that's a commented test, not > a test comment. This metric is always going to be loose? but it may > give an indication, a sniff test. some kind of idea of what the state > of a test is. It's the same as running rake stats - you and I know > it's a bullshit metric (it can't possibly tell me how good the tests > are), but it tells me at least if any effort to test has happened. > Then, I run coverage and figure out how exercised the code is.. > somewhere along that line, it'd be good to know if there used to be > tests but they are commented out. > > > an anecdote? i experienced this recently with a project, and a > significant majority of the tests were just commented out. They used > to work, and a lot of it modeled the domain reasonably well - but > either due to a breaking gem upgrade or a refactor or something - the > original dev just didn't move/fix the test. So, on the face of it, the > test scenario looked horrible, but in the end, for the key components, > fixing the tests wasn't that painful. Regardless, I got a pretty fast > sense of how much water he was treading at the time (or, how much he > was under it :/) > > so yes, pending is ok, but a second keyword "broken" might be nicer, > which would act the same but output different info. > > -james > > On Mon, Jul 23, 2012 at 10:58 PM, Adam Sroka wrote: > > I haven't posted in a while, but I want to say that as someone who > spends a > > significant portion of his time teaching (T/B)DD I am totally in love > with > > pending specs. There are analogous concepts in nearly every xUnit/xSpec, > but > > pending is by far the best. Kudos. > > > > On Jul 23, 2012 9:57 PM, "David Chelimsky" wrote: > >> > >> On Mon, Jul 23, 2012 at 11:19 AM, James Cox wrote: > >> > Hey, > >> > > >> > in a bunch of the rescues i've recently done, I see a pretty big anti > >> > pattern: tests don't work, and so rather than making them work, the > >> > dev team just comments them out till 'later'. > >> > > >> > Does anyone think it'd be useful/interesting to get a flag for rspec > >> > which would compare lines vs lines-commented, and if the percentage > >> > was higher than xx, it'd issue some kind of warning? > >> > >> The pending feature is designed to help with this problem by allowing > >> you to disable an example while still keeping it visible. > >> > >> If we were to do what you propose, we'd need to offer an opt-out > >> and/or the ability to configure the percentage. Consider a suite that > >> uses a lot of comments to annotate the specs. The problem with making > >> it configurable is that the folks who's priorities lead them to > >> comment out examples instead of fixing them will likely just disable > >> this feature. > >> > >> I'd say, let's encourage people to use 'pending' correctly. WDYT? > >> > >> Cheers, > >> David > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-users at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > -- > James Cox, > Consultant, Raconteur, Photographer, Entrepreneur > t: +1 347 433 0567 e: james at imaj.es w: http://imaj.es/ > talk: http://twitter.com/imajes photos: http://500px.com/imajes > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From ckponnappa at gmail.com Wed Jul 25 06:34:23 2012 From: ckponnappa at gmail.com (Sidu Ponnappa) Date: Wed, 25 Jul 2012 12:04:23 +0530 Subject: [rspec-users] A recently observed anti pattern: commented out tests In-Reply-To: References: Message-ID: I'd suggest adding a coverage ratchet to your build. It's the most effective (if occasionally annoying) tool when dealing with such situations. Some assumptions: * You need a CI server and everyone's using CCMenu/Buildnotify so the team knows as soon as the build breaks * You don't have a brittle build that's red a non-trivial portion of the time (not unusual when you inherit a test-less codebase and start adding Cukes to introduce sanity) * Your team is now used to the "drop everything if the build is red and fix it" rule I should really extract the ratchet I've hand-rolled for RSpec on Goldberg into something reusable. Best, Sidu. http://c42.in http://sidu.in On 25 July 2012 09:01, Adam Sroka wrote: > AFAIK, there is no framework or tool that can prevent people from doing > stupid things. > > I actually only use pending for one thing: in the morning it reminds me > where I was heading the prior evening. > > On Jul 24, 2012 1:57 PM, "James Cox" wrote: >> >> Yeah, I love pending too. but it doesn't help me get a sense of the >> state of a suite before I start. now it's part of my practice to go in >> and find out how much is commented out. >> >> David, >> >> three concerns with pending as an option: >> >> a. it won't help the people who think it's ok to comment out whole >> tests. If you make that choice it's not a good thing (?). I don't >> think there's enough evangelism in the world to change them. >> >> b. how do you distinguish between a pending and a broken-but-fixing >> test? one means, "i've got no coverage here, and i haven't thought >> about it' whereas the other says, 'i used to have coverage, and i need >> to fix it'. I know it's semantics, but that's important here: i need >> to know where no effort for testing has been made vs where testing >> existed (which may imply some domain knowledge which was at one point >> true). >> >> c. if you see # it 'should ?' or similar, that's a commented test, not >> a test comment. This metric is always going to be loose? but it may >> give an indication, a sniff test. some kind of idea of what the state >> of a test is. It's the same as running rake stats - you and I know >> it's a bullshit metric (it can't possibly tell me how good the tests >> are), but it tells me at least if any effort to test has happened. >> Then, I run coverage and figure out how exercised the code is.. >> somewhere along that line, it'd be good to know if there used to be >> tests but they are commented out. >> >> >> an anecdote? i experienced this recently with a project, and a >> significant majority of the tests were just commented out. They used >> to work, and a lot of it modeled the domain reasonably well - but >> either due to a breaking gem upgrade or a refactor or something - the >> original dev just didn't move/fix the test. So, on the face of it, the >> test scenario looked horrible, but in the end, for the key components, >> fixing the tests wasn't that painful. Regardless, I got a pretty fast >> sense of how much water he was treading at the time (or, how much he >> was under it :/) >> >> so yes, pending is ok, but a second keyword "broken" might be nicer, >> which would act the same but output different info. >> >> -james >> >> On Mon, Jul 23, 2012 at 10:58 PM, Adam Sroka wrote: >> > I haven't posted in a while, but I want to say that as someone who >> > spends a >> > significant portion of his time teaching (T/B)DD I am totally in love >> > with >> > pending specs. There are analogous concepts in nearly every xUnit/xSpec, >> > but >> > pending is by far the best. Kudos. >> > >> > On Jul 23, 2012 9:57 PM, "David Chelimsky" wrote: >> >> >> >> On Mon, Jul 23, 2012 at 11:19 AM, James Cox wrote: >> >> > Hey, >> >> > >> >> > in a bunch of the rescues i've recently done, I see a pretty big anti >> >> > pattern: tests don't work, and so rather than making them work, the >> >> > dev team just comments them out till 'later'. >> >> > >> >> > Does anyone think it'd be useful/interesting to get a flag for rspec >> >> > which would compare lines vs lines-commented, and if the percentage >> >> > was higher than xx, it'd issue some kind of warning? >> >> >> >> The pending feature is designed to help with this problem by allowing >> >> you to disable an example while still keeping it visible. >> >> >> >> If we were to do what you propose, we'd need to offer an opt-out >> >> and/or the ability to configure the percentage. Consider a suite that >> >> uses a lot of comments to annotate the specs. The problem with making >> >> it configurable is that the folks who's priorities lead them to >> >> comment out examples instead of fixing them will likely just disable >> >> this feature. >> >> >> >> I'd say, let's encourage people to use 'pending' correctly. WDYT? >> >> >> >> Cheers, >> >> David >> >> _______________________________________________ >> >> rspec-users mailing list >> >> rspec-users at rubyforge.org >> >> http://rubyforge.org/mailman/listinfo/rspec-users >> > >> > >> > _______________________________________________ >> > rspec-users mailing list >> > rspec-users at rubyforge.org >> > http://rubyforge.org/mailman/listinfo/rspec-users >> >> >> >> -- >> James Cox, >> Consultant, Raconteur, Photographer, Entrepreneur >> t: +1 347 433 0567 e: james at imaj.es w: http://imaj.es/ >> talk: http://twitter.com/imajes photos: http://500px.com/imajes >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users From lists at ruby-forum.com Wed Jul 25 07:31:29 2012 From: lists at ruby-forum.com (fox daivsm) Date: Wed, 25 Jul 2012 09:31:29 +0200 Subject: [rspec-users] Strange error when running bundle exec rspec spec In-Reply-To: References: Message-ID: <9137a0815517fed78e35f4aabc37b9ff@ruby-forum.com> I ran into this today but I presume snomys got through it. For others whom may encounter: Remove both the 'features' and 'lib' directories supplied with the blueprint-css folder. rm -r app/assets/stylesheets/*blueprint-css-*/{features,lib}/ Not a professional but I couldn't see the use for either in this portion of the hierarchy. -- Posted via http://www.ruby-forum.com/. From dchelimsky at gmail.com Wed Jul 25 13:12:49 2012 From: dchelimsky at gmail.com (David Chelimsky) Date: Wed, 25 Jul 2012 09:12:49 -0400 Subject: [rspec-users] A recently observed anti pattern: commented out tests In-Reply-To: References: Message-ID: On Tue, Jul 24, 2012 at 1:55 PM, James Cox wrote: > Yeah, I love pending too. but it doesn't help me get a sense of the > state of a suite before I start. now it's part of my practice to go in > and find out how much is commented out. > > David, > > three concerns with pending as an option: > > a. it won't help the people who think it's ok to comment out whole > tests. If you make that choice it's not a good thing (?). I don't > think there's enough evangelism in the world to change them. Those same people will work around whatever we make available to help them. > b. how do you distinguish between a pending and a broken-but-fixing > test? one means, "i've got no coverage here, and i haven't thought > about it' whereas the other says, 'i used to have coverage, and i need > to fix it'. I know it's semantics, but that's important here: i need > to know where no effort for testing has been made vs where testing > existed (which may imply some domain knowledge which was at one point > true). What Chris Flipse said. > c. if you see # it 'should ?' or similar, that's a commented test, not > a test comment. This metric is always going to be loose? but it may > give an indication, a sniff test. some kind of idea of what the state > of a test is. It's the same as running rake stats - you and I know > it's a bullshit metric (it can't possibly tell me how good the tests > are), but it tells me at least if any effort to test has happened. > Then, I run coverage and figure out how exercised the code is.. > somewhere along that line, it'd be good to know if there used to be > tests but they are commented out. "it" is an alias for example, specify, and pending (among others), so we'd have to parse for all of those. > an anecdote? i experienced this recently with a project, and a > significant majority of the tests were just commented out. They used > to work, and a lot of it modeled the domain reasonably well - but > either due to a breaking gem upgrade or a refactor or something - the > original dev just didn't move/fix the test. So, on the face of it, the > test scenario looked horrible, but in the end, for the key components, > fixing the tests wasn't that painful. Regardless, I got a pretty fast > sense of how much water he was treading at the time (or, how much he > was under it :/) > > so yes, pending is ok, but a second keyword "broken" might be nicer, > which would act the same but output different info. You can actually do that! RSpec.configuration do |c| c.alias_example_to :broken, :pending => "Broken" end See http://rubydoc.info/gems/rspec-core/RSpec/Core/ExampleGroup.alias_example_to and https://github.com/rspec/rspec-core/blob/master/lib/rspec/core/example_group.rb#L69-104 HTH, David > > -james > > On Mon, Jul 23, 2012 at 10:58 PM, Adam Sroka wrote: >> I haven't posted in a while, but I want to say that as someone who spends a >> significant portion of his time teaching (T/B)DD I am totally in love with >> pending specs. There are analogous concepts in nearly every xUnit/xSpec, but >> pending is by far the best. Kudos. >> >> On Jul 23, 2012 9:57 PM, "David Chelimsky" wrote: >>> >>> On Mon, Jul 23, 2012 at 11:19 AM, James Cox wrote: >>> > Hey, >>> > >>> > in a bunch of the rescues i've recently done, I see a pretty big anti >>> > pattern: tests don't work, and so rather than making them work, the >>> > dev team just comments them out till 'later'. >>> > >>> > Does anyone think it'd be useful/interesting to get a flag for rspec >>> > which would compare lines vs lines-commented, and if the percentage >>> > was higher than xx, it'd issue some kind of warning? >>> >>> The pending feature is designed to help with this problem by allowing >>> you to disable an example while still keeping it visible. >>> >>> If we were to do what you propose, we'd need to offer an opt-out >>> and/or the ability to configure the percentage. Consider a suite that >>> uses a lot of comments to annotate the specs. The problem with making >>> it configurable is that the folks who's priorities lead them to >>> comment out examples instead of fixing them will likely just disable >>> this feature. >>> >>> I'd say, let's encourage people to use 'pending' correctly. WDYT? >>> >>> Cheers, >>> David >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >> >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > > -- > James Cox, > Consultant, Raconteur, Photographer, Entrepreneur > t: +1 347 433 0567 e: james at imaj.es w: http://imaj.es/ > talk: http://twitter.com/imajes photos: http://500px.com/imajes > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users From member at linkedin.com Wed Jul 25 17:06:58 2012 From: member at linkedin.com (Pedro Brasileiro via LinkedIn) Date: Wed, 25 Jul 2012 17:06:58 +0000 (UTC) Subject: [rspec-users] Join my network on LinkedIn Message-ID: <1881917830.4690389.1343236018556.JavaMail.app@ela4-bed77.prod> LinkedIn ------------ Pedro Brasileiro requested to add you as a connection on LinkedIn: ------------------------------------------ I'd like to add you to my professional network on LinkedIn. Accept invitation from Pedro Brasileiro http://www.linkedin.com/e/c0fwx7-h52o1l6g-2h/IvymfWqycahrnXkIwHGwgZqJcdGopgOdxFyMIpp/blk/I423771584_25/0UcDpKqiRzolZKqiRybmRSrCBvrmRLoORIrmkZt5YCpnlOt3RApnhMpmdzgmhxrSNBszYRcBYQe3kNdPsPczh9bSZ4umcQilF3bP8MejcVe38Vej8LrCBxbOYWrSlI/eml-comm_invm-b-in_ac-inv28/?hs=false&tok=1l1irC3b12CBk1 View profile of Pedro Brasileiro http://www.linkedin.com/e/c0fwx7-h52o1l6g-2h/rso/51101136/ry-u/name/27732274_I423771584_25/?hs=false&tok=0_5G7GHFJ2CBk1 ------------------------------------------ You are receiving Invitation emails. This email was intended for Jakub Arnold. Learn why this is included: http://www.linkedin.com/e/c0fwx7-h52o1l6g-2h/plh/http%3A%2F%2Fhelp%2Elinkedin%2Ecom%2Fapp%2Fanswers%2Fdetail%2Fa_id%2F4788/-GXI/?hs=false&tok=0Kv5-qbUl2CBk1 (c) 2012, LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pedrobrasileiro at gmail.com Wed Jul 25 17:51:21 2012 From: pedrobrasileiro at gmail.com (Pedro Brasileiro) Date: Wed, 25 Jul 2012 14:51:21 -0300 Subject: [rspec-users] Join my network on LinkedIn In-Reply-To: <1881917830.4690389.1343236018556.JavaMail.app@ela4-bed77.prod> References: <1881917830.4690389.1343236018556.JavaMail.app@ela4-bed77.prod> Message-ID: <2B38678E-47FB-4528-BEB8-C835910E56F3@gmail.com> Queria pedir desculpas pelo envio desse convite para a lista? Desconsiderem, por favor Pedro Brasileiro Cardoso Junior http://pedrobrasileiro.me On 25/07/2012, at 14:06, Pedro Brasileiro via LinkedIn wrote: > > > > > > > Jakub, > > > Pedro Brasileiro wants to connect with you on LinkedIn. > > Pedro Brasileiro > Software Mobile Developer in HANZO View Profile ? > > Accept > > > > You are receiving Invitation emails. Unsubscribe. > > This email was intended for Jakub Arnold. Learn why we included this. ? 2012, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043, USA > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From kannan.deepak at gmail.com Thu Jul 26 10:07:44 2012 From: kannan.deepak at gmail.com (deepak kannan) Date: Thu, 26 Jul 2012 15:37:44 +0530 Subject: [rspec-users] rspec-rails does not have a matcher for assert_generates Message-ID: hi, rails minitest has assertions for assert_generates, assert_recognizes and assert_routing rpsec's "routes_to" delegates to assert_recognizes http://rubydoc.info/gems/rspec-rails/frames But there is no mention of assert_generates http://api.rubyonrails.org/classes/ActionDispatch/Assertions/RoutingAssertions.html#method-i-assert_generates why does rspec-rails not have a matcher for assert_generates ? i can of-course call 'assert_generates' from rspec -- best, deepak -------------- next part -------------- An HTML attachment was scrubbed... URL: From dchelimsky at gmail.com Thu Jul 26 10:30:00 2012 From: dchelimsky at gmail.com (David Chelimsky) Date: Thu, 26 Jul 2012 06:30:00 -0400 Subject: [rspec-users] rspec-rails does not have a matcher for assert_generates In-Reply-To: References: Message-ID: On Thu, Jul 26, 2012 at 6:07 AM, deepak kannan wrote: > hi, > > rails minitest has assertions for assert_generates, assert_recognizes and > assert_routing > > rpsec's "routes_to" delegates to assert_recognizes > http://rubydoc.info/gems/rspec-rails/frames > > But there is no mention of assert_generates > http://api.rubyonrails.org/classes/ActionDispatch/Assertions/RoutingAssertions.html#method-i-assert_generates > > why does rspec-rails not have a matcher for assert_generates ? I never found assert_generates useful for the way I approach testing. If you give me an example of how/when you'd use it I can try to explain. > i can of-course call 'assert_generates' from rspec > > -- > best, > deepak > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users From femtowin at gmail.com Thu Jul 26 12:22:58 2012 From: femtowin at gmail.com (femto Zheng) Date: Thu, 26 Jul 2012 20:22:58 +0800 Subject: [rspec-users] How do I specify login with controller spec with rspec-rails? In-Reply-To: <310A2309-699B-42E1-A7D8-046B8E17A41C@gmail.com> References: <310A2309-699B-42E1-A7D8-046B8E17A41C@gmail.com> Message-ID: Thanks. Can I add some configuration to include that piece of code to some controller then I didn't to write that kind of code again for each needed authenticated controller? On Wed, Jul 18, 2012 at 11:57 PM, Justin Ko wrote: > > 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 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.(:before_every_example) login something? >> could someone provide some information? thanks. >> >> -- >> http://hi.baidu.com/femto >> http://www.aisiming.com/ >> http://maptu.heroku.com/ >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> >> >> Are you using an authentication gem/engine? >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > > > > -- > http://hi.baidu.com/femto > http://www.aisiming.com/ > http://maptu.heroku.com/ > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > > https://github.com/plataformatec/devise/wiki/_pages > > > https://github.com/plataformatec/devise/wiki/How-To:-Stub-authentication-in-controller-specs > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -- http://hi.baidu.com/femto http://www.aisiming.com/ http://maptu.heroku.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From james at imaj.es Thu Jul 26 20:06:07 2012 From: james at imaj.es (James Cox) Date: Thu, 26 Jul 2012 16:06:07 -0400 Subject: [rspec-users] A recently observed anti pattern: commented out tests In-Reply-To: References: Message-ID: > > > so yes, pending is ok, but a second keyword "broken" might be nicer, > > which would act the same but output different info. > > You can actually do that! > > RSpec.configuration do |c| > c.alias_example_to :broken, :pending => "Broken" > end > > See > http://rubydoc.info/gems/rspec-core/RSpec/Core/ExampleGroup.alias_example_to > and > https://github.com/rspec/rspec-core/blob/master/lib/rspec/core/example_group.rb#L69-104 > > David, i'm going to give that a go - see how it shakes out in real-world use. It might work to visually make it distinguishable enough to process. :) thanks. -james -------------- next part -------------- An HTML attachment was scrubbed... URL: From james at imaj.es Thu Jul 26 20:08:07 2012 From: james at imaj.es (James Cox) Date: Thu, 26 Jul 2012 16:08:07 -0400 Subject: [rspec-users] A recently observed anti pattern: commented out tests In-Reply-To: References: Message-ID: Chris, On Tue, Jul 24, 2012 at 4:54 PM, Chris Flipse wrote: > > > On Tue, Jul 24, 2012 at 1:55 PM, James Cox wrote: > >> so yes, pending is ok, but a second keyword "broken" might be nicer, >> which would act the same but output different info.-- >> > > There is a block form of pending. It actually executes the contents of > the block, but outputs as a pending test -- unless the test passes, in > which case it fails with a differing message: > > it "is a broken test that I need to fix sometime" do > pending("broke on nonesuch upgrade") { > domain.do_failing_thing > } > end > > So, that shows up in test output just like every other pending note. > Whenever someone gets around to fixing whatever failed, the contents of the > block start passing -- and the test will fail. The failure is a signal to > remove the pending block from around the test. > > This may not be as helpful as you like, if it's drowning in a sea of true > "pending" tests ... but I feel that leaving unimplemented, pending tests in > the suite for a long time is a Bad Thing -- precisely because you loose > useful information like this. > One of the examples i've found for commented out tests is when the code plainly doesn't work. Wouldn't it also fail (and output a backtrace) in this instance, therefore thoroughly confusing whoever is observing the test output? I do like the idea of this though: pend it until it passes, and then fail because you should check it, but ? i dont' imagine that it'd really work that way. -james > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dchelimsky at gmail.com Thu Jul 26 20:09:41 2012 From: dchelimsky at gmail.com (David Chelimsky) Date: Thu, 26 Jul 2012 16:09:41 -0400 Subject: [rspec-users] A recently observed anti pattern: commented out tests In-Reply-To: References: Message-ID: On Thu, Jul 26, 2012 at 4:06 PM, James Cox wrote: >> > so yes, pending is ok, but a second keyword "broken" might be nicer, >> > which would act the same but output different info. >> >> You can actually do that! >> >> RSpec.configuration do |c| >> c.alias_example_to :broken, :pending => "Broken" >> end >> >> See >> http://rubydoc.info/gems/rspec-core/RSpec/Core/ExampleGroup.alias_example_to >> and >> https://github.com/rspec/rspec-core/blob/master/lib/rspec/core/example_group.rb#L69-104 >> > > David, i'm going to give that a go - see how it shakes out in real-world > use. It might work to visually make it distinguishable enough to process. :) > thanks. Cool. Please report back if you learn anything interesting. Cheers, David From dchelimsky at gmail.com Thu Jul 26 20:18:06 2012 From: dchelimsky at gmail.com (David Chelimsky) Date: Thu, 26 Jul 2012 16:18:06 -0400 Subject: [rspec-users] A recently observed anti pattern: commented out tests In-Reply-To: References: Message-ID: On Thu, Jul 26, 2012 at 4:08 PM, James Cox wrote: > Chris, > > On Tue, Jul 24, 2012 at 4:54 PM, Chris Flipse wrote: >> >> >> >> On Tue, Jul 24, 2012 at 1:55 PM, James Cox wrote: >>> >>> so yes, pending is ok, but a second keyword "broken" might be nicer, >>> which would act the same but output different info.-- >> >> >> There is a block form of pending. It actually executes the contents of >> the block, but outputs as a pending test -- unless the test passes, in which >> case it fails with a differing message: >> >> it "is a broken test that I need to fix sometime" do >> pending("broke on nonesuch upgrade") { >> domain.do_failing_thing >> } >> end >> >> So, that shows up in test output just like every other pending note. >> Whenever someone gets around to fixing whatever failed, the contents of the >> block start passing -- and the test will fail. The failure is a signal to >> remove the pending block from around the test. >> >> This may not be as helpful as you like, if it's drowning in a sea of true >> "pending" tests ... but I feel that leaving unimplemented, pending tests in >> the suite for a long time is a Bad Thing -- precisely because you loose >> useful information like this. > > > One of the examples i've found for commented out tests is when the code > plainly doesn't work. Wouldn't it also fail (and output a backtrace) in this > instance, therefore thoroughly confusing whoever is observing the test > output? I do like the idea of this though: pend it until it passes, and then > fail because you should check it, but ? i dont' imagine that it'd really > work that way. No - this form passes if there is either an error or a failed expectation (which is also an error, but internal to rspec). It will only fail when the code works without event. This means that if the code doesn't actually do anything it all, it will fail, but that never happens in practice in my experience. From lists at ruby-forum.com Fri Jul 27 05:31:03 2012 From: lists at ruby-forum.com (bill gate) Date: Fri, 27 Jul 2012 07:31:03 +0200 Subject: [rspec-users] Rspec: How to mock class method Message-ID: <30c3c623046eb30733b90c60e03896b3@ruby-forum.com> Hi, I have two model: Message, User message.rb ``` class Message < ActiveRecord::Base class << self def method_a(args) [1,2] end end end ``` user.rb ``` class User < ActiveRecord::Base def method_user if Message.method_a('anythings') #... some code end end end ``` I want to test method_user,but I don't want to test Message#method_a How I can mock Message with method_a? Thanks! -- Posted via http://www.ruby-forum.com/. From basv at odd-e.com Fri Jul 27 06:04:20 2012 From: basv at odd-e.com (Bas Vodde) Date: Fri, 27 Jul 2012 14:04:20 +0800 Subject: [rspec-users] Rspec: How to mock class method In-Reply-To: <30c3c623046eb30733b90c60e03896b3@ruby-forum.com> References: <30c3c623046eb30733b90c60e03896b3@ruby-forum.com> Message-ID: <75257904-A285-498A-8CD9-7F70C8BDD586@odd-e.com> Hi, How about: Message.should_receive(:Message.method_a).with(xxx).and_return(true) Bas On 27-Jul-2012, at 1:31 PM, bill gate wrote: > Hi, I have two model: Message, User > > message.rb > ``` > class Message < ActiveRecord::Base > class << self > def method_a(args) > [1,2] > end > end > end > ``` > > user.rb > ``` > class User < ActiveRecord::Base > def method_user > if Message.method_a('anythings') > #... some code > end > end > end > ``` > I want to test method_user,but I don't want to test Message#method_a > How I can mock Message with method_a? > > Thanks! > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users From srshti at gmail.com Fri Jul 27 06:42:56 2012 From: srshti at gmail.com (Srushti Ambekallu) Date: Fri, 27 Jul 2012 12:12:56 +0530 Subject: [rspec-users] Rspec: How to mock class method In-Reply-To: <75257904-A285-498A-8CD9-7F70C8BDD586@odd-e.com> References: <30c3c623046eb30733b90c60e03896b3@ruby-forum.com> <75257904-A285-498A-8CD9-7F70C8BDD586@odd-e.com> Message-ID: <9D5164E4-71B1-492A-A327-44591DE95C7B@gmail.com> On 27-Jul-2012, at 11:34 AM, Bas Vodde wrote: > > Hi, > > How about: > > Message.should_receive(:Message.method_a).with(xxx).and_return(true) I think that ought to be: Message.should_receive(:method_a).with(xxx).and_return(true) > > Bas > > On 27-Jul-2012, at 1:31 PM, bill gate wrote: > >> Hi, I have two model: Message, User >> >> message.rb >> ``` >> class Message < ActiveRecord::Base >> class << self >> def method_a(args) >> [1,2] >> end >> end >> end >> ``` >> >> user.rb >> ``` >> class User < ActiveRecord::Base >> def method_user >> if Message.method_a('anythings') >> #... some code >> end >> end >> end >> ``` >> I want to test method_user,but I don't want to test Message#method_a >> How I can mock Message with method_a? >> >> Thanks! >> >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users I think the thing people don't usually realise is classes in Ruby are also objects in their own right. So, whatever you can do to any other object, you can do to a class. Thanks, Srushti http://c42.in From basv at odd-e.com Fri Jul 27 06:45:03 2012 From: basv at odd-e.com (Bas Vodde) Date: Fri, 27 Jul 2012 14:45:03 +0800 Subject: [rspec-users] Rspec: How to mock class method In-Reply-To: <9D5164E4-71B1-492A-A327-44591DE95C7B@gmail.com> References: <30c3c623046eb30733b90c60e03896b3@ruby-forum.com> <75257904-A285-498A-8CD9-7F70C8BDD586@odd-e.com> <9D5164E4-71B1-492A-A327-44591DE95C7B@gmail.com> Message-ID: Indeed it should be :) Tnx. Bas On 27-Jul-2012, at 2:42 PM, Srushti Ambekallu wrote: > On 27-Jul-2012, at 11:34 AM, Bas Vodde wrote: > >> >> Hi, >> >> How about: >> >> Message.should_receive(:Message.method_a).with(xxx).and_return(true) > > I think that ought to be: > Message.should_receive(:method_a).with(xxx).and_return(true) > >> >> Bas >> >> On 27-Jul-2012, at 1:31 PM, bill gate wrote: >> >>> Hi, I have two model: Message, User >>> >>> message.rb >>> ``` >>> class Message < ActiveRecord::Base >>> class << self >>> def method_a(args) >>> [1,2] >>> end >>> end >>> end >>> ``` >>> >>> user.rb >>> ``` >>> class User < ActiveRecord::Base >>> def method_user >>> if Message.method_a('anythings') >>> #... some code >>> end >>> end >>> end >>> ``` >>> I want to test method_user,but I don't want to test Message#method_a >>> How I can mock Message with method_a? >>> >>> Thanks! >>> >>> -- >>> Posted via http://www.ruby-forum.com/. >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > I think the thing people don't usually realise is classes in Ruby are also objects in their own right. So, whatever you can do to any other object, you can do to a class. > > Thanks, > Srushti > http://c42.in > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users From me at jbrains.ca Fri Jul 27 17:31:13 2012 From: me at jbrains.ca (J. B. Rainsberger) Date: Fri, 27 Jul 2012 14:31:13 -0300 Subject: [rspec-users] A recently observed anti pattern: commented out tests In-Reply-To: References: Message-ID: On Mon, Jul 23, 2012 at 10:54 PM, David Chelimsky wrote: > I'd say, let's encourage people to use 'pending' correctly. WDYT? +1. -- J. B. (Joe) Rainsberger :: http://www.jbrains.ca :: http://blog.thecodewhisperer.com Author, JUnit Recipes Free Your Mind to Do Great Work :: http://www.freeyourmind-dogreatwork.com