Re: [rspec-users] [ANN] Welcome Chad, Pat, Justin, and Myron!
Congratulations, guys and Thank You! On Mar 1, 2011, at 8:46 AM, David Chelimsky wrote: > I'm very pleased to announce the reformation of a core RSpec development team: > > Chad Humphries, a.k.a. spicycode, has been involved with RSpec since the 1.0 > release, which he helped to usher out the door at RailsConf 2007. He > subsequently authored Micronaut [1], a lightweight, RSpec compatible spec > runner, which later became the basis for the rspec-core gem. > > Pat Maddox has been contributing patches and blogging about RSpec and BDD > since 2007 as well: most notably the =~ matcher for arrays and the last bit > of glue that turned plain text stories in Cucumber's predecessor, the RSpec > Story Runner (which succeeded rbehave) into a reality. > > Justin Ko has been actively contributing patches and participating on the > mailing list since last spring, but is probably best known for his creation > of http://relishapp.com, which now hosts RSpec 2's documentation. > > Myron Marston is the author of VCR [2], and has been contributing to RSpec > since last summer. He has a keen sense of BDD, and his patches continually > impress me with their thoroughness, attention to detail, and understanding of > the wider Ruby ecosystem in which RSpec makes its home. > > Please join me in welcoming Chad, Pat, Justin, and Myron to the RSpec > development team. > > Cheers, > David > > [1] http://github.com/spicycode/micronaut > [2] http://github.com/myronmarston/vcr > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users -- Luke Melia http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] bypass db:test:prepare but still load test db
Hi Charles. We do something like this at Weplay for the same reasons: https://gist.github.com/987543 Maybe that will help. Cheers, Luke -- Luke Melia http://www.lukemelia.com/ On Monday, May 23, 2011 at 4:12 PM, Charles Owen wrote: > I guess another option would be to create our own schema.rb for the > structure of our database and somehow amend the database.rake file to > take this schema.rb instead of the one that gets generated via > migrations. However, I'm not sure how I would do that and even if > that's a good idea. > > -- > Posted via http://www.ruby-forum.com/. > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] bypass db:test:prepare but still load test db
No problem. We have it in lib/tasks/databases.rake. Cheers, Luke -- Luke Melia http://www.lukemelia.com/ On Monday, May 23, 2011 at 4:52 PM, Charles Owen wrote: > Thanks, that is close to what I'm looking for. Where do I put the code > for this, in the rspec.rake or in a separate rake file in my lib/tasks > folder? I'm probably a step above a newbie so sorry if this sounds too > rudimentary. > > -- > Posted via http://www.ruby-forum.com/. > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] bypass db:test:prepare but still load test db
Yeah, you may want to do this: remove_task "db:test:prepare" before you add the new definition of db:test:prepare. Then you can consider uncommenting the line you mentioned, or running rake db:test:prepare manually when you need it. -- Luke Melia http://www.lukemelia.com/ On Monday, May 23, 2011 at 4:56 PM, Charles Owen wrote: > What I had also done is commented this line out of my rspec.rake. > > spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', > 'database.yml')) ? "db:test:prepare" : :noop > > Which I am assuming is running a db:test:prepare as a prerequisite for > running the rspecs. > > So will the new code I write for the db:test:prepare be picked up by > these lines above? > > -- > Posted via http://www.ruby-forum.com/. > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] rspec-2.9.0 is released!
___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Cucumber - stub! or mock?
On Sep 15, 2008, at 4:35 PM, Pat Maddox wrote: I don't think you're really supposed to mock or stub when using cucumber. We need to stub time in some of our scenarios, which exist to to verify behavior over time. We're looking into a before/after to support mocking/stubbing for this scenario. Cheers, Luke -- Luke Melia [EMAIL PROTECTED] http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Cucumber - stub! or mock?
On Sep 30, 2008, at 10:55 AM, Luke Melia wrote: We need to stub time in some of our scenarios, which exist to to verify behavior over time. We're looking into a before/after to support mocking/stubbing for this scenario. Thanks for everyone's thoughts. I understand that mocks are generally an anathema to story tests. We've decided to use them to solve this particular problem, though, and rely on our own self-discipline to not abuse their presence. Here's what we're going with for now in our env.rb: require 'spec/mocks' require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "vendor", "plugins", "rspec", "plugins", "mock_frameworks", "rspec")) include Spec::Plugins::MockFramework Before do setup_mocks_for_rspec end After do begin verify_mocks_for_rspec ensure teardown_mocks_for_rspec end end Luke -- Luke Melia [EMAIL PROTECTED] http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Webrat and submitting a form using an image
On Oct 4, 2008, at 12:09 PM, Fernando Perez wrote: Webrat doesn't seem to be able to handle the submit of a form through an image input. Fernando, this should work, at least in trunk webrat. For example, see the specs near: http://github.com/brynary/webrat/tree/master/spec/api/clicks_button_spec.rb#L337 Are you seeing another behavior? Cheers from NYC, Luke -- Luke Melia [EMAIL PROTECTED] http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Cucumber speed tips
On Dec 27, 2008, at 3:08 AM, Mischa Fierer wrote: You only need to test login for each login case, not for each time you are testing some sort of logged in functionality. In most cases you can just post to sessions/create rather than filling in a login form. I also wanted to speed up the "Given I am a logged in user" type of thing, as you suggested, but took a different, faster approach which may also work for you. I set a cookie to auto-login the user on the next request. Implementation as a gist http://gist.github.com/42973 and below. -Luke features/steps/users_steps.rb: Given "I'm a logged in member" do @me = create_adult logged_in_as @me end features/support/env.rb: class Cucumber::Rails::World ... def logged_in_as(user) cookies['integration_test_user'] = user.id.to_s end ,,, end app/controllers/application.rb class ApplicationController < ActionController::Base ... before_filter :login_integration_test_user, :if => lambda { Rails.env == 'test' } ... def login_integration_test_user return true if cookies['integration_test_user'].blank? integration_test_user_id = cookies['integration_test_user'].to_i if integration_test_user_id != current_user.id reset_session self.current_user = User.find(integration_test_user_id) end cookies['integration_test_user'] = nil end -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Cucumber speed tips
On Dec 28, 2008, at 11:30 AM, Josh Knowles wrote: 4) Distribute your scenarios across multiple processes using TestJour (http://github.com/brynary/testjour) To provide a little more info (Josh and I work with Bryan, who created testjour): we have a cucumber suite currently consisting of 5835 steps that takes a bit under 20 minutes to run without testjour. Running it via testjour with 2 local slaves and 6 remote slaves (2 mac minis and a Mac Pro), the run completes in about 4 minutes. testjour is still a little raw, but I already would not want to work on a large product without it. Luke -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Cucumber speed tips
On Jan 3, 2009, at 9:12 PM, Ben Mabey wrote: The downside with this approach is that it only works with the rails webrat adapter. One solution which I have been meaning to do is to create a UsersSessionManager. The manager would be responsible for logging in all the various roles you use in your app with different webrat sessions (and then caching them.) You could then swap out which session you would be using in your steps... So you could then do something like: logged_in_as 'Admin' do |session| session.click_link 'Foo' ... end Or.. Given /^I am logged in as an '(.+)'$/ |role| login_as role end The 'login_as' would swap out the session that the World object uses so the next steps would be using the appropriate session. WDYT? In general I like the idea, Ben. At weplay, we use webrat to drive rails and selenium, and logged_in_as method has the following implementation in the Selenium world: def logged_in_as(user) visit login_for_test_path(user) end where login_for_test_path is is a named route defined only for the selenium environment that provides a "quick" login of a given user. Would the solution you're thinking of help with this? I'm not sure how you would "cache" a selenium session. -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Cucumber speed tips
On Jan 4, 2009, at 7:08 PM, Ben Mabey wrote: I'm by no means a Selenium expert so I may be making some incorrect assumptions. I thought that it was possible with Selenium to have different sessions open concurrently for the same selenium server. (i.e. have more than one SeleniumDriver/browser instance running against the same server but with different session ids.) Is that not possible? Not that I know of, but now that you mention it, seems like it would be pretty cool. Anyone else on the list done this? -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [Cucumber] Progress Bar
FYI, brynary has a progress formatter in testjour that could probably be ported. On Feb 6, 2009, at 2:43 PM, nicholas a. evans wrote: Yay! Thanks for this. I kept saying "I'll get around to this... tomorrow!" And well... :-) -- Nick On Thu, Feb 5, 2009 at 6:43 PM, Matt Wynne wrote: Inspired by Nick Evans' RSpec progress bar[1], I had a little crack at implementing the progress bar for cucumber, 'cause I want to know how long a break I can take while the features are running :) It's in my fork, in the coverage_formatter branch: http://github.com/mattwynne/cucumber/tree/master It will dump failing feature, scenario, step and the exception as the features run. No specs for it, it's just a spike. [1]http://ekenosen.net/nick/devblog/2008/12/better-progress-bar-for-rspec/ Matt Wynne http://blog.mattwynne.net http://www.songkick.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] [cucumber] Performance of 0.1.99?
Has anyone noticed a slowdown in performance of their cucumber suite from 0.1 to 0.2alpha? I haven't ruled out something in our suite itself, but the slowdown appeared to occur concurrently with our upgrade to 0.2alpha. Cheers, Luke -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [cucumber] Performance of 0.1.99?
On Mar 14, 2009, at 6:06 AM, aslak hellesoy wrote: On Sat, Mar 14, 2009 at 7:00 AM, Luke Melia wrote: Has anyone noticed a slowdown in performance of their cucumber suite from 0.1 to 0.2alpha? I haven't noticed anything. Do you want to create a benchmark? I just ran a subset of our suite with 0.1.x and then with master. Times were pretty close. Guess I need to keep hunting for the culprit. :-) Cheers, Luke -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [Cucumber] Welcome Ben Mabey to the official Cucumber team
On Apr 7, 2009, at 5:19 PM, aslak hellesoy wrote: The core Cucumber team now consists of Joseph Wilk, Ben Mabey and myself. Welcome Ben! Great choice, great team. Thanks for all your hard work, gentlemen. -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] [Cucumber] Fail a scenario from After or AfterStep
I'm trying to make sure that my cucumber selenium suite fails if my Rails app returns any 500 response codes. I'm working on what the best way to identify this state, but the question I'd like to put to the list is this: If I want to check for this error condition in an After or AfterStep, how can I force a failure in the scenario? i.e. something like the following non-functional snippet: AfterStep do |scenario| if foo_error_state_detected? scenario.fail("A foo failure has been detected.") end end Ideas? TIA, Luke -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [Cucumber] Fail a scenario from After or AfterStep
On May 15, 2009, at 4:25 AM, aslak hellesoy wrote: To be honest, I don't remember what happened to AfterStep. I think we had it at some point, but can't see it in the codebase. Did I remove it? Or was that back in the pre-Cucumber days? Help me remember here... I'm not sure. I saw a reference for it on the wiki: [http://wiki.github.com/aslakhellesoy/cucumber/hooks ] and it seemed to fit this problem, but it's not in the version of cucumber we're running. I thought perhaps it was in trunk but it sounds like that's not the case. I'm not so sure I like the idea of AfterStep - smells like a workaround for something that belongs elsewhere. Can't your have selenium-rc (or a helper method you create around it) raise those exceptions? Given /bla/ do # don't remember the API, but you get the idea @browser.goto_strict('/bla') # raises on 500 errors end Yes, I'd prefer to be able to configure selenium-rc to fail on 500s. The problem I ran into is that selenium client doesn't appear to be able to access the HTTP response code. In addition, ajax-y HTTP requests can get kicked off in our app by lots of different things (a click here, a mouseover there, etc). In our suite today, of step matchers will usually fail if a 500 is raised, due to the user-facing impact (e.g. a div is not updated or a form does not appear), but it usually takes us a few minutes to realize that there was a 500 error raised (vs. incorrect javascript, etc.). I am hoping to short-circuit that investigation time and also catch the cases where a 500 is triggered and we don't have a step matcher that fails. The approach is a little smelly to me because it adds a little translucency to what is mostly black-box-testing, but I think it would be a net positive, at least for our app. Cheers, Luke -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [Cucumber] Fail a scenario from After or AfterStep
On May 15, 2009, at 10:16 AM, aslak hellesoy wrote: Can you show me the code you would want to put in AfterStep that would detect a 500 error? I've written a simple piece of rack middleware (included below) that will create a file in the event a 500 is raised. I would clear the file before each scenario and check for it's existence in the AfterStep. For example: Before do File.delete('/tmp/rails.error') if File.exist?('/tmp/rails.error') end AfterStep do |scenario| if File.exist?('/tmp/rails.error') scenario.fail("Failed because app raised a 50x error.") end end Here's the rack piece, for the curious: class RackErrorTouch def initialize(app, options = {}) @app = app @path = options[:path] end def call(env) rack_response = @app.call(env) if rack_response.first >= 500 `touch #...@path}` end rack_response end end -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [Cucumber] Fail a scenario from After or AfterStep
On May 15, 2009, at 3:36 PM, aslak hellesoy wrote: Thanks for doing that. I have one more favour to ask: Can you show me an example of a StepDefinition that would cause the file to be created? That is a tougher question, because any browser interaction that causes an HTTP request to the app under test could result in a server error. Ajax requests can be triggered by javascript, and in various parts of our app, they are triggered by clicking on links, submitting forms, dragging and dropping divs, hovering over a div, waiting for a page load to complete, as a callback from interacting with a 3rd party web service, or waiting for a setTimeout to execute. So one way I could tackle it is to add a step to the end of every scenario that says "Then the application should not have issued any responses with 50x status codes", but that would be a) repetitive, and b) not fail until all steps had run, making it harder to track down the step in the test where the failure occurred. One way to look at may be that I'm trying to enforce an invariant. Under no circumstances in my test suite is it appropriate for my app to raise a 50x error. In my Rails integration suite, webrat enforces this particular invariant for me, but can't find a good hook in the selenium test stack to do this, which is why I'm looking at this route. Cheers, Luke -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [Cucumber] Fail a scenario from After or AfterStep
Any further thoughts on this, Aslak? I'd prefer to go with a solution in line with the future direction of Cucumber if possible. Cheers, Luke On May 15, 2009, at 5:12 PM, Luke Melia wrote: On May 15, 2009, at 3:36 PM, aslak hellesoy wrote: Thanks for doing that. I have one more favour to ask: Can you show me an example of a StepDefinition that would cause the file to be created? That is a tougher question, because any browser interaction that causes an HTTP request to the app under test could result in a server error. Ajax requests can be triggered by javascript, and in various parts of our app, they are triggered by clicking on links, submitting forms, dragging and dropping divs, hovering over a div, waiting for a page load to complete, as a callback from interacting with a 3rd party web service, or waiting for a setTimeout to execute. So one way I could tackle it is to add a step to the end of every scenario that says "Then the application should not have issued any responses with 50x status codes", but that would be a) repetitive, and b) not fail until all steps had run, making it harder to track down the step in the test where the failure occurred. One way to look at may be that I'm trying to enforce an invariant. Under no circumstances in my test suite is it appropriate for my app to raise a 50x error. In my Rails integration suite, webrat enforces this particular invariant for me, but can't find a good hook in the selenium test stack to do this, which is why I'm looking at this route. Cheers, Luke -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [Cucumber] Fail a scenario from After or AfterStep
On May 19, 2009, at 7:04 PM, aslak hellesoy wrote: I'm convinced. We'll add an AfterStep hook. Do you want to give a stab at a patch? Start by writing a feature - see features/after_block_exceptions.feature for a good example of the style we like... Sounds good. I'll give it a whirl tonight. Cheers, Luke Aslak Cheers, Luke On May 15, 2009, at 5:12 PM, Luke Melia wrote: On May 15, 2009, at 3:36 PM, aslak hellesoy wrote: Thanks for doing that. I have one more favour to ask: Can you show me an example of a StepDefinition that would cause the file to be created? That is a tougher question, because any browser interaction that causes an HTTP request to the app under test could result in a server error. Ajax requests can be triggered by javascript, and in various parts of our app, they are triggered by clicking on links, submitting forms, dragging and dropping divs, hovering over a div, waiting for a page load to complete, as a callback from interacting with a 3rd party web service, or waiting for a setTimeout to execute. So one way I could tackle it is to add a step to the end of every scenario that says "Then the application should not have issued any responses with 50x status codes", but that would be a) repetitive, and b) not fail until all steps had run, making it harder to track down the step in the test where the failure occurred. One way to look at may be that I'm trying to enforce an invariant. Under no circumstances in my test suite is it appropriate for my app to raise a 50x error. In my Rails integration suite, webrat enforces this particular invariant for me, but can't find a good hook in the selenium test stack to do this, which is why I'm looking at this route. Cheers, Luke -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [Cucumber] Fail a scenario from After or AfterStep
On May 19, 2009, at 10:43 PM, Luke Melia wrote: On May 19, 2009, at 7:04 PM, aslak hellesoy wrote: I'm convinced. We'll add an AfterStep hook. Do you want to give a stab at a patch? Start by writing a feature - see features/after_block_exceptions.feature for a good example of the style we like... Sounds good. I'll give it a whirl tonight. Here's my first pass: http://github.com/weplay/cucumber/commit/39601bc5eb6f0761dd7bedddc5484cdd895ca787 Not crazy about the way it tracks the current_scenario or the exception_fails_scenario parameter on Hook#execute_in. Unlike Before and After hooks, I think it's preferable for AfterStep to fail the step than to call scenario.fail! Thoughts? Cheers, Luke -- Luke Melia l...@lukemelia.com http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Autotest setup to run Story Runner?
On Aug 14, 2008, at 5:10 PM, Ben Men wrote: ... I think it would still be incredibly useful even if it ran a single scenario every time you edit that scenario - not necessarily the source files that the scenario would "operate" on. You can pull this off pretty easily with rstakeout. Luke -- Luke Melia [EMAIL PROTECTED] http://www.lukemelia.com/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users