Re: [rspec-users] they synonym for it?

2007-07-12 Thread aslak hellesoy
On 7/12/07, Anthony Carlos [EMAIL PROTECTED] wrote:
 If you guys don't mind, I'm going to create a sample web page with
 this concept on it, stealing from Ashley and David's writings. If
 people like it, perhaps we can get it included in the documentation.


Go ahead, that would be great!

Aslak

 On Jul 11, 2007, at 12:35 PM, Ashley Moran wrote:

 
  On 11 Jul 2007, at 17:12, Anthony Carlos wrote:
 
  What do you think?
 
 
  I think there's a lot of merit in that idea.  I've come across loads
  of situations where it was not obvious how to write the specs or code
  so that the code or specs (respectively) are clear and useful.  I'm
  sure they could be distilled to a set of template situations - I'd be
  happy to submit examples.
 
  When people ask what developing with tests is like I tend to say that
  the difference between using RSpec and writing specs is like the
  difference between learning how a paintbrush works and learning how
  to paint a picture.  RSpec's easy enough to pick up, but I wish I
  could point people at a more theoretical how-to that helps with the
  difficult how do I spec this? problems.
 
  Ashley
 
 
 
  ___
  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

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] spec for Rails library

2007-07-13 Thread aslak hellesoy
On 7/13/07, Gregory Murphy [EMAIL PROTECTED] wrote:
 How does one write a spec for a Rails library?


Umm, just like you would for any other Ruby library. Can you be more specific?

Aslak

 // Gregory
 ___
 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] Any liberally-licensed open source projects out there that make good use of RSpec?

2007-08-09 Thread aslak hellesoy
Hi Obie!

Check out Rubinius and Gecode/R (and RSpec hehe)

On 8/9/07, Obie Fernandez [EMAIL PROTECTED] wrote:
 Any idea if it's kosher to include snippets of GPL'd code in a
 commercial publication? MIT license is no problem, but the GPL makes
 me nervous about that.


I, personally, wouldn't want to put a virus in my book, but IANAL.

Aslak

 On 7/31/07, Scott Taylor [EMAIL PROTECTED] wrote:
 
  I've just started DatedBackup (an rsnapshot-like utility), which has
  about 500 LOC at the moment.  It is licensed under the GPL, and has
  190 example specs.  If you are interested, download the trunk from
  Rubyforge:
 
  svn checkout svn://rubyforge.org/var/svn/datedbackup/trunk/
  svn checkout http://datedbackup.rubyforge.org/svn/trunk/
 
  It has a DSL baked in, which I know is up your alley.
 
  Of course, Rspec itself would probably be the model if you needed to
  look at specs.
 
  Best Regards,
 
 
  Scott
 
  On Jul 30, 2007, at 10:48 PM, Obie Fernandez wrote:
 
   I'm trolling for example RSpec code. Any pointers appreciated.
  
   Cheers,
   Obie
   ___
   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
 


 --
 Obie Fernandez
 http://jroller.com/obie/

 Pre-order my book The Rails Way today!
 http://www.amazon.com/dp/0321445619
 ___
 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] Using rcov and ouput to screen

2007-08-11 Thread aslak hellesoy
On 8/11/07, barsalou [EMAIL PROTECTED] wrote:

 Sorry I left off the subject by accident...hopefully this will connect
 to the thread.

 Mike B.
 - Forwarded message from [EMAIL PROTECTED] -
 Date: Fri, 10 Aug 2007 14:33:18 -0800
 From: barsalou [EMAIL PROTECTED]
 Reply-To: barsalou [EMAIL PROTECTED]
   To: rspec-users@rubyforge.org


 Scott said:

  I'd like to output my rcov data to the screen in ascii instead of
  html...is that possible using the rake spec:rcov command?

  Look at the RSpec gem's rdoc.  I believe it is something like
  Rake::RcovTask.  An option can be provided to give rcov options.  Run
   rcov --help.

 This told me I needed the -T option to get what I wanted.

 Just to give a little more detail, I had to modify this file:


 vendor/plugins/rspec_on_rails/tasks/rspec.rake

 and in this section of code:

   desc Run all specs in spec directory with RCov (excluding plugin specs)
   Spec::Rake::SpecTask.new(:rcov) do |t|
 t.spec_opts = ['--options', \#{RAILS_ROOT}/spec/spec.opts\]
 t.spec_files = FileList['spec/**/*_spec.rb']
 t.rcov = true
 t.rcov_opts = ['--exclude', 'spec', '--rails']
   end

 Change this:

 t.rcov_opts = ['--exclude', 'spec', '--rails']

 to this:

 t.rcov_opts = ['--exclude', 'spec', '--rails', '-T']


 Any way to do this by passing a command line arg? like:

 rake spec:rcov -T - This DOESN'T work.


From Spec::Rake::SpecTask's RDoc (on trunk)

A Rake task that runs a set of RSpec contexts.

Example:

  Spec::Rake::SpecTask.new do |t|
t.warning = true
t.rcov = true
  end
This will create a task that can be run with:

  rake spec
If rake is invoked with a SPEC=filename command line option, then
the list of spec files will be overridden to include only the filename
specified on the command line. This provides an easy way to run just
one spec.

If rake is invoked with a SPEC_OPTS=options command line option,
then the given options will override the value of the spec_opts
attribute.

If rake is invoked with a RCOV_OPTS=options command line option,
then the given options will override the value of the rcov_opts
attribute.

Examples:

  rake spec  # run specs normally
  rake spec SPEC=just_one_file.rb# run just one spec file.
  rake spec SPEC_OPTS=--diff   # enable diffing
  rake spec RCOV_OPTS=--aggregate myfile.txt   # see rcov --help for details

Each attribute of this task may be a proc. This allows for lazy
evaluation, which is sometimes handy if you want to defer the
evaluation of an attribute value until the task is run (as opposed to
when it is defined).



 If it bugs me enough, maybe I'll submit a patch that allows an
 rcov.opts file like the spec.opts file. :)


 
  Also, is there somewhere that will allow me to search the mail
  archives...I'm pretty sure someone else has asked similar questions.
 

  Google is your friend.  Rubyforge also has the mailing lists,
  although they aren't searchable.

 Google is such a great resource...with abundant responses!  Sometimes
 this hinders my progress. :)

 Thanks for the hints.

  Scott


 Mike B.

 
 This message was sent using IMP, the Internet Messaging Program.



 - End forwarded message -


 
 This message was sent using IMP, the Internet Messaging Program.

 ___
 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] Problem of using fixture in Rspec

2007-08-13 Thread aslak hellesoy
On 8/13/07, Shaker [EMAIL PROTECTED] wrote:

 Dear Fellows:
 I was using fixtures in the model tests using Rspec. I found that the
 test data specified in the fixtures was stored in the test database once I
 ran the spec and won't be removed anyway. Is my observation correct?

Yes, this is how Rails does it.

 There might be another problem regarding the fixtures. When I ran the
 specs one by one, it was working. However, it failed when I tried to run all
 the specs in one command. It seemed that the test data which was modified by
 one spec caused the other spec which accessed that particular data to fail.
 In other words, the data is actually kind of public to all specs, so the
 specs shares one copy of test data.
 If my observation is correct, are there any ways to overcome these
 problems? Is it possible that each single spec owns its test data so that
 the modifications on the data will not affect other specs?

My hunch is that you'll get the same behaviour with Test::Unit (try it).

You probably need to tell your spec that it must use more fixture
tables, to clean up before each example (it block).

Aslak

 Cheers!
 --
 View this message in context: 
 http://www.nabble.com/Problem-of-using-fixture-in-Rspec-tf4258669.html#a12119520
 Sent from the rspec-users mailing list archive at Nabble.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] Backtrace tweaker - broken or me?

2007-08-13 Thread aslak hellesoy
On 8/13/07, Jay Levitt [EMAIL PROTECTED] wrote:
 Using 1.0.8, I just realized that I've been scrolling through pages of
 backtraces when rspec is supposed to clean them up for me.  This is a
 new development machine, so I'm not sure if older versions worked or
 not.  I'm running Ruby 1.8.6, Rails edge, Mac OS X 10.4.10.

 I've verified that the QuietBacktraceTweaker is the one that's running.
   However, error.backtrace seems to have only one big element in it
 (with multiple lines separated by \n), that whole line gets ignored
 because it matches, and then the whole backtrace gets printed out anyway
 somehow.  I'm heading home and don't have time to dig into it right now,
 but has anyone else seen this?


How can we reproduce it?

Aslak

 Jay Levitt

 ___
 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] Extra Options to Heckle

2007-08-15 Thread aslak hellesoy
On 8/15/07, Scott Taylor [EMAIL PROTECTED] wrote:

 I've tried running Heckle with rspec on some of my classes, but keep
 getting (what I believe to be) an infinite recursion.  Is there some
 way to supply extra options to heckle via. rspec?


Currently not. What options do you want to supply?

Aslak

 Scott

 ___
 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] undefined method `mock_model' for [RSpec example]:#Class:0x25550a8

2007-08-20 Thread aslak hellesoy
On 8/20/07, Jay Levitt [EMAIL PROTECTED] wrote:
  I'd like to avoid that because it would be extra noise and it
  shouldn't be necessary. The generated specs work absolutely perfectly
  for me as/is (I'm on OS X). There have been a couple of bugs related
  to regexps and windows paths over time, but they've either been
  resolved or await more feedback from users in the tracker.
 
  I'm thinking about other ways to be explicit about this (besides the
  verbose :behaviour_type = :view. What if we added methods like:
 
  describe_model
  describe_view
  describe_controller
  describe_helper
 
  Or support the first argument being a Symbol:
 
  describe :model, Thing do

 I'm not clear why we need any new syntax at all - isn't this just a bug
 related to some configurations, if it works for David but not for Zach
 (both on OS X)?


Good point. Let's figure out why it doesn't work for Zach first.

Zach: What's the relative path of the spec? Did you move it after it
was created?

Aslak

 Jay
 
  I'm not sure I like those, but I kind of dislike :behaviour_type =
  :foo as a default.
 
  WDYT?
 
  David
 
 
  Zach
  ___
  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

 ___
 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] using restful_authentication current_user inside controller specs

2007-08-21 Thread aslak hellesoy
@ticket.should_receive(:new).with(@params).and_return(@ticket)

is like saying:

@ticket = @ticket.new(params)

And that, of course, doesn't make much sense. I'll give you a chance
to find the solution yourself ;-)

Aslak

On 8/21/07, Andrew WC Brown [EMAIL PROTECTED] wrote:
 I'm using restful_authentication in my app and I have  the before filters in
 my application rhtml:

 before_filter :login_required
 around_filter :set_timezone
 around_filter :catch_errors

 Currently I have them commented out while rspec'in but I'll need to add them
 in my specs.


   def create
 @ticket = Ticket.new(params[:ticket])
 @ticket.user = current_user
 if @ticket.save
   redirect_to tickets_path
 else
   render new_ticket_path(params[:user_id])
 end
   end

 describe TicketsController, handling POST /tickets do
before do
  @ticket = mock_model(Ticket, :save = true)
  @current_user = mock_model(User)
  @params = {}
end
def do_post
  post :create, :ticket = @params
end
it should create a new ticket and assign current user as ticket's user
 do

 @ticket.should_receive(:new).with(@params).and_return(@ticket)
  assigns[:ticket].user.should equal(@current_user)
  do_post
end
 end

 1)
 NoMethodError in 'TicketsController handling POST /tickets should create a
 new ticket and assign current user as ticket's user'
 You have a nil object when you didn't expect it!
 You might have expected an instance of Array.
 The error occurred while evaluating nil.include?
 /Volumes/EXTERNAL/web/yellowticket/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/assigns_hash_proxy.rb:10:in
 `[]'
 ./spec/controllers/tickets_controller_spec.rb:14:


 My guess is that I'm not allow to do this: assigns[:ticket].user
 How do I apple the assignment with current_user?

 ___
 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] Can Rspec do module spec? What if module uses test data?

2007-08-22 Thread aslak hellesoy
Here is an example from RSpec's own specs:

describe Enumerable do
  def each(block)
[4, 2, 1].each(block)
  end

  it should be included in examples because it is a module do
map{|e| e.to_i}.should == [4,2,1]
  end
end

If you pass the module to describe it will automatically be included
in each of your it blocks, so you're right at home!

HTH,
Aslak

On 8/22/07, Shaker [EMAIL PROTECTED] wrote:

 Dear fellows:
 I am currently working on writing specs on some ruby modules(e.g.
 myModule). At first I try to use script/generate to generate rspec_module,
 but it failed. :-(
 Later I manually created a file (e.g. named myModule_spec.rb) and put
 the 'require spec_helper.rb' as the first line of code followed by
 'describe' block. Luckily, it seemed to be working. But it was not likely to
 be a logical way to generate module specs.
 Question 1:Is there any better way of creating module spec??:confused:
 Anyway, I started to write method specs in these manually created module
 specs, and I found another problem. Module specs do not support 'fixtures'.
 This means that if you test some methods which modify test data in your
 module specs, that data won't be restored after you finish running each
 spec. In other words, all the modules specs actually share a copy of test
 data. This will cause some module specs to fail if other modules do modified
 the shared data beforehand.
 Question 2:What should I do to resolve this problem, making module specs
 access test data independently? :confused:
 --
 View this message in context: 
 http://www.nabble.com/Can-Rspec-do-module-spec--What-if-module-uses-test-data--tf4309226.html#a12267615
 Sent from the rspec-users mailing list archive at Nabble.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] How to spec an attachment_fu model

2007-08-22 Thread aslak hellesoy
On 8/22/07, Matt Lins [EMAIL PROTECTED] wrote:

  First off, I'm not trying to spec attachment_fu, I know it's been tested.

  But, I added some code to that model that I do need to test. Basically, I
 need to somehow fulfill the uploaded_data property so I can actually run
 my tests(otherwise they fail because of validations). The uploaded_data
 field is what would grab the multipart data from form.  Here it is:

# This method handles the uploaded file object.  If you set the field
 name to uploaded_data, you don't need
# any special code in your controller.
#
#   % form_for :attachment, :html = { :multipart = true } do |f|
 -%
# p%= f.file_field :uploaded_data %/p
# p%= submit_tag :Save %
#   % end -%
#
#   @attachment = Attachment.create! params[:attachment]
#
# TODO: Allow it to work with Merb tempfiles too.
def uploaded_data=(file_data)
  return nil if file_data.nil? || file_data.size == 0
  self.content_type = file_data.content_type
  self.filename = file_data.original_filename if
 respond_to?(:filename)
  if file_data.is_a?(StringIO)
file_data.rewind
self.temp_data = file_data.read
  else
self.temp_path = file_data.path
  end
end


I'm not familiar with attachment_fu - is this code from attachment_fu
that you have modified? Or is it your code entirely? Attachment_fu's
entirely? Where does this code come from?

Aslak

  While I was digging I found out that file_data is a ruby Tempfile object.
 So, I tried to create a dummy file and pass it, but it failed. I found out
 in the CGI library, it actually extends the Tempfile object and adds some
 methods/properties. It started to get messy, so I thought I'd ask for
 advice.

  How can I create a valid attachment_fu model spec(so I can start tweaking
 it to test my other validations)?

 ___
 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] How to spec an attachment_fu model

2007-08-22 Thread aslak hellesoy
On 8/22/07, Matt Lins [EMAIL PROTECTED] wrote:

  Sorry, attachment_fu is a plugin for handling binary data. It handles
 storing the file in the file system and storing some helpful data in the
 database about the file.

  The previous code is from the attachment_fu  plugin(no, I didn't modify
 it). This property

What property? The :filename property?

 needs to be satisfied in order for the model to validate.
 So I need to get my model to validate in the spec so I can actually test
 other parts of my model. Here is my model:


Can't you just set the filename property directly from your spec
without going through attachment kung fu?

Aslak

  class Picture  ActiveRecord::Base

has_and_belongs_to_many :products

has_attachment :content_type = 'image/jpeg',
   :storage = :file_system,
   :max_size = 3.megabytes,
   :resize_to = '400x400',
   :thumbnails = {:medium = '200x200', :small =
 '100x100'},
   :path_prefix = 'images/products'

validates_as_attachment

validates_uniqueness_of :filename
validates_presence_of :filename

def before_update
  self.thumbnails.each do |t|
t.filename= thumbnail_name_for(t.thumbnail)
t.save
  end
end

def full_filename(thumbnail = nil)
  file_system_path = (thumbnail ? thumbnail_class :
 self).attachment_options[:path_prefix].to_s
  File.join(RAILS_ROOT, 'public/external', file_system_path,
 thumbnail_name_for(thumbnail) + '.jpg')
end

def public_image
  self.public_filename
end

  end


  aslak hellesoy wrote:
  On 8/22/07, Matt Lins [EMAIL PROTECTED] wrote:


  First off, I'm not trying to spec attachment_fu, I know it's been tested.

  But, I added some code to that model that I do need to test. Basically, I
 need to somehow fulfill the uploaded_data property so I can actually run
 my tests(otherwise they fail because of validations). The uploaded_data
 field is what would grab the multipart data from form. Here it is:

  # This method handles the uploaded file object. If you set the field
 name to uploaded_data, you don't need
  # any special code in your controller.
  #
  # % form_for :attachment, :html = { :multipart = true } do |f|
 -%
  # p%= f.file_field :uploaded_data %/p
  # p%= submit_tag :Save %
  # % end -%
  #
  # @attachment = Attachment.create! params[:attachment]
  #
  # TODO: Allow it to work with Merb tempfiles too.
  def uploaded_data=(file_data)
  return nil if file_data.nil? || file_data.size == 0
  self.content_type = file_data.content_type
  self.filename = file_data.original_filename if
 respond_to?(:filename)
  if file_data.is_a?(StringIO)
  file_data.rewind
  self.temp_data = file_data.read
  else
  self.temp_path = file_data.path
  end
  end


  I'm not familiar with attachment_fu - is this code from attachment_fu
 that you have modified? Or is it your code entirely? Attachment_fu's
 entirely? Where does this code come from?

 Aslak



  While I was digging I found out that file_data is a ruby Tempfile object.
 So, I tried to create a dummy file and pass it, but it failed. I found out
 in the CGI library, it actually extends the Tempfile object and adds some
 methods/properties. It started to get messy, so I thought I'd ask for
 advice.

  How can I create a valid attachment_fu model spec(so I can start tweaking
 it to test my other validations)?

 ___
 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


 ___
 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] How to spec an attachment_fu model

2007-08-22 Thread aslak hellesoy
On 8/22/07, Matt Lins [EMAIL PROTECTED] wrote:

  No, as mentioned in my first post, the property that needs to be fulfilled
 is uploaded_data.  I posted the accessor in my first post as well.


Which part of my answer are you answering no to? Can you inline your
answers so I can follow?


  aslak hellesoy wrote:
  On 8/22/07, Matt Lins [EMAIL PROTECTED] wrote:


  Sorry, attachment_fu is a plugin for handling binary data. It handles
 storing the file in the file system and storing some helpful data in the
 database about the file.

  The previous code is from the attachment_fu plugin(no, I didn't modify
 it). This property

  What property? The :filename property?



  needs to be satisfied in order for the model to validate.
 So I need to get my model to validate in the spec so I can actually test
 other parts of my model. Here is my model:


  Can't you just set the filename property directly from your spec
 without going through attachment kung fu?

 Aslak



  class Picture  ActiveRecord::Base

  has_and_belongs_to_many :products

  has_attachment :content_type = 'image/jpeg',
  :storage = :file_system,
  :max_size = 3.megabytes,
  :resize_to = '400x400',
  :thumbnails = {:medium = '200x200', :small =
 '100x100'},
  :path_prefix = 'images/products'

  validates_as_attachment

  validates_uniqueness_of :filename
  validates_presence_of :filename

  def before_update
  self.thumbnails.each do |t|
  t.filename= thumbnail_name_for(t.thumbnail)
  t.save
  end
  end

  def full_filename(thumbnail = nil)
  file_system_path = (thumbnail ? thumbnail_class :
 self).attachment_options[:path_prefix].to_s
  File.join(RAILS_ROOT, 'public/external', file_system_path,
 thumbnail_name_for(thumbnail) + '.jpg')
  end

  def public_image
  self.public_filename
  end

  end


  aslak hellesoy wrote:
  On 8/22/07, Matt Lins [EMAIL PROTECTED] wrote:


  First off, I'm not trying to spec attachment_fu, I know it's been tested.

  But, I added some code to that model that I do need to test. Basically, I
 need to somehow fulfill the uploaded_data property so I can actually run
 my tests(otherwise they fail because of validations). The uploaded_data
 field is what would grab the multipart data from form. Here it is:

  # This method handles the uploaded file object. If you set the field
 name to uploaded_data, you don't need
  # any special code in your controller.
  #
  # % form_for :attachment, :html = { :multipart = true } do |f|
 -%
  # p%= f.file_field :uploaded_data %/p
  # p%= submit_tag :Save %
  # % end -%
  #
  # @attachment = Attachment.create! params[:attachment]
  #
  # TODO: Allow it to work with Merb tempfiles too.
  def uploaded_data=(file_data)
  return nil if file_data.nil? || file_data.size == 0
  self.content_type = file_data.content_type
  self.filename = file_data.original_filename if
 respond_to?(:filename)
  if file_data.is_a?(StringIO)
  file_data.rewind
  self.temp_data = file_data.read
  else
  self.temp_path = file_data.path
  end
  end


  I'm not familiar with attachment_fu - is this code from attachment_fu
 that you have modified? Or is it your code entirely? Attachment_fu's
 entirely? Where does this code come from?

 Aslak



  While I was digging I found out that file_data is a ruby Tempfile object.
 So, I tried to create a dummy file and pass it, but it failed. I found out
 in the CGI library, it actually extends the Tempfile object and adds some
 methods/properties. It started to get messy, so I thought I'd ask for
 advice.

  How can I create a valid attachment_fu model spec(so I can start tweaking
 it to test my other validations)?

 ___
 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


 ___
 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


 ___
 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] Problem with spec -l

2007-09-07 Thread aslak hellesoy
On 9/7/07, Tom Locke [EMAIL PROTECTED] wrote:
 Hiya

 I used to be able to run a single example with

spec -l line-num spec file

 But now it always just runs 0 tests when I give this option.


It works fine for me, but I'm not sure what version you're referring
to or how to exactly reproduce your situation.

Aslak

 Any ideas?

 Thanks

 Tom
 ___
 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] fixtures in before(:all)

2007-09-08 Thread aslak hellesoy
On 9/7/07, Geoffrey Wiseman [EMAIL PROTECTED] wrote:
 I was planning on using a fixture within a description that didn't modify
 the fixture, so I put it in a before(:all) block:
 describe Customer, xml do
   fixtures :customers

before(:all) do
  one = customers(:one)
   end

   # ...
  As a result, I got this message:

 1)
 NoMethodError in 'Customer xml before(:all)'
 You have a nil object when you didn't expect it!
 You might have expected an instance of Array.
 The error occurred while evaluating nil.[]
 ./spec/models/customer_spec.rb:86:
 script/spec:4:
 If I convert it to before(:each) or simply before, it works just fine.
 describe Customer, xml do
fixtures :customers

before do
  one = customers(:one)
   end

# ...
  By design?  bug?  PEBKAC?  Anyone else hit this?


By design. Fixtures don't work with before(:all). There has been
several discussions about this on the list previously.

Aslak

- Geoffrey
 --
 Geoffrey Wiseman

 ___
 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] fixtures in before(:all)

2007-09-08 Thread aslak hellesoy
On 9/8/07, Scott Taylor [EMAIL PROTECTED] wrote:

 On Sep 7, 2007, at 3:31 PM, Geoffrey Wiseman wrote:

  I was planning on using a fixture within a description that didn't
  modify the fixture, so I put it in a before(:all) block:
  describe Customer, xml do
fixtures :customers
 
before(:all) do
  one = customers(:one)
end
 
# ...
  As a result, I got this message:
 
  1)
  NoMethodError in 'Customer xml before(:all)'
  You have a nil object when you didn't expect it!
  You might have expected an instance of Array.
  The error occurred while evaluating nil.[]
  ./spec/models/customer_spec.rb:86:
  script/spec:4:
  If I convert it to before(:each) or simply before, it works just fine.
  describe Customer, xml do
fixtures :customers
 
before do
  one = customers(:one)
end
 
# ...
  By design?  bug?  PEBKAC?  Anyone else hit this?
 

 Looks like a bug to me, although I don't know why you would want to
 load a fixture only once, and not before every test.  Generally, I
 don't find much use for a before(:all) block (they are discouraged in
 Test::Unit as well, for their unreliable use with more than one test).


Like I said - it's by design.

It's been discussed in previous mail threads.

Aslak

 Scott



 ___
 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] Going beyond the default html formatter/report?

2007-09-09 Thread aslak hellesoy
On 9/9/07, Priit Tamboom [EMAIL PROTECTED] wrote:
 Hi!

 I wonder does anybody planning to go beyond the default html formatter/report?

 The current html report is nice and green but what about to go a
 little silly and enable also user input. For example to let customer
 to add a new pending spec, comments etc. I feel it might be mentally
 easier for some customers to jump into spec world when it is possible
 to give input at the same place.

 Integrate to trac or very lightweight standalone stuff. However it
 should not be trac reinventing effort.

 I haven't use rspec with customer yet but planning to do so with next
 project, so I might overreact about this matter right now.


This sounds like a fantastic idea. Why don't you give it a shot?

Aslak


 Priit
 ___
 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] Failing to raise an exception in a stub

2007-09-13 Thread aslak hellesoy
On 9/13/07, Jarkko Laine [EMAIL PROTECTED] wrote:
 I've come across rather strange behaviour when trying to raise an
 exception in a stubbed method.

 I'm speccing the behaviour of a Rails create action, where I'm using
 save! to catch failed saves. In the case of working save, I'm using
 the following stub:

  @client.stub!(:save!).and_return(true)

 which works fine.

 However, in the negative case,

  @client.stub!(:save!).and_raise(ActiveRecord::RecordInvalid)


Passing a class only works if the new method takes 0 args. Otherwise
you have to pass an exception instance. ActiveRecord::RecordInvalid
takes one.

@client.stub!(:save!).and_raise(ActiveRecord::RecordInvalid.new(@client))

 The save! call in the controller doesn't seem to work. I get the
 following error:

 ArgumentError in 'ClientsController POST /clients with invalid
 parameters should show new form again'
 wrong number of arguments (0 for 1)
 /Users/jarkko/Sites/koulutusweb/app/controllers/clients_controller.rb:
 41:in `create'

 The line #41 consists only of

  @client.save!

 I'm at a loss seeing where the wrong number of arguments is really
 happening because save! certainly shouldn't assume any args.
 Moreover, both cases work fine in the real app, so it seems to me
 something funky is happening when stubbing the method.

 Anyone else stumbled upon anything similar?

 Cheers,
 //jarkko

 --
 Jarkko Laine
 http://jlaine.net
 http://dotherightthing.com
 http://www.railsecommerce.com
 http://odesign.fi



 ___
 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] rake spec:doc returns NO NAME (due to --dry-run) for each specify block

2007-09-16 Thread aslak hellesoy
This happens if you have it blocks with no name. RSpec tries to
generate names based on the code inside, but with dry run it isn't
executed, so it can't.

But maybe you don't have empty it blocks? I'm just guessing here...

Aslak

On 9/16/07, Christopher D. Pratt [EMAIL PROTECTED] wrote:
 I went ahead and moved to the trunk versions of RSpec and Spec:Rails because
 I wanted to try out the new Story Runner feature. However, when I tried to
 do rake spec:doc, I got the following:

 AccountController
 - NO NAME (Because of --dry-run)

 AccountHelper
 - NO NAME (Because of --dry-run)

 User (in general)
 - NO NAME (Because of --dry-run)
 - NO NAME (Because of --dry-run)
 - NO NAME (Because of --dry-run)
 - NO NAME (Because of --dry-run)
 - NO NAME (Because of --dry-run)
 - NO NAME (Because of --dry-run)

 I emptied everything out of my spec.opts file just to make sure it wasn't
 some setting there causing problems, but that still had no effect. I haven't
 submitted this as a bug yet because I'm still holding out the possibility
 that I'm simply doing something wrong.

 Thanks,

 Chris Pratt

 ___
 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] rake spec:doc returns NO NAME (due to --dry-run) for each specify block

2007-09-17 Thread aslak hellesoy
On 9/17/07, Christopher D. Pratt [EMAIL PROTECTED] wrote:
 Thanks for all the responses. Unfortunately, I apparently just like being
 difficult.

 Tom: I installed the new version of rspec on a fresh app, so the first run
 of  script/generate rspec was from the trunk version ... good idea though,
 because it sounds like something I would have done

 -

 David: all of my specify blocks have the string names on them, so that
 doesn't seem like the problem. I also tried running the two commands you
 provided but both returned the following errors:

 $ rake spec --format specdoc
 rake aborted!
 No Rakefile found (looking for: ormat)
 /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1934:in
 `raw_load_rakefile'
 (See full trace by running task with --trace)

 $ rake spec -fs
 rake aborted!
 No Rakefile found (looking for: s)
 /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1934:in
 `raw_load_rakefile'
 (See full trace by running task with --trace)

  Is there some way I can turn off dry run for spec:doc?

 

 Aslak: I'm not relying on auto-generated names. Although I definitely agree
 that spec:doc is acting as if I were

 ---

 Any other ideas? ;)


Help us reproduce what you see

 Thanks,

 Chris Pratt




 On 9/16/07, aslak hellesoy [EMAIL PROTECTED] wrote:
  This happens if you have it blocks with no name. RSpec tries to
  generate names based on the code inside, but with dry run it isn't
  executed, so it can't.
 
  But maybe you don't have empty it blocks? I'm just guessing here...
 
  Aslak
 
  On 9/16/07, Christopher D. Pratt [EMAIL PROTECTED]  wrote:
   I went ahead and moved to the trunk versions of RSpec and Spec:Rails
 because
   I wanted to try out the new Story Runner feature. However, when I tried
 to
   do rake spec:doc, I got the following:
  
   AccountController
   - NO NAME (Because of --dry-run)
  
   AccountHelper
   - NO NAME (Because of --dry-run)
  
   User (in general)
   - NO NAME (Because of --dry-run)
   - NO NAME (Because of --dry-run)
   - NO NAME (Because of --dry-run)
   - NO NAME (Because of --dry-run)
   - NO NAME (Because of --dry-run)
   - NO NAME (Because of --dry-run)
  
   I emptied everything out of my spec.opts file just to make sure it
 wasn't
   some setting there causing problems, but that still had no effect. I
 haven't
   submitted this as a bug yet because I'm still holding out the
 possibility
   that I'm simply doing something wrong.
  
   Thanks,
  
   Chris Pratt
  
   ___
   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
 


 ___
 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] Standardize environment between specs containing class defs

2007-09-21 Thread aslak hellesoy
You can have a global after block in your spec_helper.rb that
undefines all such constants. Then you just have to remember to add
these constants to some global array whenever you define them.

a

On 9/21/07, Matt Margolis [EMAIL PROTECTED] wrote:
 I have some specs that involve the use of eval and class definitions to
 test code generation.  I want to always start with a clean slate so none
 of my tests fail or succeed incorrectly due to artifacts left over from
 previous specs.

 Example of my situation
   Spec 1 defines
 class Fish
 class Cod  Fish
   Spec 2 defines
 class Animal
 class Cod  Animal

 In this situation the second spec will fail since Cod was previously
 defined to be a subclass of Fish and you can not change the superclass
 of a subclass in ruby without causing an exception.

 I want the resetting to be as automatic as possible since calling
 remove_constant on every class my code defines after each spec is a real
 pain since this situation is going to crop up in lots of different specs
 and describe blocks.

 Thank you,
 Matt Margolis
 ___
 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] rcov including ruby lib

2007-09-24 Thread aslak hellesoy
On 9/24/07, Brandon Keepers [EMAIL PROTECTED] wrote:
 When I run spec:rcov on my continuous integration server, the rcov
 report is including many other libraries in the report, including
 some from standard lib and gems.  Has anyone else had this problem or
 have any ideas for how to limit it just to coverage of code in app/
 and lib/?


Read the RCov manual and pass command line options to it via the RSpec
rake task's rcov_opts attribute.

Aslak

 Thanks,
 Brandon

 ___
 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] specing system

2007-10-13 Thread aslak hellesoy
On 10/13/07, Priit Tamboom [EMAIL PROTECTED] wrote:
 Hi!

 Having some wine on Saturday and just playing around writing some ruby script:

 * have you spec any 'system' method? As long I know it just returns
 false or true and everything else is just out of reach; prove me I'm
 wrong :-)

 it 'should have response with 64.233.167.99'

 system 'ping google.com'

 Priit

I'd use IO.popen, or redirect the output of the system call to a file
and look inside that afterwards.

A

 ___
 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] Note on Rails 2.0 Preview

2007-10-29 Thread aslak hellesoy
On 10/29/07, Jamal Soueidan [EMAIL PROTECTED] wrote:
 Steve Ross (CWD) wrote:
  Make sure you get a relatively current version of rspec or you will get:
 
  /Users/me/rails/ubb/vendor/rails/activerecord/lib/../../activesupport/
  lib/active_support/dependencies.rb:263:in `load_missing_constant':
  uninitialized constant ActionView::Helpers::JavaScriptMacrosHelper
  (NameError)
 
  Hope this helps someone.

 This is error I'm getting :)

 and I downloaded the current version, but I still get the error even
 with Rails 1.2.5

 How do I get the relatively current version?

There is a download link on the webpage:
http://rspec.rubyforge.org/download.html


 Thanks for help
 --
 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] no speed up with spec_server

2007-11-01 Thread aslak hellesoy
On 11/1/07, Jeremy Stephens [EMAIL PROTECTED] wrote:
 Hey guys,

 I'm running spec_server and using --drb with my specs in Rails, and
 I'm seeing virtually no speed up.  I'm using rspec/rspec_on_rails
 trunk.  Is there something I'm doing wrong?


It's a regression I'm planning to fix this weekend

Aslak

 TIA,
 Jeremy
 --
 Jeremy Stephens   Computer Systems Analyst ISchool of Medicine
   Department of Biostatistics   Vanderbilt University
 ___
 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] Can't delete app/helpers

2007-11-01 Thread aslak hellesoy
A stacktrace would help

On 11/1/07, Chris Olsen [EMAIL PROTECTED] wrote:
 I would like to remove some unused helpers from the app/helpers dir, but
 when I do so my specs fail.

 Why is this?  I don't see where those helpers are referenced within the
 tests. Is there a way to delete these unused files?

 Thanks
 --
 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] Specifying mixins

2007-11-01 Thread aslak hellesoy
just a short advice:

describe MyModule do
  it should do something do
# The module is automatically mixed into your spec
  end
end

Aslak

On 11/1/07, Tom Stuart [EMAIL PROTECTED] wrote:
 Hi folks,

 Can anyone share some accumulated wisdom about the best way to spec
 mixins in general, and (Jamis Buck-style) ActiveRecord concerns in
 particular?

 The standard situation here is that there's a bunch of functionality,
 related by concept if not by implementation, that one wants to inherit
 in many different classes (e.g. ActiveRecord models) without having to
 actually use subclassing -- straightforward enough. But since BDD best
 practice encourages one expectation per example and no mocking in the
 behaviour setup, the specification for this shared functionality is
 often spread across many behaviours, each of which may need to do its
 own setup and teardown.

 So, how best to mix the mixin spec in with the spec for each class
 that uses the mixin (IYSWIM)? I've tried several permutations of
 helpers, spec mixins, shared-shared behaviours and so on, but can't
 find anything which is persuasively neat and DRY while still working
 reliably. One point of contention is that the mixin's behaviours might
 need to do things like instantiate the target class with specific
 arguments in before :each (or call some other class method, if the
 mixin provides some) so it's not really good enough for the target
 spec to just squirrel away a prebuilt object in an instance variable.

 Any advice, please?

 Cheers,
 -Tom
 ___
 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] autometric gem

2007-11-10 Thread aslak hellesoy
On 11/10/07, Ben Burkert [EMAIL PROTECTED] wrote:
 I'm working on tool to automatically run code metrics in the same way
 as autotest.  It's runs rcov, flog, and saikuro right now, and works
 with rspec and rails.  It's hosted at rubyforge:

 http://rubyforge.org/projects/autometric/

 I've got a post on how to configure it with growl:

 http://benburkert.com/2007/11/9/introducing-autometric

 I'm hoping to get Heckle working soon.


This looks like a neat tool - all in one and easy to set up.

Aslak

 -Ben
 ___
 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] be_success misleading

2007-11-10 Thread aslak hellesoy
be_success has the same semantics (and uses) Response#success? and
that's not our API, but Rails'

If you don't like Rails' semantics you can make your own matcher, but
I don't want to invent a whole new API on top of Rails in the official
Spec::Rails.

Aslak

On Nov 10, 2007 5:31 PM, Steve [EMAIL PROTECTED] wrote:
 Just wondering if anyone else thinks that 'response.should be_success' is
 potentially misleading. If you're writing a spec for an action that is
 failing in some way it can still have a status 200. So while the
 HTTP request was technically successful, something in the action
 was not. Perhaps something like 'response.should have_success_status'?

 Steve

 ___
 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] Autotest with rspec HTML output

2007-11-11 Thread aslak hellesoy
Where would the HTML report be displayed?

On Nov 11, 2007 6:38 AM, Ben Mabey [EMAIL PROTECTED] wrote:
 Hey all,
 I was just wondering if any one has played around with getting
 autotest's rspec integration working with rspec's HTML output.  I really
 like how in the  rspec textmate bundle the context of the failing code
 is inlined with the failing spec along with the exact line highlighted
 and a link to the exact spot in reference.  However, I rarely use this
 nice output since autotest is so convenient... So, I was thinking
 wouldn't it be great to have the best of both worlds? What do you
 think?  And before I try and do this, has anyone else already done it?


 -Ben


 ___
 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] Autotest with rspec HTML output

2007-11-11 Thread aslak hellesoy
On Nov 11, 2007 4:33 PM, Ben Mabey [EMAIL PROTECTED] wrote:

 I was thinking that a little window(cocoa) or maybe just a browser
 window could display the summary of the test run like autotest does and
 then the failed specs in HTML format.  Not the entire HTML report would
 be generated/displayed- only the failing ones would be so it would be
 manageable on projects with large test suites. So, instead of having a
 terminal window open with autotest it would just be a stand alone window.


I think the simplest and best thing here would be a pure browser
solution with autorefresh.
It should only be a matter of tweaking the HTML output a little to:
* Implement autorefresh. Ajax based would require a lite server
(webrick). Or just META refresh would work on the file system.
* Tweak the HTML output to only output the red specs, not the green ones.

I don't like the cocoa idea - too proprietary. The qlmanage wouldn't
provide much value beyond growl bubbles. You wanted to click on the
HTML and go to the editor right?

Aslak


 aslak hellesoy wrote:
  Where would the HTML report be displayed?
 
  On Nov 11, 2007 6:38 AM, Ben Mabey [EMAIL PROTECTED] wrote:
 
  Hey all,
  I was just wondering if any one has played around with getting
  autotest's rspec integration working with rspec's HTML output.  I really
  like how in the  rspec textmate bundle the context of the failing code
  is inlined with the failing spec along with the exact line highlighted
  and a link to the exact spot in reference.  However, I rarely use this
  nice output since autotest is so convenient... So, I was thinking
  wouldn't it be great to have the best of both worlds? What do you
  think?  And before I try and do this, has anyone else already done it?
 
 
  -Ben
 
 
  ___
  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
 

 ___
 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] Who's using --format rdoc

2007-11-11 Thread aslak hellesoy
On Nov 12, 2007 12:45 AM, s.ross [EMAIL PROTECTED] wrote:
 does this mean that:

 rake spec:doc

 will not produce plain text specdocs?


No, spec:doc will remain untouched.

I'm not talking about --format specdoc (which the spec:doc task uses),
but --format rdoc, which is supposed to create RDoc - a file you can
include in your RDocs. Since it's not producing what RDoc needs, I'd
like to retire it.

Aslak



 On Nov 11, 2007, at 3:39 PM, aslak hellesoy wrote:

  I'm doing some housekeeping and just realised that the rdoc formatter
  produces gibberish:
  http://rspec.rubyforge.org/rdoc/files/EXAMPLES_rd.html
 
  Will anyone protest if I just go ahead and remove it? (I can't imagine
  anyone using it, especially with the much better HTML formatter)
 
  Aslak
  ___
  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

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Test case for file import

2007-11-12 Thread aslak hellesoy
On Nov 12, 2007 11:36 AM, KarniRevuri [EMAIL PROTECTED] wrote:

 I want to write below specs

 specify The system allows users to import a pre-formatted CSV file into
 project.
   specify Each row in the spreadsheet is imported as one new Task.
   specify The import WILL NOT update existing tasks.
   specify If the import file has any records that fail due to errors, NONE
 of the records in the import file will be imported.
  specifyThe system will allow users to browse to the import file using
 typical windows file open controls.


 Please give me any ideas


Is this related to the post that you replied to?
Your question is too vague. Can you be more specific about what you
need help with?

Aslak


 Jim Lindley wrote:
 
   Can you show some of your code that needs to be tested?
 
  Actually, we'd hope that the code doesn't exist yet. This is Behaviour
  DRIVEN Development, after all.
 
 
  Old habits, my apologies.
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 
 

 --
 View this message in context: 
 http://www.nabble.com/Test-case-for-file-import-tf4756785.html#a13703316
 Sent from the rspec-users mailing list archive at Nabble.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] Test case for file import

2007-11-13 Thread aslak hellesoy
look at the RDoc for should change...

describe Task do
  fixtures :tasks # should put 2 tasks in the database

  it should not import twice from CSV do
csv = File.dirname(__FILE__) + '/sample.csv' # It should have 4 new tasks
lambda do
  Task.import_from_csv(csv)
end.should change {Task.count}.from(2).to(6)

lambda do
  Task.import_from_csv(csv)
end.should_not change {Task.count}
  end
end

HTH,
Aslak

On 11/13/07, Karni Karni [EMAIL PROTECTED] wrote:
 aslak hellesoy wrote:
  On Nov 12, 2007 11:36 AM, KarniRevuri [EMAIL PROTECTED] wrote:
  typical windows file open controls.
 
 
  Please give me any ideas
 
 
  Is this related to the post that you replied to?
  Your question is too vague. Can you be more specific about what you
  need help with?
 
  Aslak

 Sorry,

 I need write a script for file import in the below situation


 specify The import WILL NOT update existing tasks.

 Precondtions :

 I'm explain about tasks view in my requirment

 There are already some tasks in the database


 Process: there is file import functionality.

 I need to test it. if we import  any records from CSV file it wont
 effect the previous tasks(records)

 Plesase give me u r ideas




 --
 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 on Rails 2.0

2007-11-14 Thread aslak hellesoy
On Nov 14, 2007 8:37 PM, Kyle Hargraves [EMAIL PROTECTED] wrote:
 On Nov 14, 2007 12:32 PM, David Chelimsky [EMAIL PROTECTED] wrote:
  http://rspec.rubyforge.org/documentation/rails/install.html
 
  CURRENT means the latest release, not the trunk. 1.0.8 was out months
  ago - obviously not compatible with subsequent changes to rails.
 
  Cheers,
  David

 I see people make this mistake fairly often. Is there any reason the
 tag shouldn't be renamed to something less counter-intuitive?

 Thinking of FreeBSD's tags, RELEASE perhaps?


LATEST_RELEASE would speak more for itself.

 Kyle

 ___
 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] Down with Lambda!!

2007-11-17 Thread aslak hellesoy
On Nov 18, 2007 12:40 AM, Steven Garcia [EMAIL PROTECTED] wrote:
 Rspec is all about using natural language to define behavior. In this
 context, I feel that lambda is sorely out of place. I was chatting on
 #irc and a pal of mine (wycats) proposed an interesting alternative:

 alias_method :doing, :lambda

 so instead of something like

 lambda {post :create, {:title = nil}}.should
 raise_error(ActiveRecord::RecordInvalid)

 we get

 doing {post :create, {:title = nil}}.should
 raise_error(ActiveRecord::RecordInvalid)

 Now it reads like a sentence..much cleaner and less abstract to those of
 us who are not Ruby wizards (yet)

 Chatting with other folks and they are hyped on the idea.

 What do you guys think?

 Any chance we could get something like this into trunk?

Probably not. There was a longer discussion of it here:
http://rubyforge.org/tracker/index.php?func=detailaid=13837group_id=797atid=3152

As you point out, creating an alias is a one-liner.
The main reason I don't want to add it is that lambda is a common
idiom, and I don't want to set precedence of aliasing core Ruby idioms
just because some people don't like the ones in Ruby.

Aslak

 --
 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] helper methods starting with should

2007-11-18 Thread aslak hellesoy
On Nov 18, 2007 4:59 PM, David Chelimsky [EMAIL PROTECTED] wrote:
 Hi all,

 As an experiment in playing nice with others, we've added the ability
 in rspec's trunk to do this:

 class ThingExamples  Spec::ExampleGroup

   def should_do_stuff
 ...
   end

 end

 This is how rspec 0.1 worked, and for people already comfortable with
 the classes/methods approach of Test::Unit, it is a more comfortable
 entry point to rspec.

 For others, however, it has created a problem: you can't write helper
 methods that start with should_ because rspec treats them as examples.

 Quick show of hands, please:

 +1 (with comments please) for keeping the ability to write examples
 using should_
 -1 (with comments please) for bagging it because you think you should
 be able to write helper methods that start with should_.

-1. I don't want to encourage a third style for examples (#test_* and
RSpec #it is enough). It doesn't bring anything new to the table,
especially
when #it can be used inside TestCase classes.

Aslak


 You may want to peek at the conversation on this ticket before you
 respond: 
 http://rubyforge.org/tracker/?func=detailatid=3149aid=15638group_id=797

 Thanks for playing,
 Cheers,
 David

 ps - In the interest of full disclosure, this is not going to be a
 majority vote. My interest is in making rspec more accessible to
 people who are likely not on this list and whose voices will not be
 heard. I'm just looking to take a pulse from a wider group than the
 few that have commented on the ticket.

 pps - One suggestion that came up was to make this a configuration
 option. I don't love that because it makes rspec more complicated, but
 it's a possibility.
 ___
 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] describe scope

2007-11-21 Thread aslak hellesoy
On 11/21/07, Mark Van De Vyver [EMAIL PROTECTED] wrote:
 Hi,
 Thanks for the prompt responses...

 On Nov 22, 2007 1:18 AM, David Chelimsky [EMAIL PROTECTED] wrote:
  On Nov 21, 2007 1:07 AM, Mark Van De Vyver [EMAIL PROTECTED] wrote:
   Hi,
   Googling 'RSpec describe scope' didn't yield much, so apologies if
   this question has been dealt with.
  
   It seem well known that a ruby class is 'visible' between describes,
   and if this is a problem then you should use some counter as prefix or
   suffix:
   'class Item_001; ... end'
  
   Is there any work underway, or sheduled release where classes will
   exist only in the scope they are defined?
 
  This has never been brought up before. Feel free to submit a feature
  request at http://rspec.lighthouseapp.com/.
 
   Writing spec's for Og is where this becomes an issue because Og will
   grab _all_ manageble objects it can 'see'... all sorts of PITA can
   arise.
 
  I found this:
 
  http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/6924

 I thought to make a feature request with a spec, any comments on why
 the following fails


No idea, because you forgot to attach any output from RSpec ;-)

 # rspec example
 require 'spec'

 module Example
   describe RSpec  do
 before(:each) do
 class ::Item
  attr_accessor :name
 end
 end

 it should not raise error on defined? do
   lambda{defined?(Item)}.should_not raise_error
 end
 it should be defined after being removed do
   defined?(Item).should == constant
 end

 after(:each) do
   Kernel.remove_const(Item)
 end
   end
 end # rspec example


 Appreciate any comments.
 Mark

  So you could, in theory, monkey patch ExampleGroupMethods (in trunk
  2937 - these names are changing a bit, so keep an eye out) to remove
  the defined constant
 
  
   Thanks for all the great work, T/BDD definitely is a brilliant way to
   work, and RSpec makes it painless, esp for us amatuers :)
 
  That's what we want to hear! Thanks.
 
  Cheers,
  David
 
 
  
   Mark
   ___
   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

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Issues related to jruby 1.0.2/edge rails and rspec head

2007-11-22 Thread aslak hellesoy
On Nov 22, 2007 4:50 PM, Stefan Magnus Landrø [EMAIL PROTECTED] wrote:
 Hi,

 We just spent half an afternoon figuring out why jruby -S rake spec didn't
 generate any output at all (no warnings) on an edge rails app. We were
 seeing different behaviour on different boxes, and after a while figured out
 that it was related to a missing diff-lcs gem on one box.


Hey man,

Could you please file a bug report so it stays on our radar?
http://rspec.lighthouseapp.com/

Aslak

 HTH,

 Stefan

 --
 Bekk Open Source
 http://boss.bekk.no
 ___
 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] Possible Problem with RSpec and

2007-11-28 Thread aslak hellesoy
On 11/28/07, Stefan Magnus Landrø [EMAIL PROTECTED] wrote:
 We saw some annoying behavior related to pending tests. Maybe you could
 delete it and rerun your specs?

 An error typically indicates that you have some sort of error in your code -
 failing tests should not cause rake to abort.


It does, and it should. Failures are just as fatal as errors, and
should make rake exit with a non-0.

Aslak

 Stefan

 2007/11/25, James B. Byrne [EMAIL PROTECTED]:
  Sorry to be such a pest but I am trying to learn Ruby, Rails and RSpec all
  at one go and it is a bit overwhelming.  I have previously completed the
  depot tutorial in the Agile Web Dev with rails book and now I am trying do
  do it again using RSpec.
 
  What I would like to know now is why I am getting a rake failure error at
  the end of every spec:models run.  Is this the expected behaviour when a
  test / expectation fails?
 
  ---
 
  C:\var\RSpec\depotrake spec:models
  (in C:/var/RSpec/depot)
  NOTICE:  CREATE TABLE will create implicit sequence products_id_seq for
  serial
  column  products.id
  NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
  products_pkey f
  or table products
 
  Product
  - should have a valid image uri (PENDING: Not Yet Implemented)
  - should have a description
  - should have a title (FAILED - 1)
 
  Pending:
  Product should have a valid image uri (Not Yet Implemented)
 
  1)
  'Product should have a title' FAILED
  expected valid? to return true, got false
  ./spec/models/product_spec.rb:11:
 
  Finished in 0.75 seconds
 
  3 examples, 1 failure, 1 pending
  rake aborted!
  Command ruby -I
  C:/var/RSpec/depot/vendor/plugins/rspec/lib
  C:/var/RSpec/depot/vendor/plugins/rspec/bin/spec
  spec/models/product_spec.rb
  --options
  C:/var/RSpec/depot/config/../spec/spec.opts failed
 
  (See full trace by running task with --trace)
 
  C:\var\RSpec\depotrake spec:models --trace
  (in C:/var/RSpec/depot)
  ** Invoke spec:models (first_time)
  ** Invoke db:test:prepare (first_time)
  ** Invoke environment (first_time)
  ** Execute environment
  ** Execute db:test:prepare
  ** Invoke db:test:clone (first_time)
  ** Invoke db:schema:dump (first_time)
  ** Invoke environment
  ** Execute db:schema:dump
  ** Invoke db:test:purge (first_time)
  ** Invoke environment
  ** Execute db:test:purge
  ** Execute db:test:clone
  ** Invoke db:schema:load (first_time)
  ** Invoke environment
  ** Execute db:schema:load
  NOTICE:  CREATE TABLE will create implicit sequence products_id_seq for
  serial column products.id
  NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
  products_pkey for table products
  ** Execute spec:models
 
  Product
  - should have a valid image uri (PENDING: Not Yet Implemented)
  - should have a description
  - should have a title (FAILED - 1)
 
  Pending:
  Product should have a valid image uri (Not Yet Implemented)
 
  1)
  'Product should have a title' FAILED
  expected valid? to return true, got false
  ./spec/models/product_spec.rb:11:
 
  Finished in 0.563 seconds
 
  3 examples, 1 failure, 1 pending
  rake aborted!
  Command ruby
 -IC:/var/RSpec/depot/vendor/plugins/rspec/lib
  C:/var/RSpec/depot/vendor/plugins/rspec/bin/spec
 spec/models/
  product_spec.rb --options
 C:/var/RSpec/depot/config/../spec/spec.opts
  failed
  C:/var/RSpec/depot/vendor/plugins/rspec/lib/spec/rake/
  spectask.rb:173:in `define'
  C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-
 0.7.3/lib/
  rake.rb:823:in `verbose'
  C:/var/RSpec/depot/vendor/plugins/rspec/lib/spec/rake/
  spectask.rb:142:in `define'
 
 C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/
  rake.rb:392:in `call'
 
 C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/
  rake.rb:392:in `execute'
 
 C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/
  rake.rb:392:in `each'
  C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-
 0.7.3/lib/
  rake.rb:392:in `execute'
 
 C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/
  rake.rb:362:in `invoke'
 
 C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/
  rake.rb:355:in `synchronize'
 
 C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/
  rake.rb:355:in `invoke'
 
 C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/
  rake.rb:1739:in `top_level'
  C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-
 0.7.3/lib/
  rake.rb:1739:in `each'
 
 C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/
  rake.rb:1739:in `top_level'
 
 C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/
  rake.rb:1761:in `standard_exception_handling'
 
 C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/
  rake.rb:1733:in `top_level'
 
 C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/
  rake.rb:1711:in `run'
  C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-
 0.7.3/lib/
  rake.rb:1761:in `standard_exception_handling'
 
 C:/usr/local/bin/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/
  rake.rb:1708:in `run'
 
 

Re: [rspec-users] Possible Problem with RSpec and

2007-11-29 Thread aslak hellesoy
On Nov 29, 2007 11:23 AM, Stefan Magnus Landrø [EMAIL PROTECTED] wrote:
 It seems like setting up expectations in before blocks, in combination with
 a pending example, makes rake return non-0

 We had code similar to this:

 describe Model  do
 before do
   OtherModel.should_receive (:some_method)
 end

 it should whatever do
   pending whatever
 end
 end

 Removing the expectation from the before block, fixed our problem.


Interesting. pending actually raises a special exception that RSpec
catches and reports as a P. But your OtherModel never got the expected
message, so RSpec changes its mind and reports an F instead.

Perhaps we should never report failures for pending examples?

Aslak

 Stefan



 2007/11/28, David Chelimsky [EMAIL PROTECTED]:

  On Nov 28, 2007 2:38 AM, Stefan Magnus Landrø [EMAIL PROTECTED]
 wrote:
   We saw some annoying behavior related to pending tests.
 
  Can you be more specific?
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 




 --
 Bekk Open Source
 http://boss.bekk.no
 ___
 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] Unexpected message on :attr_accessor

2007-12-04 Thread aslak hellesoy
On Dec 4, 2007 8:02 PM, David Chelimsky [EMAIL PROTECTED] wrote:
 On Dec 4, 2007 11:49 AM, schleg [EMAIL PROTECTED] wrote:
 
  This may be a dumb noob issue, but I haven't found any answers while 
  seaching
  the forum--
 
  I have a controller method
 
def edit
  @user = User.find params[:id]
  @user.password_confirmation = @user.password
end
 
  The User class has an attr_accessor :password_confirmation definition (so
  password_confirmation doesn't exist in the users table). My spec has the
  following
 
it should find User on GET to users/edit/:id do
  User.should_receive(:find).and_return(@user)
  @user.should_receive(:password_confirmation)

 This should be:

 @user.should_receive(:password_confirmation=)


Lots of beginners make this mistake. Maybe RSpec's mock framework
should be smart enough to suggest this fix by itself.

Patch anyone?

Aslak

 Cheers,
 David


  get 'edit', :id = @user.id
end
 
  I am asking it to expect that I will be assigning something to that
  attribute in the edit method. Unfortunately, the spec fails with
 
  Spec::Mocks::MockExpectationError in 'UsersController should find User on
  GET to users/edit/:id'
  Mock 'user' received unexpected message :password_confirmation= with
  (password)
 
  Initially I thought that my should_receive expectation was incorrectly
  written, but if I comment out the attribute assignment in the controller
  method
 
  ...
  @user = User.find params[:id]
  [EMAIL PROTECTED] = @user.password
  ...
 
  then the test fails with
 
  Spec::Mocks::MockExpectationError in 'UsersController should find User on
  GET to users/edit/:id'
  Mock 'user' expected :password_confirmation with (any args) once, but
  received it 0 times
 
  So, it seems to me that the expectation is written correctly, but something
  about using the attr_accessor via the mock object is causing a failure.
 
  BTW, I am doing the following in a before(:each) block
 
  @user = mock(user)
  @user.stub!(:new_record?).and_return(false)
  @user.stub!(:update_attributes).and_return(true)
  @user.stub!(:password_confirmation).and_return('password')
  @user.stub!(:password).and_return('password')
  User.stub!(:new).and_return(@user)
 
  Does anyone know what I'm missing here?
 
  Thanks!
  --
  View this message in context: 
  http://www.nabble.com/Unexpected-message-on-%3Aattr_accessor-tf4944588.html#a14155614
  Sent from the rspec-users mailing list archive at Nabble.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

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Fresh rspec on rails install blows up

2007-12-11 Thread aslak hellesoy
On Dec 11, 2007 4:49 PM, Keith McDonnell [EMAIL PROTECTED] wrote:
 Hi there,

 I installed the rspec on rails plugin for a new project today and guess
 what -- it blows up!


Guess what - when RSpec 1.0.8 was released (August 12 2007), the
latest release of RoR was 1.2.3 (March 13 2007).

Can you try one of these:
* Downgrade to RoR 1.2.3
* Upgrade to RSpec trunk

Aslak

 All by other rspec on rails projects are working fine.

 I updated all gems  still no joy. Any ideas how I can troubleshoot this
 one ?

 Here's my setup:

 - ruby 1.8.4 (2005-12-24) [powerpc-darwin8.7.0]
 - Rails 1.2.5

 Installed with svn:
 ruby script/plugin install
 svn://rubyforge.org/var/svn/rspec/tags/CURRENT/rspec

 ruby script/plugin install
 svn://rubyforge.org/var/svn/rspec/tags/CURRENT/rspec_on_rails

 ruby script/generate rspec

 [Created a model]

 Here's the error:

 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:404:in
 `to_constant_name': Anonymous modules have no name to be referenced by
 (ArgumentError)
  from
 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:214:in
 `qualified_name_for'
  from
 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:476:in
 `const_missing'
  from
 /Users/kmcd/work/banknote/vendor/plugins/rspec/lib/spec/example/example_group_factory.rb:7:in
 `reset'
  from
 /Users/kmcd/work/banknote/vendor/plugins/rspec/lib/spec/example/example_group_factory.rb:59
  from
 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
  from
 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in
 `require'
  from
 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in
 `new_constants_in'
  from
 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in
 `require'
   ... 47 levels...
  from
 /usr/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/runner/behaviour_runner.rb:19:in
 `run'
  from
 /usr/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/runner/command_line.rb:17:in
 `run'
  from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/bin/spec:3
  from /usr/local/bin/spec:16

 Regards,

 Keith
 ___
 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 1.0.8 with Rails 2.0

2007-12-12 Thread aslak hellesoy
On Dec 12, 2007 12:48 AM, Yitzhak Bar Geva [EMAIL PROTECTED] wrote:

 Is it OK to go ahead and generate a Rails 2.0 project with RSpec 1.0.8? Am I
 likely to run into problems?

When we released RSpec 1.0.8 there was no Rails 2.0. We always have to
do a fair amount of tweaks to keep up with Rails, so the versions
you're talking about are incompatible.

As a general rule: Each RSpec release will work with the latest Rails
at the time of release. If you want to use a newer Rails, use RSpec
trunk.

Aslak

 Would it be best advised to wait or can I go ahead now?
 Thanks,
  Yitzhak

 ___
 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] Change in isolation behaviour 1.08 - 1.10 ?

2007-12-17 Thread aslak hellesoy
On Dec 17, 2007 2:13 PM, Jeroen Houben [EMAIL PROTECTED] wrote:
 Hi,

 I just moved from 1.08 to 1.10 and now have one example failing, which,
 under 1.08, passed. Is the due to a change in behaviour?

 Here's my spec (removed some passing examples)

 require File.dirname(__FILE__) + '/../spec_helper'

 describe A user do

   before(:each) do
 @user = User.new
 @valid_user = User.new(
   :email= '[EMAIL PROTECTED]',
   :fname= 'bert',
   :lname= 'valid',
   :jobtitle = programmer
 )
   end

   it should have a unique email address do
 @valid_user.save.should == true
 @user.email = @valid_user.email
 @user.should have(1).error_on(:email)
   end

   it should allow two users with the same name do
 @valid_user.save.should == true
 @user.fname = @valid_user.fname
 @user.lname = @valid_user.lname
 @user.should have(:no).error_on(:fname)
 @user.should have(:no).error_on(:lname)
   end

 end

 The second example now fails, as the inserted record from the first example
 is not rolled back.


stack trace please

 I can just put a User.delete_all in an after(:each) block but I think it
 would be nicer if Rspec wrapped each example in a db transaction. Wasn't
 this they way things worked in 1.08 ?

 Jeroen

 ___
 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] Change in isolation behaviour 1.08 - 1.10 ?

2007-12-17 Thread aslak hellesoy
On Dec 17, 2007 2:13 PM, Jeroen Houben [EMAIL PROTECTED] wrote:
 Hi,

 I just moved from 1.08 to 1.10 and now have one example failing, which,
 under 1.08, passed. Is the due to a change in behaviour?

 Here's my spec (removed some passing examples)

 require File.dirname(__FILE__) + '/../spec_helper'

 describe A user do

   before(:each) do
 @user = User.new
 @valid_user = User.new(
   :email= '[EMAIL PROTECTED]',
   :fname= 'bert',
   :lname= 'valid',
   :jobtitle = programmer
 )
   end

   it should have a unique email address do
 @valid_user.save.should == true
 @user.email = @valid_user.email
 @user.should have(1).error_on(:email)
   end

   it should allow two users with the same name do
 @valid_user.save.should == true
 @user.fname = @valid_user.fname
 @user.lname = @valid_user.lname
 @user.should have(:no).error_on(:fname)
 @user.should have(:no).error_on(:lname)
   end

 end

 The second example now fails, as the inserted record from the first example
 is not rolled back.


I don't see a fixtures :users in your spec. Do you have this in your
spec_helper?
Have you rerun script/generate rspec after you upgraded? There are
some changes in the spec_helper.rb file between the two releases.

Aslak

 I can just put a User.delete_all in an after(:each) block but I think it
 would be nicer if Rspec wrapped each example in a db transaction. Wasn't
 this they way things worked in 1.08 ?

 Jeroen

 ___
 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] Change in isolation behaviour 1.08 - 1.10 ?

2007-12-17 Thread aslak hellesoy
On Dec 17, 2007 5:58 PM, David Chelimsky [EMAIL PROTECTED] wrote:
 On Dec 17, 2007 10:55 AM, aslak hellesoy [EMAIL PROTECTED] wrote:
  On Dec 17, 2007 4:12 PM, David Chelimsky [EMAIL PROTECTED] wrote:
   On Dec 17, 2007 9:06 AM, Jeroen Houben [EMAIL PROTECTED] wrote:

 ... Just received the message by David. This will be fixed in 1.1.1

 Jeroen - just for good measure, would you kindly update from trunk and
 verify that it does in fact fix your issue?
   
Finished in 3.42683 seconds
   
176 examples, 0 failures, 3 pending
  
   Thanks. I'll get the release out by tonight.
  
 
  Awesome David.
 
  Do we have any specs that will catch this regression if it's reintroduced?

 I didn't look and don't have time right now. The fix was committed in
 r3158. Can  you check the diff?


I've added some more functional specs (r3172) that should prevent any
transaction related bugs from coming back in.

Jeroen - if you find more bugs, please report what Rails and Ruby
versions you are using - it took me a while to realise that you were
on Rails 1.2.3 (David told me)


 
  Aslak
 
 
   Cheers,
   David
  
  
   
:)
   
   
___
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
  
  ___
  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

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] JtestR 0.1 released

2007-12-28 Thread aslak hellesoy
On Dec 28, 2007 10:46 PM, Ola Bini [EMAIL PROTECTED] wrote:
 JtestR allows you to test your Java code with Ruby frameworks.

 Homepage: http://jtestr.codehaus.org
 Download: http://dist.codehaus.org/jtestr


Thanks for the pointer and the code Ola - this is REALLY cool. I'll
definitely take a close look at this - I'm over my java is boring
period ;-)

Aslak

 JtestR 0.1 is the first public release of the JtestR testing tool.
 JtestR integrates JRuby with several Ruby frameworks to allow painless
 testing of Java code, using RSpec, Test/Unit, dust and Mocha.

 Features:
 - Integrates with Ant and Maven
 - Includes JRuby 1.1, Test/Unit, RSpec, dust, Mocha and ActiveSupport
 - Customizes Mocha so that mocking of any Java class is possible
 - Background testing server for quick startup of tests
 - Automatically runs your JUnit codebase as part of the build

 Getting started: http://jtestr.codehaus.org/Getting+Started

 Team:
 Ola Bini   - [EMAIL PROTECTED]
 Anda Abramovici- [EMAIL PROTECTED]

 --
 Ola Bini (http://ola-bini.blogspot.com)
 JRuby Core Developer
 Developer, ThoughtWorks Studios (http://studios.thoughtworks.com)
 Practical JRuby on Rails (http://apress.com/book/view/9781590598818)

 Yields falsehood when quined yields falsehood when quined.



 ___
 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] Converting to Rails 2.0.2

2007-12-29 Thread aslak hellesoy
On Dec 28, 2007 11:56 PM, s.ross [EMAIL PROTECTED] wrote:
 I'm moving an older project to Rails 2.0.2 and ran into a roadblock on
 the version matching. Here's script/console session:

   Spec::VERSION::REV
 = 1785
   Spec::Rails::VERSION::REV
 NoMethodError: undefined method `run=' for Test::Unit:Module
 from /Users/sxross/rails/tastie_work/vendor/plugins/rspec_on_rails/
 lib/spec/rails.rb:16
 from /Users/sxross/rails/tastie_work/vendor/rails/activerecord/
 lib/../../activesupport/lib/active_support/dependencies.rb:203:in
 `load_without_new_constant_marking'
 from /Users/sxross/rails/tastie_work/vendor/rails/activerecord/
 lib/../../activesupport/lib/active_support/dependencies.rb:203:in
 `load_file'
 from /Users/sxross/rails/tastie_work/vendor/rails/activerecord/
 lib/../../activesupport/lib/active_support/dependencies.rb:342:in
 `new_constants_in'
 from /Users/sxross/rails/tastie_work/vendor/rails/activerecord/
 lib/../../activesupport/lib/active_support/dependencies.rb:202:in
 `load_file'
 from /Users/sxross/rails/tastie_work/vendor/rails/activerecord/
 lib/../../activesupport/lib/active_support/dependencies.rb:94:in
 `require_or_load'
 from /Users/sxross/rails/tastie_work/vendor/rails/activerecord/
 lib/../../activesupport/lib/active_support/dependencies.rb:248:in
 `load_missing_constant'
 from /Users/sxross/rails/tastie_work/vendor/rails/activerecord/
 lib/../../activesupport/lib/active_support/dependencies.rb:453:in
 `const_missing'

 The project uses trunk versions of rspec and rspec_on_rails, along
 with current Rails edge (at this point, 8506). After upgrading Rails
 and some of the normal monkeying around, I did a script/generate rspec
 (nothing of note there and replaced all just to be sure). Then:

 rake spec does this:

 Users/sxross/rails/tastie_work/vendor/rails/activerecord/lib/../../
 activesupport/lib/active_support/dependencies.rb:263:in
 `load_missing_constant': uninitialized constant Spec::VERSION::REV
 (NameError)
 from /Users/sxross/rails/tastie_work/vendor/rails/activerecord/
 lib/../../activesupport/lib/active_support/dependencies.rb:453:in
 `const_missing'
 from /Users/sxross/rails/tastie_work/vendor/plugins/rspec_on_rails/
 lib/spec/rails/version.rb:13
 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
 `gem_original_require'
 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
 from /Users/sxross/rails/tastie_work/vendor/rails/activerecord/
 lib/../../activesupport/lib/active_support/dependencies.rb:496:in
 `require'
 from /Users/sxross/rails/tastie_work/vendor/rails/activerecord/
 lib/../../activesupport/lib/active_support/dependencies.rb:342:in
 `new_constants_in'
 from /Users/sxross/rails/tastie_work/vendor/rails/activerecord/
 lib/../../activesupport/lib/active_support/dependencies.rb:496:in
 `require'
 from /Users/sxross/rails/tastie_work/vendor/plugins/rspec_on_rails/
 lib/spec/rails.rb:11
  ... 11 levels...
 from /Library/Ruby/Gems/1.8/gems/rspec-1.1.1/lib/spec/runner/
 example_group_runner.rb:13:in `load_files'
 from /Library/Ruby/Gems/1.8/gems/rspec-1.1.1/lib/spec/runner/
 options.rb:83:in `run_examples'
 from /Library/Ruby/Gems/1.8/gems/rspec-1.1.1/lib/spec/runner/
 command_line.rb:19:in `run'
 from /Library/Ruby/Gems/1.8/gems/rspec-1.1.1/bin/spec:3

The culprit is right here in your stack trace. You're running with a
pre-trunk gem version of RSpec that isn't compatible with Spec::Rails
trunk.

Uninstall your existing RSpec gem. A more long term solution would be
to make sure plugged-in rspec is always on $LOAD_PATH before the
gemmed one, but that might be a little tricky.

Aslak


 Anyone know what's up here?

 Thx

 --s

 ___
 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] How to run stories with `spec' command?

2007-12-31 Thread aslak hellesoy
On Dec 31, 2007 11:55 AM, Chiyuan Zhang [EMAIL PROTECTED] wrote:
 Hi, all!

 I have a story steps array.rb and the story array.story. I
 can run it with

   ruby array.rb

 But when I execute

   spec array.rb

 nothing happened. I'm wondering how can I use spec command to
 execute stories?

You can't. The spec command is only for examples.

Aslak

 (executing examples is OK) Or maybe another
 question. If I have to run stories with `ruby' command, how
 can I choose the output format? (I think there's only plain text
 and HTML for stories currently) Any idea? Thanks.

 ps: Here's my stories

 
 array.rb
 
 require 'spec/story'

 steps_for(:array) do
   Given(my state initialized) do
 @array = Array.new
   end
   When($elem added to me) do |elem|
 @array  elem
   end
   Then(my size should be $size) do |size|
 @array.size.should == size.to_i
   end
 end

 # if __FILE__ == $0
 with_steps_for :array do
   run __FILE__.gsub(/\.rb$/, '.story')
 end
 # end

 ===
 array.story
 ===
 Story: array for holding objects
   As an array for holding objects
   I can hold a bunch of objects
   So that they can be retrieved later

   Scenario: an empty array
 Given my state initialized
 Then my size should be 0

   Scenario: an array with only 1 element
 Given my state initialized
 When 1 added to me
 Then my size should be 1
 ___
 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] patch for html display

2008-01-04 Thread aslak hellesoy
Please register this on http://rspec.lighthouseapp.com/
We *will* forget to apply this patch if you don't ;-)

Thanks,
Aslak

On Jan 4, 2008 7:15 AM, Tim Harper [EMAIL PROTECTED] wrote:
 All,

 I've found that the html view for the rspec formatter falls to pieces with
 Rails 2.02 and rspec 1.10.  Has anyone else run into this trouble?

 Here's a monkey patch that fixes the problem.  A more elegant fix would be
 in order, but this gets the job done:

 Index:
 /Users/timcharper/www/exchange/vendor/plugins/rspec/lib/spec/runner/formatter/text_mate_formatter.rb
 ===
 ---
 /Users/timcharper/www/exchange/vendor/plugins/rspec/lib/spec/runner/formatter/text_mate_formatter.rb
 (revision 906)
 +++
 /Users/timcharper/www/exchange/vendor/plugins/rspec/lib/spec/runner/formatter/text_mate_formatter.rb
 (working copy)
 @@ -6,8 +6,9 @@
# Formats backtraces so they're clickable by TextMate
class TextMateFormatter  HtmlFormatter
  def backtrace_line(line)
 -  line.gsub(/([^:]*\.rb):(\d*)/) do
 -a
 href=\txmt://open?url=file://#{File.expand_path($1)}line=#{$2}\#{$1}:#{$2}/a
 
 +  line.gsub!(/^(On line #([0-9]+) of )(.+)$/) {
 app/views/#{$3}:#{$2}}
 +  line.gsub(/([^:]*\.(rb|rhtml|erb)):(\d*)/) do
 +a href=\txmt://open?url=file://#{
 File.expand_path($1)}line=#{$3}\#{$1}:#{$3}/a 
end
  end
end
 Index:
 /Users/timcharper/www/exchange/vendor/plugins/rspec/lib/spec/runner/formatter/base_text_formatter.rb
 ===
 ---
 /Users/timcharper/www/exchange/vendor/plugins/rspec/lib/spec/runner/formatter/base_text_formatter.rb
 (revision 906)
 +++
 /Users/timcharper/www/exchange/vendor/plugins/rspec/lib/spec/runner/formatter/base_text_formatter.rb
 (working copy)
 @@ -88,6 +88,7 @@

  def format_backtrace(backtrace)
return  if backtrace.nil?
 +  backtrace = backtrace.first.split(\n).map { |l| h(l).strip }
 backtrace.map { |line| backtrace_line(line) }.join(\n)
  end



 Tim

 ___
 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] status/exit code for story runner

2008-01-05 Thread aslak hellesoy
On Jan 5, 2008 2:39 AM, Ben Mabey [EMAIL PROTECTED] wrote:
 Hi All,
 I'm trying to incorporate our stories into our build for our
 cruisecrontrol.rb projects and it looks like the Story Runner always
 returns a 0 (zero) no matter if the tests pass or fail.
 This is in contrast to the actual and expected behavior of the spec
 command which will return a 0 or a 1 depending on whether specs pass or
 fail.

 Am I doing something wrong with the story runner or would this need to
 be patched to get it to work correctly?


It's something we haven't implemented, so a patch at
http://rspec.lighthouseapp.com/ would be great.

Aslak

 Thanks,

 Ben
 ___
 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] Varying test data

2008-01-11 Thread aslak hellesoy
On Jan 11, 2008 11:33 AM, Kerry Buckley [EMAIL PROTECTED] wrote:
 This isn't specific to RSpec, but is hopefully on-topic for this list.

 I like (especially when ping pong pairing) to write a spec, then
 write the smallest amount of code I can to pass it (especially when
 ping pong pairing). Sometimes this means hard-coding a return value,
 which means another spec is needed to prove that the code is really
 behaving as it should. Trivial example:

 --
 describe Adder do
it should add two numbers do
  Adder.add(2, 2).should == 4
end
 end

 class Adder
def add a, b
  4
end
 end
 --
 describe Adder do
it should add 2 and 2 do
  Adder.add(2, 2).should == 4
end
it should add 3 and 4 do
  Adder.add(3, 4).should == 7
end
 end

 class Adder
def add a, b
  a + b
end
 end
 --

 It doesn't seem right though to have all those duplicate specs. An
 alternative is to generate random test data, but I'm not really
 comfortable doing that because it means the tests aren't strictly
 repeatable. I guess this is more of a problem with classic state-based
 testing, but even using BDD you still have to test state at the leaf
 nodes.


It may not be applicable in your trivial context, but pair-wise
testing (has nothing to do with pair programming) is a really powerful
technique you could consider. It's a mini method that generates input
combinations based on a set of possible values, dramatically reducing
the number of combinations while still giving you the most important
combinations.

It's based on a theory that bugs often occur when a pair of data
changes, and it tries to generate data that covers as many pairs as
possible without going overboard.

It's the most interesting test-related practice I have learned in
several years (there are separate conferences on the topic!). I
haven't tried it myself, but I know several colleagues who've had
great success with it. There is also a tool (perl script) you can use
to generate input values for you (you figure out the expected results
yourself - it doesn't do that for you). And best of all - it looks
really easy to use, both as a technique and a tool.

http://www.testingeducation.org/wtst5/PairwisePNSQC2004.pdf
http://www.pairwise.org/
http://en.wikipedia.org/wiki/All-pairs_testing
http://www.developsense.com/2007/11/pairwise-testing.html
http://www.developsense.com/testing/PairwiseTesting.html

Aslak

 Does anyone have an opinion about whether this is a problem, and
 whether there's a clean way of dealing with it?

 Thanks,

 Kerry
 ___
 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] TextMate bundle not compatible with nested specs for running focused tests?

2008-01-13 Thread aslak hellesoy
On Jan 14, 2008 12:47 AM, Matthew Windwer [EMAIL PROTECTED] wrote:
 Seems like the recently updated (and wonderful) textmate bundle does not
 take into account running individual tests that are in nested specs.

 Anybody else notice this? Any ideas?


I have noticed it too. Please file a bug report.

Aslak

 Matt
 ___
 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] How to trace running spec

2008-01-14 Thread aslak hellesoy
On Jan 14, 2008 3:47 AM, Kero van Gelder [EMAIL PROTECTED] wrote:
   I have a spec that is hanging when it is running.
  
   How do I get the rspec runner to show what specs it's running so I can
   which one is hanging?  I am calling the runner from my rails project.
 
  Which formatter ate you using?  If you use the specdoc formatter it will
  output the specs as it goes so you can tell where it is hanging.  Also,
  there is a profiling one that will list the slowest specs.  Run spec
  -h for more info.

 Though a formatter is no listener (or is it?),

A formatter listens to events related to running of examples
(specs), so you can call it a listener.

 it seems to act like one.

It does. All our listeners output results in some way or another,
which is why we call them formatters, both in our code and in the
command line api (--formatter).

To make things even more confusing, we actually use the term
listener in the story framework, but only in the code. The command
line api still calls them formatter.

 Steps do not tell their listeners when they are started, only when they
 are finished.


Steps is a concept you only find in the story framework. I think Ben
was talking about RSpec classic.

 Assuming a known order, you can figure out which step hangs, but it is
 not the one listed last (it's the one after that...)

 Another reason to have s step_started method in listeners, is to format
 (tell the customer) about a step *before* the step is executed, such that
 the customer knows what will happen, instead of heard what has just
 happened.

 Time to write a ticket on lighthouse?


Sure, go ahead. But I think you're talking about a different thing
than Ben here.

Aslak

 Bye,
 Kero.

 ___
 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] Quiet Backtrace in RSpec

2008-01-19 Thread aslak hellesoy
On Jan 19, 2008 4:16 AM, Jed Hurt [EMAIL PROTECTED] wrote:
 I'm using RSpec on Rails and would like to clean up the backtraces, so I
 went looking for an RSpec equivalent to ThoughtBot's Quiet Backtrace gem. I
 found Spec::Runner::QuietBacktraceTweaker in the RDOCS, but I can't figure
 out how to use it. Can I add something to spec_helper.rb that will utilize
 Spec::Runner::QuietBacktraceTweaker to quiet the backtraces?

It's on by default, and you can turn it off with -b on the command line

Thanks for telling me about the Quiet Backtrace gem, I've added a
ticket for that:
http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/243-add-support-for-quietbacktrace-gem

Aslak

 ___
 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] DRYing up stories

2008-01-23 Thread aslak hellesoy
On Jan 23, 2008 10:45 PM, Neil M. Young [EMAIL PROTECTED] wrote:

 I'm finding that I'm writing sets of very similar scenarios to check access
 permissions for each of my actions. Does anyone have suggestions on how to
 dry this up:


Beware that DRY has a cost. Clarity and readability.

David's BDD manifesto (slightly rephrased):

We prefer clarity over DRY (that is - while there is value in DRYness,
we value clarity more)

Aslak

 Given an existing Account
 And a logged in Admin
 When the user visits account/manage
 Then he should get access

 Given an existing Account
 And a logged in Manager
 When the user visits account/manage
 Then he should get access

 Given an existing Account
 And a logged in Supervisor
 When the user visits account/manage
 Then he should not get access

 Given an existing Account
 And a logged in Reviewer
 When the user visits account/manage
 Then he should not get access

 Given an existing Account
 And a logged in User
 When the user visits account/manage
 Then he should not get access

 --
 View this message in context: 
 http://www.nabble.com/DRYing-up-stories-tp15053384p15053384.html
 Sent from the rspec-users mailing list archive at Nabble.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] DRYing up stories

2008-01-23 Thread aslak hellesoy
On Jan 24, 2008 1:04 AM, Ben Mabey [EMAIL PROTECTED] wrote:
 While the original post had DRY in the subject line I don't see this as
 a DRY issue.  I see it as a visualization and maintenance issue.  If I
 add a new role and I want to test each action for it's permissions it
 would be much easier for a customer to go down a spread sheet and
 designate within each cell what the response should be.. success or
 failure, etc... This would give the customer a bird's eye view of
 permissions for the entire app for each class of users.  By using a
 separate scenario for each role in each story you will be creating a lot
 of copy and past work which will comminucate the same information a
 spreadsheet would but a lot more inefficently since someone would have
 to read hundreds of pages of stories.  I love the plain text stories.
 We just have to remember that there are better ways to express large
 amounts of data than plain English. :)
 Do you understand the point I'm trying to make?


I totally get your point. This is where FIT shines (or maybe Ryan's Matrix).

Aslak


 -Ben




 aslak hellesoy wrote:
  On Jan 23, 2008 10:45 PM, Neil M. Young [EMAIL PROTECTED] wrote:
 
  I'm finding that I'm writing sets of very similar scenarios to check access
  permissions for each of my actions. Does anyone have suggestions on how to
  dry this up:
 
 
 
  Beware that DRY has a cost. Clarity and readability.
 
  David's BDD manifesto (slightly rephrased):
 
  We prefer clarity over DRY (that is - while there is value in DRYness,
  we value clarity more)
 
  Aslak
 
 
  Given an existing Account
  And a logged in Admin
  When the user visits account/manage
  Then he should get access
 
  Given an existing Account
  And a logged in Manager
  When the user visits account/manage
  Then he should get access
 
  Given an existing Account
  And a logged in Supervisor
  When the user visits account/manage
  Then he should not get access
 
  Given an existing Account
  And a logged in Reviewer
  When the user visits account/manage
  Then he should not get access
 
  Given an existing Account
  And a logged in User
  When the user visits account/manage
  Then he should not get access
 
  --
  View this message in context: 
  http://www.nabble.com/DRYing-up-stories-tp15053384p15053384.html
  Sent from the rspec-users mailing list archive at Nabble.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
 

 ___
 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] colored output for stories?

2008-02-10 Thread aslak hellesoy
On Feb 8, 2008 9:50 PM, Neil M. Young [EMAIL PROTECTED] wrote:

 sorry if this is documented somewhere, but do stories support colored output?
 neither -c nor --color are working for me.

It works for me. What's your environment?

 --
 View this message in context: 
 http://www.nabble.com/colored-output-for-stories--tp15363648p15363648.html
 Sent from the rspec-users mailing list archive at Nabble.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] [newbie] rspec textmate bundle problem

2008-02-25 Thread aslak hellesoy
There is also this:
http://rspec.info/documentation/tools/extensions/editors/textmate.html

Aslak

On Tue, Feb 26, 2008 at 12:41 AM, Oliver Barnes
[EMAIL PROTECTED] wrote:
 ..2 seconds after posting I found this thread from the peepcode users group

  http://groups.google.com/group/peepcode/browse_thread/thread/089989c61181d39c

  and so I set the same variables in my .bashrc, and created a new
  project, which got the bundle to work when opening the project from
  the command line. it still doesn't work from locomotive though.

  2008/2/25, Oliver Barnes [EMAIL PROTECTED]:


  Hello,
  
I've just installed the rspec textmate bundle from svn, and I'm
getting the following error when I try to run a single example:
  
/Users/oliver/Library/Application
Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/mate.rb:2:in
`require': No such file to load -- rubygems (LoadError) from
/Users/oliver/Library/Application
Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/mate.rb:2
from /tmp/temp_textmate.xVeAZb:3:in `require' from
/tmp/temp_textmate.xVeAZb:3
  
I'm using a custom locomotive bundle with the rails 2.0.2 and rspec
1.1.3 gems installed, together with the respective rspec_on_rails
plugin. I've been searching for a solution for a couple of hours, and
i've tried setting both TM_RUBY and TM_RSPEC_HOME as suggested in
other posts, but that didn't solve it. At one point the error changed,
complaining about a missing rails 2.0.2 gem though it's  installed and
declared in the environment config, but I can't remember now what
prompted it.
  
appreciate any pointers with this, please bear with me as I'm new to
the list and still learning my way around testing and rspec... ;)
  
  
- Oliver
  
  ___
  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] bad specs better than none?

2008-02-25 Thread aslak hellesoy
On Tue, Feb 26, 2008 at 3:18 AM, Giles Bowkett [EMAIL PROTECTED] wrote:
 Hi - I've got a bunch of people using specs at a company. Everybody is
  writing specs, but people are not really practicing BDD. As in, the
  specs are there, but it doesn't go, write spec, write code, repeat. I
  recently came across 8 failing specs checked into svn; I think the
  plan was, I'll write the design as specs, and then implement the
  entire design to match. Obviously that's not really the way it should
  be.


Here is how I would deal with this (and have dealt with it in the past)
1) In your standup meeting (if you have one) say you have an obstacle,
and that it's failing specs in svn. Don't explain why it's an
obstacle, just say you'd like to discuss it with the other devs after
the standup.
2) Explain that you can't check in more code because you can't know
whether your new code is any good. When something fails you can't know
for sure whether it's due to old or new failing specs.

3) Try to get everyone to understand the benefits of a green SCM and
the dangers of a red one. This can take days and weeks. Only then can
you address the failing specs.

4) Set up Continuous Integration
5) Invest in some lamps and hook them up to your CI

  I also had to go into specs on a project I'm not working on, and found
  an unholy hive of database-accessing specs. It's disheartening.
  Basically, it's cargo cult development practices - using the best
  practice without actually understanding it.


What best practice are you referring to?

  Should I tell these people to throw away their specs? Should I train
  them in the BDD spec first cycle? What do you do when you have specs
  that are not really that useful? This is mostly Rails stuff; there's a
  lot of controller specs that duplicate model specs instead of stubbing
  out the behavior. It's driving me nuts but I have no idea what the
  solution is yet.


I don't know if your developers chose BDD/RSpec themselves (and got it
wrong) or if they were assigned.
In any case, it sounds like there has been a lack of attention to
collective code ownership and staffing with appropriate skills.

Patience and pair programming would be my best suggestion. Have
someone who gets BDD (you?) pair with the whole team till they get it
too. And till they also get that they should fix bad code when they
see it.

Aslak

  --
  Giles Bowkett

  Blog: http://gilesbowkett.blogspot.com
  Portfolio: http://www.gilesgoatboy.org
  Tumblelog: http://giles.tumblr.com
  Podcast: http://hollywoodgrit.blogspot.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] Pretty story output for non-Rails project

2008-03-04 Thread aslak hellesoy
On Tue, Mar 4, 2008 at 2:18 PM, Ed Howland [EMAIL PROTECTED] wrote:
 On Tue, Mar 4, 2008 at 12:19 AM, David Chelimsky [EMAIL PROTECTED] wrote:
   On Mon, Mar 3, 2008 at 11:41 PM, George Anderson
[EMAIL PROTECTED] wrote:
 I'm taking my first fledgling steps driving a new ruby (non-rails)
  project with BDD.  I've got a (test) story working.  However, when I
  run the story in TextMate (via command-r), the output is plain text.

  See: http://skitch.com/georgeanderson/8grg/run-examples

  How do I get the output to look pretty (formatted)?
  
There's no textmate formatter for stories yet. In the mean time, you
can do it on the command line with --format html and open the
resulting file in a browser.
  
Cheers,
David
  

  David,

  Is this something in trunk? all.rb does not except any arguments, and
  there is no argument to the run command for this. Also, the svn server
  seems to be offline this morning.


This is in the latest release. Just pass --format html on the ocmmand
line. ARGS is read by one of the internal files in RSpec - not all.rb.
Try --help too.

Aslak


  Ed


  
  

  rspec-1.1.3
  OS X 10.5.2
  TextMate v1.5.7 (1455)

  Thanks,

  /g

  --

  George Anderson

  BenevolentCode LLC
  O: (410) 461-7553
  C: (410) 218-5185

  [EMAIL PROTECTED]
  ___
  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
  



  --
  Ed Howland
  http://greenprogrammer.blogspot.com
  The information transmitted is intended only for the person or entity
  to which it is addressed and may contain proprietary, confidential
  and/or legally privileged material. Any review, retransmission,
  dissemination or other use of, or taking of any action in reliance
  upon, this information by persons or entities other than the intended
  recipient is prohibited. If you received this in error, please contact
  the sender and delete the material from all computers.


 ___
  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] Pretty story output for non-Rails project

2008-03-04 Thread aslak hellesoy
On Tue, Mar 4, 2008 at 3:32 PM, Ed Howland [EMAIL PROTECTED] wrote:
 On Tue, Mar 4, 2008 at 7:24 AM, aslak hellesoy [EMAIL PROTECTED] wrote:

  
This is in the latest release. Just pass --format html on the ocmmand
line. ARGS is read by one of the internal files in RSpec - not all.rb.
Try --help too.
  
Aslak

  Thanks, Aslak. Seems I was consuming ARGV prematurely in my own story runner.

  The output seems a bit crude. I have to drop the output in public and
  copy the css there, or put it in
  vendors/plugins/rspec/story_server/prototype.

  Also, I can't seem to get the summarized output like the example in there.


Yeah, it's only a start. Patches are welcome as usual.

Aslak
  Ed

  --

 Ed Howland
  http://greenprogrammer.blogspot.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] Pretty story output for non-Rails project

2008-03-04 Thread aslak hellesoy
On Tue, Mar 4, 2008 at 6:11 PM, s.ross [EMAIL PROTECTED] wrote:
 On Mar 4, 2008, at 5:24 AM, aslak hellesoy wrote:

   This is in the latest release. Just pass --format html on the ocmmand
   line. ARGS is read by one of the internal files in RSpec - not all.rb.
   Try --help too.
  
   Aslak

  I must be dense:

  RSpec-1.1.3 (build 20080131122909) - BDD for Ruby

  ruby stories/all.rb --format html

  and this outputs text. Where would the html go?


I forgot - this is an old bug - not working with rails, only vanilla
http://rspec.lighthouseapp.com/projects/5645/tickets/113-13547-story-runner-html-formatted-output

Aslak


 ___
  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 and RCov with JRuby

2008-03-17 Thread aslak hellesoy
On Mon, Mar 17, 2008 at 1:27 PM, Tobias Torkler [EMAIL PROTECTED] wrote:
 Hi,

  I am using JRuby (trunk) and wrote a bunch of specifications for my
  code. Everything works fine so far.
  Now I am trying to integrate RCov in my test run. I have installed
  RCov without the C extensions. I tried it with a simple script and it
  worked (pretty slow, but it doesn´t matter).
  But when I add the rcov options to my Rake task, RCov is not invoke
  properly!

  Rakefile:
  Spec::Rake::SpecTask.new('specs') do |t|
t.spec_files = FileList['spec/**/*.rb']
t.rcov = true
t.rcov_opts = ['--exclude', 'spec']
t.verbose = true
  end

  Output:
  ...
  Finished in 11.376 seconds

  187 examples, 0 failures, 10 pending
  Loaded suite /Users/tobias/bin/JRuby.framework/Current/bin/rcov
  Started

  Finished in 0.0080 seconds.

  0 tests, 0 assertions, 0 failures, 0 errors


This is Test::Unit output

  Why is rcov started at the end of the test run?

Did you mean: Why is Test::Unit started at the end of the RSpec run?

I'm not sure exactly what you're asking.

Aslak

  ___
  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 and RCov with JRuby

2008-03-17 Thread aslak hellesoy
On Mon, Mar 17, 2008 at 3:50 PM, Tobias Torkler [EMAIL PROTECTED] wrote:
 This is not Test::Unit output!

The following text - taken from your first email - is Test::Unit
output. It is not RCov or RSpec output.

8
Loaded suite /Users/tobias/bin/JRuby.framework/Current/bin/rcov
  Started

  Finished in 0.0080 seconds.

  0 tests, 0 assertions, 0 failures, 0 errors
8

  As you can see I created a Rake task to run my specs and tried to
  integrate rcov as described on 
 http://rspec.info/documentation/tools/rcov.html
  RSpec works as expected (187 examples, 0 failures, 10 pending) but I
  am missing the RCov report.


In your first email you asked: Why is rcov started at the end of the test run?
I got confused about what you mean by test run (that usually mean
Test::Unit run - and you do have Test::Unit output).

Are you trying to figure out what order things are happening in, or
are you trying to figure out why you're not getting an RCov report?

Aslak


  Am 17.03.2008 um 15:43 schrieb aslak hellesoy:



   On Mon, Mar 17, 2008 at 1:27 PM, Tobias Torkler [EMAIL PROTECTED]
wrote:
   Hi,
  
   I am using JRuby (trunk) and wrote a bunch of specifications for my
   code. Everything works fine so far.
   Now I am trying to integrate RCov in my test run. I have installed
   RCov without the C extensions. I tried it with a simple script and it
   worked (pretty slow, but it doesn´t matter).
   But when I add the rcov options to my Rake task, RCov is not invoke
   properly!
  
   Rakefile:
   Spec::Rake::SpecTask.new('specs') do |t|
 t.spec_files = FileList['spec/**/*.rb']
 t.rcov = true
 t.rcov_opts = ['--exclude', 'spec']
 t.verbose = true
   end
  
   Output:
   ...
   Finished in 11.376 seconds
  
   187 examples, 0 failures, 10 pending
   Loaded suite /Users/tobias/bin/JRuby.framework/Current/bin/rcov
   Started
  
   Finished in 0.0080 seconds.
  
   0 tests, 0 assertions, 0 failures, 0 errors
  
  
   This is Test::Unit output
  
   Why is rcov started at the end of the test run?
  
   Did you mean: Why is Test::Unit started at the end of the RSpec run?
  
   I'm not sure exactly what you're asking.
  
   Aslak
  
   ___
   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

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] RSpec and RCov with JRuby

2008-03-17 Thread aslak hellesoy
On Mon, Mar 17, 2008 at 4:23 PM, Tobias Torkler [EMAIL PROTECTED] wrote:
 Ok, so the question is then why I don´t get an RCov report? Sorry for
  the test run. Better call it an RSpec run?


RSpec run is much clearer, thanks :-)

I'm looking into the problem, but I'm struggling to install RCov into
JRuby. I get the following error:

$ /usr/local/jruby-1.1RC2/bin/jruby -S gem install rcov
Building native extensions.  This could take a while...
extconf.rb:1: no such file to load -- mkmf (LoadError)
ERROR:  Error installing rcov:
ERROR: Failed to build gem native extension.

/usr/local/jruby-1.1RC2/bin/jruby extconf.rb install rcov


Gem files will remain installed in
/usr/local/jruby-1.1RC2/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0 for
inspection.
Results logged to
/usr/local/jruby-1.1RC2/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0/ext/rcovrt/gem_make.out

How did you install rcov bypassing the building of the C extensions?

Aslak

  Am 17.03.2008 um 16:10 schrieb aslak hellesoy:



   On Mon, Mar 17, 2008 at 3:50 PM, Tobias Torkler [EMAIL PROTECTED]
wrote:
   This is not Test::Unit output!
  
   The following text - taken from your first email - is Test::Unit
   output. It is not RCov or RSpec output.
  
   8
   Loaded suite /Users/tobias/bin/JRuby.framework/Current/bin/rcov
Started
  
Finished in 0.0080 seconds.
  
0 tests, 0 assertions, 0 failures, 0 errors
   8
  
   As you can see I created a Rake task to run my specs and tried to
   integrate rcov as described on 
 http://rspec.info/documentation/tools/rcov.html
   RSpec works as expected (187 examples, 0 failures, 10 pending) but I
   am missing the RCov report.
  
  
   In your first email you asked: Why is rcov started at the end of the
   test run?
   I got confused about what you mean by test run (that usually mean
   Test::Unit run - and you do have Test::Unit output).
  
   Are you trying to figure out what order things are happening in, or
   are you trying to figure out why you're not getting an RCov report?
  
   Aslak
  
  
   Am 17.03.2008 um 15:43 schrieb aslak hellesoy:
  
  
  
   On Mon, Mar 17, 2008 at 1:27 PM, Tobias Torkler [EMAIL PROTECTED]
   wrote:
   Hi,
  
   I am using JRuby (trunk) and wrote a bunch of specifications for my
   code. Everything works fine so far.
   Now I am trying to integrate RCov in my test run. I have installed
   RCov without the C extensions. I tried it with a simple script
   and it
   worked (pretty slow, but it doesn´t matter).
   But when I add the rcov options to my Rake task, RCov is not invoke
   properly!
  
   Rakefile:
   Spec::Rake::SpecTask.new('specs') do |t|
t.spec_files = FileList['spec/**/*.rb']
t.rcov = true
t.rcov_opts = ['--exclude', 'spec']
t.verbose = true
   end
  
   Output:
   ...
   Finished in 11.376 seconds
  
   187 examples, 0 failures, 10 pending
   Loaded suite /Users/tobias/bin/JRuby.framework/Current/bin/rcov
   Started
  
   Finished in 0.0080 seconds.
  
   0 tests, 0 assertions, 0 failures, 0 errors
  
  
   This is Test::Unit output
  
   Why is rcov started at the end of the test run?
  
   Did you mean: Why is Test::Unit started at the end of the RSpec run?
  
   I'm not sure exactly what you're asking.
  
   Aslak
  
   ___
   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
  

  ___
  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] sharing story steps

2008-03-20 Thread aslak hellesoy
On Thu, Mar 20, 2008 at 5:44 AM, Joe Van Dyk [EMAIL PROTECTED] wrote:
 Hi,

  How can I have a common set of steps that all my stories share?

  i.e. My stories often start out looking like this:

  Given a user Joe
  Given a user Jordan

  then:

put this in steps/users.rb:

steps_for(:user) do
  Given(a user $username) do |username|
   @users ||= {}
   @user_sessions ||= {}
   @users[username] = create_user(:username = username)
   @user_sessions[username] = login_as(@users[username])
  end

end

Now, in your file running stories:

with_steps_for(:user, :project, :comment) do
  ...
end


  I want to share that Given with all my stories.  Or is there a better
  way to do it?


At one of our current projects in BEKK we have come up with a
convention for naming and grouping steps. It simply follows the same
convention as the controllers for file names, and in each file we put
all steps that are relevant to a given controller.

In the run file we simply run stories with_steps_for all of them.

Try it out, I think you'll like it.

Aslak

  Joe
  ___
  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] Has anyone seen this strange mock behaviour?

2008-03-24 Thread aslak hellesoy
On Mon, Mar 24, 2008 at 4:38 PM, Rick DeNatale [EMAIL PROTECTED] wrote:
 I've got this example 'group':

   before(:all) do
 @mock_user = mock_model(User)
 @mock_email_field = mock_model(EmailField, :user = @mock_user)
 @mock_email_field.stub!(:user).and_return(@mock_user)
 EmailField.stub!(:find_by_value).and_return(@mock_email_field)
   end


before(:all) will only be executed once - before all of your examples.
Why are you using before(:all)?

It's highly recommended you don't use before(:all) - and definitely
not with mocks. All sort of sideeffects might happen.

Aslak

   it should find existing user by email when asked for
  group_user_from_attributes do
 # @mock_email_field.stub!(:user).and_return(@mock_user)
 EmailField.should_receive(:find_by_value).with([EMAIL 
 PROTECTED]).and_return(@mock_email_field)
 User.group_user_from_attributes(:email=[EMAIL PROTECTED])
   end


  This fails with a message:
  should find existing user by email when asked for group_user_from_attributes
  Mock 'EmailField_1001' received unexpected message :user with (no args)

  Note that I defined the @mock_email_field to stub the user method.

  If I uncomment the restubbing of the @mock_email_field in the example, it 
 works.

  It certainly seems that @mock_email_field points to the same object in
  either case.

  I've also tried using stub! in the before block instead or or in
  addition to hash stub in mock_model, but unless I stub it in the
  example no joy.

  A couple of us have been scratching our heads over this and I thought
  I'd throw it out to the wider RSpec community.

  --
  Rick DeNatale

  My blog on Ruby
  http://talklikeaduck.denhaven2.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] Plaint Text Stories Comments in output?

2008-03-25 Thread aslak hellesoy
On Tue, Mar 25, 2008 at 5:56 PM, Corey Haines [EMAIL PROTECTED] wrote:
 Is there an easy way to get a story output that includes comment text inside
 the Scenario?


Plain text stories are parsed and turn into objects, then written out
again. There is no way to capture unknown lines for now unless you
patch it.

Aslak

 For example, I have a scenario like

 Scenario: User tries to log in with invalid credentials
 Card: 5732
 Given a visitor
  And username: invalid


 Then, be able to get a summary/output that includes the Card: 5732 line.
 Right now, they aren't output, as they are ignored by the runner.

 Thanks.
 -Corey

  --
 http://www.coreyhaines.com
 The Internet's Premiere source of information about Corey Haines
 ___
  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] story runner output

2008-03-26 Thread aslak hellesoy
On Wed, Mar 26, 2008 at 6:35 PM, Joe Van Dyk [EMAIL PROTECTED] wrote:
 Is it possible to optionally reduce the story runner output to just
  dots or something?  Lots of stories makes it difficult to see previous
  test results.


Anything is possible, but you have to implement a
progress_bar_formatter. See spec/runner/formatter/story
Unfortunately, the formatters for examples and stories are not the
same, but you can look at
spec/runner/formatter/progress_bar_formatter.rb for inspiration.

And finally you have to make the command line able to understand you
want that formatter. See spec/runner/options.rb STORY_FORMATTERS

Patches are welcome as always.

Aslak

  Joe
  ___
  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] How do you mock an object that you don't have access to?

2008-03-28 Thread aslak hellesoy
On Fri, Mar 28, 2008 at 8:12 PM, Pat Maddox [EMAIL PROTECTED] wrote:
 On Fri, Mar 28, 2008 at 11:32 AM, Luis Lavena [EMAIL PROTECTED] wrote:
   On Fri, Mar 28, 2008 at 3:25 PM, David Beckwith [EMAIL PROTECTED] wrote:
 Hi,

  How can I mock the go method of class B so that it returns the
  string fudge in this situation?

  class A
  private
   def start
 @b = B.new
   end
  end

  class B
   def go
 puts This is fun.
   end
  end

  
What about:
  
mock_b = mock(B)
mock_b.stub!(:go).and_return(true)
  
B.stub!(:new).and_return(mock_b)
  
Something like that?

  Stubbing the #new method on the class is one way to do it, as Luis mentioned.

  Another approach is to pass the object in through the constructor.
  Doing so will help you achieve looser coupling between the classes.


AKA Dependency Injection (http://martinfowler.com/articles/injection.html)

Aslak

  Pat


 ___
  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] Welcome Pat Maddox

2008-04-04 Thread aslak hellesoy
On 4/4/08, Luis Lavena [EMAIL PROTECTED] wrote:
 On Fri, Apr 4, 2008 at 11:35 AM, Patrick Meunier
 [EMAIL PROTECTED] wrote:
  This is a great news! Congratulations Pat.
 

 +1 on that, The bdd-force within Pat is strong, and is good to see he
 is joining the good side of the force :-)


Pat is a much needed and welcome member to the core team. I expect
we'll see a lot of great contribs from him in the time to come.

Welcome onboard, Pat!

Aslak

 --
 Luis Lavena
 Multimedia systems
 -
 Human beings, who are almost unique in having the ability to learn from
 the experience of others, are also remarkable for their apparent
 disinclination to do so.
 Douglas Adams
 ___
 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] Multi-line steps

2008-04-09 Thread aslak hellesoy
On Wed, Apr 9, 2008 at 12:31 PM, Tim Haines [EMAIL PROTECTED] wrote:
 Hi Ashley,

 What's your use case?  I'm curious...

 Tim.



I'm working on a Treetop (http://treetop.rubyforge.org/)
implementation of the Story parser.
Please file any suggestions for improvements to the story format to
lighthouse and tag with story_grammar

Aslak


 On 09/04/2008, Ashley Moran [EMAIL PROTECTED] wrote:
  Hi
 
  I just wondered what the plan was for multi-line steps.  Is anyone
  working on it?  I've just come across a real use for it (including
  small text files in the story).
 
  Cheers
  Ashley
 
  --
  http://www.patchspace.co.uk/
  http://aviewfromafar.net/
 
 
 
  ___
  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

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] External Dependencies (was Multi-line steps)

2008-04-09 Thread aslak hellesoy
On Wed, Apr 9, 2008 at 2:41 PM, David Chelimsky [EMAIL PROTECTED] wrote:
 On Apr 9, 2008, at 8:13 AM, aslak hellesoy wrote:

   I'm working on a Treetop (http://treetop.rubyforge.org/)
   implementation of the Story parser.

  Hey Aslak, while I love the idea of exploiting treetop for this, this
  would be our first external dependency for end users. That was one of
  the reasons I didn't use treetop in the first place - it had just been
  released and Brian suggested exporing it when I was working on Plain
  Text Stories.

  Personally, I'm in support of external dependencies, especially in
  light of recent improvements to Rubygems that make it even easier for
  a gem to manage its own dependencies. But thus far we've had an only
  slightly-less-than-official policy of no external dependencies. Has
  your thinking on this issue shifted as well?


I realize it will introduce a dependency on treetop, but now that
rubygems are ubiquotous and has largely improved with 1.1.0 I think
it's ok. It would only be needed for stories.

A treetop based parser has several benefits:

* Much simpler codebase
* Much better error messages for users. Line numbers and conflict detection.
* Easier integration with other tools (including rspec core)
* Simpler setup for story running (I have a vague plan for that in my head).

I haven't committed the code yet - for now it will live in a separate
repo on GitHub. Here is a teaser for the grammar:

grammar Story
  rule story
header narrative scenario*
  end

  rule header
'Story: ' sentence_line
  end

  rule narrative
'As a' sentence_line
  end

  rule scenario
'Scenario: ' sentence_line step*
  end

  rule step
# The various step rules are generated dynamically
'Given ' (step_1 / step_2)
  end

  # Dynamically generated rule
  rule step_1
'I am ' word ' and ' word
  end

  # Dynamically generated rule
  rule step_2
'I was ' word ' and ' word
  end

  rule word
([\w])*
  end

  rule sentence_line
(!eol .)* eol
  end

  rule eol
\n / eof
  end

  rule eof
!.
  end
end

Basically, each run will be based on a core grammar which is extended
by the user, creating extra rules for each parameterised step.
The treetop based parser would create the grammar dynamically, compile
it in-memory and use it to parse plain text stories. My first
benchmarks are pretty good - 0.03 secs to parse/compile the grammar
and less than 0.0001 secs to parse a simple story.

This is fun!

Aslak

  ___
  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] Story runner + selenium-rc + wait_for_xxxx

2008-04-16 Thread aslak hellesoy
On Wed, Apr 16, 2008 at 9:57 PM, Andy Watts [EMAIL PROTECTED] wrote:

  Hi,

  I've got a story working with selenium-rc, but am stuck writing ajax-aware
  steps.

  How are people coding their story steps to wait for an Ajax event to
  complete?


Have you asked the selenium list about this?

Aslak


  Here's what I've looked at so far.

  $browser.wait_for_element_present
  Looks Ideal, but not in selenium-ruby-client-drivers for some reason.

  def wait_for_ajax

  
 $browser.wait_for_condition(selenium.browserbot.getCurrentWindow().ServerConnection.isPending()
  == false, 2000)
  end
  This helper looked promising, but it returns
  SeleniumCommandError:
  selenium.browserbot.getCurrentWindow().ServerConnection has no properties

  Many Thanks
  Andy




  --
  View this message in context: 
 http://www.nabble.com/Story-runner-%2B-selenium-rc-%2B-wait_for_-tp16732279p16732279.html
  Sent from the rspec-users mailing list archive at Nabble.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] Mocking Net::SSH connections

2008-04-21 Thread aslak hellesoy
On Mon, Apr 21, 2008 at 8:03 AM, Jamie D [EMAIL PROTECTED] wrote:
 Hi,

  So I'm stuck again with creating a mock for Net::SSH, I've managed to
  mock the call to Net::SSH.start and yield the Net::SSH mock but I am
  totally stuck with mocking the session.shell.sync call and will also
  need to mock the shell.send_command call also. Any help much
  appreciated.


Don't mock APIs you don't own. http://rubyurl.com/53Y6

Instead - create a thin API around such APIs and have your app use
that instead. Now you have an easily mockable API.
Also make sure you have end-to-end tests that use Net::SSH without any mocking.

Aslak

  When I run the following spec I get the error:
  Mock 'Net::SSH' received unexpected message :shell with (no args)

  I've tried things like @shell = mock(Net::SSH::Service::Shell) but
  this also gives an error complaining that Service doe snot exist.

  # test code
 @connection = Ssh::Remote.new
 @ssh = mock(Net::SSH)
 Net::SSH.should_receive(:start).and_yield(@ssh)
 Net::SSH.should_receive(:shell).and_return('something')

  # library code
  require 'net/ssh'

  module Ssh
   class Remote

 def remote_command(server, user, commands=[])
   Net::SSH.start(server, user) do |session|
 shell = session.shell.sync
 commands.each do |command|
   out = shell.send_command command[:command]
 end
   end
 end
   end
  end
  ___
  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] Mocking Net::SSH connections

2008-04-21 Thread aslak hellesoy
On Mon, Apr 21, 2008 at 8:03 AM, Jamie D [EMAIL PROTECTED] wrote:
 Hi,

  So I'm stuck again with creating a mock for Net::SSH, I've managed to
  mock the call to Net::SSH.start and yield the Net::SSH mock but I am
  totally stuck with mocking the session.shell.sync call and will also
  need to mock the shell.send_command call also. Any help much
  appreciated.


Don't mock APIs you don't own. http://rubyurl.com/53Y6

Instead - create a thin API around such APIs and have your app use
that instead. Now you have an easily mockable API.
Also make sure you have end-to-end tests that use Net::SSH without any mocking.

Aslak

  When I run the following spec I get the error:
  Mock 'Net::SSH' received unexpected message :shell with (no args)

  I've tried things like @shell = mock(Net::SSH::Service::Shell) but
  this also gives an error complaining that Service doe snot exist.

  # test code
 @connection = Ssh::Remote.new
 @ssh = mock(Net::SSH)
 Net::SSH.should_receive(:start).and_yield(@ssh)
 Net::SSH.should_receive(:shell).and_return('something')

  # library code
  require 'net/ssh'

  module Ssh
   class Remote

 def remote_command(server, user, commands=[])
   Net::SSH.start(server, user) do |session|
 shell = session.shell.sync
 commands.each do |command|
   out = shell.send_command command[:command]
 end
   end
 end
   end
  end
  ___
  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] JRuby, RSpec, rcov

2008-04-21 Thread aslak hellesoy
On Mon, Apr 21, 2008 at 4:05 PM,  [EMAIL PROTECTED] wrote:
 Do you guys know of any working version combination of JRuby, RSpec and
  rcov? Doesn't look like rcov 0.8.1.2, RSpec 1.1.3, JRuby 1.1 is one of
  them.


Have you tried JRuby 1.1 + RCov 0.8.1.2 in pure mode (without RSpec?)

Aslak


  --
  Alexander
  ___
  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 Stories / Selenium Nightmare

2008-05-09 Thread aslak hellesoy
I have just git-svn'ed the code that was formerly in
http://rubyforge.org/projects/rspec-ext to GitHub:

http://github.com/aslakhellesoy

(rspec-distributed and rspec-ui)

I haven't maintained these in a while, so they might be a little
broken. Hopefully someone will clone and improve them.

FYI: The rspec-ui code was written prior to the story framework. Now
that the story framework exists, UI extensions should IMO be against
the story framework - not the RSpec example framework (describe/it).
You'll also see that I'm working on an experimental reimplementation
of the story framework, based on the excellent Treetop parser
generator. The goal of this framework is:

* Stories that are easier to run (separate command line - no need to
write all.rb files)
* Rake task
* Ability to run just one story (a --line switch)
* Before and After blocks
* i18n
* Nice backtraces that go all the way back to the plain text .story files
* Less code to maintain
* Easier to hook into for customisations (such as
Rails/Webrat/UI/Watir/Selenium/Celerity/FunFX/screenshot/etc
extensions)

Plus some other cool things I'll save for laters. A lot of the stuff
above is already implemented. Not a lot of specs for the code itself -
I've been driving it mostly by running sample stories. Don't shoot me.

Cheers,
Aslak

On Fri, May 9, 2008 at 2:17 PM, Joseph Wilk [EMAIL PROTECTED] wrote:
 I would be happy to get involved with this project.
 I'll be spending most of this year writing Rspec stories and anything
 that makes  browser testing easier will be easy to justify to my work
 colleagues.

 David Chelimsky wrote:
 On May 8, 2008, at 5:24 PM, Zach Dennis wrote:

 David,

 Can you provide any more info? Is it just being talked about or are
 people actively working on it now? I would be interested in
 assisting. I've done a lot with Selenium and the ruby driver and
 would be interested in providing beautiful high level helpers that
 allow people switch from non-Selenium based specs to Selenium-based
 specs with more ease. I know this can be a barrier for people.

 The short term plan is that Aslak will set up a spec-ui project up at
 github, at which point you, Ian Dees (who ha also expressed an
 interested in working on this), and anyone else who wishes can set up
 clones. It might take a while before there is a formal release (gem
 published to rubyforge), but at least this positions us to move
 forward with your assistance.

 I don't want to commit to a time frame, but my suspicion is that we
 should have git repo up within the next week or two.

 Cheers,
 David

 --
 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 license plate

2008-06-16 Thread aslak hellesoy
On Mon, Jun 16, 2008 at 11:52 PM, David Chelimsky [EMAIL PROTECTED] wrote:
 Cool!
 Hard to make out, but is that an Illinois plate?
 On Jun 16, 2008, at 4:39 PM, Daniel Barry wrote:


Noteworthy is also that it's a muda Toyota. -It has one pending.

Aslak

 I was driving to my parents' house this weekend and saw this in their
 neighborhood:

 http://bakineggs.com/rspec1.jpg

 Whoever owns this car is awesome in my book.
 ___
 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

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Can't access actions of a singular nested resource

2008-07-31 Thread aslak hellesoy
On Thu, Jul 31, 2008 at 4:06 PM, Bastien [EMAIL PROTECTED] wrote:
 I can't figure out what I do wrong there, I have a nested controller
 which is defined as a singular resource, the routing works properly,
 but inside my specs the request never goes through the show action.

 I keep on getting this error :

 Spec::Mocks::MockExpectationError in 'Surveys::ReportController should
 return the survey corresponding to the report'
 Mock 'Class' expected :find with (any args) once, but received it 0
 times

 In my specs :
 require File.expand_path(File.dirname(__FILE__) + '/../../
 spec_helper')
 describe Surveys::ReportController do

  it should return the survey corresponding to the report do
Survey.should_receive(:find)
get :show, :survey_id=34

Try:

get :show, :id=34

Aslak

  end

 end

 In route.rb :
 map.resources :surveys do |survey|
survey.resource :report, :controller ='surveys/report'
 end

 In controller/surveys/report_controller.rb :
 class Surveys::ReportController  ApplicationController

  def show
@survey = Survey.find(params[:survey_id])

respond_to do |format|
  format.html
  format.xml
end
  end

 end
 ___
 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] Can't access actions of a singular nested resource

2008-08-01 Thread aslak hellesoy
On Fri, Aug 1, 2008 at 10:41 AM, Bastien [EMAIL PROTECTED] wrote:
 Thanks for your help Aslak, but I still didn't manage to make it pass

 get :show, :id=34

 it sends me this error then : No route matches
 {:action=show, :controller=surveys/report, :id=34}

 Try rake routes, and also try to spec the routing in the associated
 routing_spec.rb.

 and this test passes :

  it should map { :controller = 'report', :action =
 'show', :survey_id = 1} to /survey/1/report do
  route_for(:controller = surveys/report, :action =
 show, :survey_id = 1).should == /surveys/1/report
 end

 also if I try to remove my condition the test passes so the routes
 must be correct
 it should return the survey corresponding to the report do
#Survey.should_receive(:find)
get :show, :survey_id=34, :controller =surveys/report
  end


Actually, that's a sign that you're *not* hitting the desired #show
method. Survey.find(34) will fail with RecordNotFound unless you
have a survey with id=34 in your test db (unlikely).

 Any other idea ?

Maybe you have a filter in your controller that prevents show from
being called? I'd resort to some good old puts debugging..

BTW, I just committed some specs based on your code, and they pass:
http://github.com/dchelimsky/rspec-dev/commit/9a7ce9ce371b1136380e97e34d33397966734b0f

Aslak

 ___
 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] WDYT, simple, anonymous story listeners?

2008-08-13 Thread aslak hellesoy
On Wed, Aug 13, 2008 at 2:25 AM, Zach Dennis [EMAIL PROTECTED] wrote:
 Sometimes I don't have a full need to make a class to do something,
 yet I want something readable and concise. This is influenced from the
 joys of JavaScript.

 Today I made this happen. Love it, like it, hate it, WDYT?


As mentioned earlier on the RSpec development list, we're considering
replacing the Story runner with a new implementation:

http://github.com/aslakhellesoy/cucumber
http://gojko.net/2008/08/06/cucumber-next-generation-ruby-bdd-tool/
http://www.nabble.com/-ANN--Cucumber-td18876816.html

I'd rather see a similar construct for Cucumber, which already is
(IMHO) much better than the Story Runner.

Before(:all) do
end

After(:all) do
end

(per-scenarion Before/After is already implemented).

Aslak

 Spec::Story::Runner.register_listener FunctionalStruct.new(
  :run_started = lambda { |*args|
Generate.user(:login = normal user)
  },
  :run_ended = lambda { |*args|
  User.destroy_all
  },
  :method_missing = lambda { |*a| }
 )


 --
 Zach Dennis
 http://www.continuousthinking.com
 http://www.mutuallyhuman.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] WDYT, simple, anonymous story listeners?

2008-08-13 Thread aslak hellesoy
On Wed, Aug 13, 2008 at 5:18 PM, Zach Dennis [EMAIL PROTECTED] wrote:
 On Wed, Aug 13, 2008 at 11:00 AM, aslak hellesoy
 [EMAIL PROTECTED] wrote:
 On Wed, Aug 13, 2008 at 4:50 PM, Zach Dennis [EMAIL PROTECTED] wrote:
 On Wed, Aug 13, 2008 at 8:29 AM, aslak hellesoy
 [EMAIL PROTECTED] wrote:
 On Wed, Aug 13, 2008 at 2:25 AM, Zach Dennis [EMAIL PROTECTED] wrote:
 Sometimes I don't have a full need to make a class to do something,
 yet I want something readable and concise. This is influenced from the
 joys of JavaScript.

 Today I made this happen. Love it, like it, hate it, WDYT?


 As mentioned earlier on the RSpec development list, we're considering
 replacing the Story runner with a new implementation:

 http://github.com/aslakhellesoy/cucumber
 http://gojko.net/2008/08/06/cucumber-next-generation-ruby-bdd-tool/
 http://www.nabble.com/-ANN--Cucumber-td18876816.html


 I'd rather see a similar construct for Cucumber, which already is
 (IMHO) much better than the Story Runner.


 Before(:all) do
 end

 After(:all) do
 end

 (per-scenarion Before/After is already implemented).


 When you say rather see a similar construct -- are you referring to
 having the Before(:all) and After(:all) capability that you posted, or
 something similar to what I posted with using a FuncionalStruct as an
 argument to register a listener on the existing StoryRunner (a
 clear/concise way to hook-in with those one off listeners) ?


 By similar construct I meant something that achievs the same goal
 (running pieces of code at different times during the run).

 I suggested Before(:all) and After(:all) because:

 * It's a familiar concept from RSpec examples
 * It's much easier to read/write

 Compare these:

 # Your suggestion
 Spec::Story::Runner.register_listener FunctionalStruct.new(
  :run_started = lambda { |*args|
Generate.user(:login = normal user)
  }
 )

 # My suggestion:
 Before(:all) do # We can pass args to the block if we want to
  Generate.user(:login = normal user)
 end


 Before/After is definitely much cleaner, although I'm not a fan of
 more global namespace pollution, but it may not be a problem in
 practice (and/or maybe it's scoped in to another namespace like
 Feature::Before(:all))


I've thought about that a bit, and decided that I want to keep it
global (because it means less typing and looks nicer) until it poses a
problem to someone.

 Are you thinking of allowing for multiple Before/After(:all) blocks?


Definitely. Before/After (without :all) already supports multiple.

Aslak

 --
 Zach Dennis
 http://www.continuousthinking.com
 http://www.mutuallyhuman.com

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Documentation for Plain-Text Stories

2008-08-18 Thread aslak hellesoy
On Tue, Aug 12, 2008 at 6:45 PM, Matt Wynne [EMAIL PROTECTED] wrote:
 Can I help the project by writing some docs about the plain-text story
 runner for the rspec.info website? It would surely help me to get it wired
 in my own mind if I have to write it up for the world.
 Would this be helpful / appreciated?
 What format would you want them in?


The RSpec Story runner is likely to be deprecated in favour of the new
feature runner (temporarily called Cucumber).
http://www.nabble.com/-ANN--Cucumber-td18876816.html

The RSpec Story runner will continue to exist for a while, I just
wanted to let you know that future development and documentation
efforts will be focused on Cucumber. Cucumber also has some
documentation and examples on Github, more specifically:

* How to use without Rails
* How to use with Rails+Webrat
* How to use with Watir

Please let me know if you'd like to help out documenting Cucumber. One
thing that is missing is a migration guide from RSpec Story runner.

Cheers,
Aslak

 cheers,
 Matt

 ___
 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] Documentation for Plain-Text Stories

2008-08-18 Thread aslak hellesoy
On Mon, Aug 18, 2008 at 1:06 PM, Matt Wynne [EMAIL PROTECTED] wrote:

 The RSpec Story runner is likely to be deprecated in favour of the new
 feature runner (temporarily called Cucumber).
 http://www.nabble.com/-ANN--Cucumber-td18876816.html


 And this is going to be distributed as a separate plug-in from RSpec?

For the time being it is in a separate Git repo. It can be built as a
gem and installed as a gem. Rails users can also install it as a
plugin.

We haven't decided yet whether it will continue to be in a separate
repo or added to the RSpec codebase. From a maintenance perspective I
think it's easier to keep things separate and small than lump
everything together in a big codebase. From a Rails user perspective
it means you need to install 3 plugins instead of 2
(RSpec+RSpec-Rails+Cucumber).

What do you think is the best thing to do?

Aslak

 ___
 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] Documentation for Plain-Text Stories

2008-08-18 Thread aslak hellesoy
On Mon, Aug 18, 2008 at 1:24 PM, Matt Wynne [EMAIL PROTECTED] wrote:
 I think it's better to make them separate. Conceptually, the story runner
 slightly confuses the identity of what RSpec is - is it for specifying
 behaviour of individual classes (a la TDD) or is it for specifying the
 behaviour of the whole system? I think the describe / it / should thing is
 powerful enough in its own right as a way to express behaviour of individual
 classes. Coming from writing XUnit tests I absolutely love it - it's such a
 natural way to describe the desired behaviour.

 Presumably you might also end up needing something like a Cucumber-Rails
 plugin, or are you envisaging tying Cucumber to rails?


Cucumber is not tied to Rails at all - it is  designed to work with
any Ruby code (including JRuby and hopefully soon other Rubies).
However, Cucumber comes with a couple of hooks for Rails, which in
turn have a dependency on RSpec-Rails:

http://github.com/aslakhellesoy/cucumber/tree/master/lib/cucumber/rails/rspec.rb
http://github.com/aslakhellesoy/cucumber/tree/master/lib/cucumber/rails/world.rb

When you use Cucumber's generators to set it up in a Rails project (as
described in the README), these hooks are enabled by default.

Aslak

 cheers,
 Matt
 
 http://blog.mattwynne.net
 http://songkick.com

 In case you wondered: The opinions expressed in this email are my own and do
 not necessarily reflect the views of any former, current or future employers
 of mine.

 On 18 Aug 2008, at 12:11, aslak hellesoy wrote:

 On Mon, Aug 18, 2008 at 1:06 PM, Matt Wynne [EMAIL PROTECTED] wrote:

 The RSpec Story runner is likely to be deprecated in favour of the new
 feature runner (temporarily called Cucumber).
 http://www.nabble.com/-ANN--Cucumber-td18876816.html


 And this is going to be distributed as a separate plug-in from RSpec?

 For the time being it is in a separate Git repo. It can be built as a
 gem and installed as a gem. Rails users can also install it as a
 plugin.

 We haven't decided yet whether it will continue to be in a separate
 repo or added to the RSpec codebase. From a maintenance perspective I
 think it's easier to keep things separate and small than lump
 everything together in a big codebase. From a Rails user perspective
 it means you need to install 3 plugins instead of 2
 (RSpec+RSpec-Rails+Cucumber).

 What do you think is the best thing to do?

 Aslak

 ___
 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

 ___
 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] Documentation for Plain-Text Stories

2008-08-18 Thread aslak hellesoy
On Mon, Aug 18, 2008 at 2:29 PM, aidy lewis [EMAIL PROTECTED] wrote:
 Hi Aslak


 2008/8/18 aslak hellesoy [EMAIL PROTECTED]:
 * How to use with Watir

 gem sources --add http://gems.github.com/
 gem install aslakhellesoy-cucumber

 I am unable top find the Watir and Cucumber example


I may have forgotten to include the examples in the gem. Until I get
it fixed and push a new gem - try to get the source from Git instead:

git clone git://github.com/aslakhellesoy/cucumber.git

Look in the examples/watir directory:
http://github.com/aslakhellesoy/cucumber/tree/master/examples/watir

Aslak

 Aidy
 ___
 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] Documentation for Plain-Text Stories

2008-08-18 Thread aslak hellesoy
On Mon, Aug 18, 2008 at 3:02 PM, aidy lewis [EMAIL PROTECTED] wrote:
 Aslak

 Look in the examples/watir directory:
 http://github.com/aslakhellesoy/cucumber/tree/master/examples/watir

 Aslak

 OK. Can I expand on this for your example?


What do you mean by expand?

Aslak

 Aidy
 ___
 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] Documentation for Plain-Text Stories

2008-08-18 Thread aslak hellesoy
On Mon, Aug 18, 2008 at 3:31 PM, aidy lewis [EMAIL PROTECTED] wrote:
 Aslak

 2008/8/18 aslak hellesoy [EMAIL PROTECTED]:


 What do you mean by expand?

 Aslak


 I was going to give a more detailed example...


That would be awesome. If you're familiar with Git you can clone my
Cucumber and commit your changes to your clone. If not I'll accept a
patch. Just put it in RSpec's Lighthouse and tag it with cucumber

Aslak

 Aidy
 ___
 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] Documentation for Plain-Text Stories

2008-08-18 Thread aslak hellesoy
On Mon, Aug 18, 2008 at 9:46 PM, Jim Morris [EMAIL PROTECTED] wrote:
 aslak hellesoy wrote:


 The RSpec Story runner is likely to be deprecated in favour of the new
 feature runner (temporarily called Cucumber).
 http://www.nabble.com/-ANN--Cucumber-td18876816.html

 This is REALLY bad news!! I asked this question a while back, I have a LOT
 of code using story runner, I have committed to do all my integration
 testing via stories, although the ruby style ones not the plain text ones.


Calm down.

You are not the only one who has invested in stories - plain text or
Ruby. I am also involved in a couple of projects that has lot of RSpec
stories. This is actually the main reason I wrote Cucumber - I got
tired of many of the shortcomings that I have outlined at the bottom
of Cucumber's README.

Nobody is going to delete the RSpec story runner. (Some said taking
something off the Internet is like taking pee out of a swimming pool).
For what I know it will still be available for download 20 years from
now. I am only making people aware of Cucumber and encouraging them to
invest in improving it rather than the old one.

I realise that in order for people to be able to make the switch
painlessly, there needs to be good documentation - both about how to
migrate old style stories and also general documentation about how to
use Cucumber. I intend to provide most of this, and welcome others to
join in. The code also needs to be more or less of a drop-in
replacement, and one of my primary goals going forward is to make it
exactly that.

FYI - Cucumber already supports pure Ruby style. It's not 100% similar
to RSpec Story runner in pure Ruby mode, but close.
http://github.com/aslakhellesoy/cucumber/tree/master/examples/calculator_ruby_features

I'm inviting you to provide some constructive feedback about how we
could improve it to make the transition easier for people like
yourself.

A natural part of software evolution is that every now and then a
tool, library or program gets replaced by something better. While it's
certainly possible to maintain two different products, it takes a lot
more time. Time that I don't have. Am I to understand from your email
that you're stepping up and offering to help maintain and govern the
future of the story runner?

 To hear that they will be deprecated is not good news, and will cause me a
 lot of grief if I have to rewrite several thousand lines of code, or I
 simply won't be able to use the latest RSpec.


What exactly is your understanding of deprecation and how have you
concluded that you will have rewrite several thousands of LOC?

 I suggest that cucumber stay separate, and RSpec keep the story runner,
 either as core or as an add on.

 Deprecating something that is being used extensively will not make your
 users happy.


What David said.

Aslak


 --
 Jim Morris, http://blog.wolfman.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] Documentation for Plain-Text Stories

2008-08-20 Thread aslak hellesoy
On Wed, Aug 20, 2008 at 8:32 AM, Jim Morris [EMAIL PROTECTED] wrote:
 Aslak Hellesøy wrote:


 I'd like to have a before story and after story as well as a before
 scenario and after scenario.

 Right now I do global setup for a story, and cleanup when the story is
 done. I also do a setup before each scenario as well.

 It would be nice to have the ability to do both.

 Can you give me a code example? (In Cucumber it's Feature, not Story)


 An example of how I would use it or an example of how to do it?


Of how you would use it. Assume that you have something like this for
scenario-level before/after:

class MySteps  Cucumber::Steps # Same as Story runnner steps_for(:my)
 Before do
   # This block will run before all scenarios that use steps from MySteps
   # Any scenarios not using any of these will not have this block run
 end

 Given /bla bla/ do
 end
end

Aslak

 Right now I use the listeners to call a before_story and after_story and
 before_scenario.

 My Stories (Features) test the database as well as the return values of
 various calls, so the before_story sets up the database accessors via
 Sequel, putting them in global variables so I can easily access them from
 anywhere.

 In the before_scenario I for instance make sure the user is logged out and
 the database is cleared.

 --
 Jim Morris, http://blog.wolfman.com

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Story Runner Example with Watir

2008-08-20 Thread aslak hellesoy
On Wed, Aug 20, 2008 at 2:19 PM, aidy lewis [EMAIL PROTECTED] wrote:
 Lies here

 gem install watir

 http://wiki.openqa.org/display/WTR/Example+Frameworks

 I will need to port this to Cucumber


That would be great!

Would you consider storing the code in Cucumber's watir example
directory? examples/watir_gmail. That way it's easier to maintain if
Cucumber changes.'

You can clone my cucumber git repo and commit/push it to your clone
and let me merge it into the official cucu8mber repo (mine). Or you
can upload a zip in RSpec's Lighthouse and tag it with cucumber and
watir. I'll then add it straight to my Cucumber git repo.

I realize Watir users may want a separate zip download, but it would
still be nice to have the official example live in an SCM I have
access to.

Cheers,
Aslak

 Feedback Welcome.

 Aidy
 ___
 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] Documentation for Plain-Text Stories

2008-08-20 Thread aslak hellesoy
On Wed, Aug 20, 2008 at 4:20 PM, David Chelimsky [EMAIL PROTECTED] wrote:
 On Wed, Aug 20, 2008 at 9:04 AM, Jonathan Linowes
 [EMAIL PROTECTED] wrote:

 On Aug 20, 2008, at 2:20 AM, Aslak Hellesøy wrote:

  (In Cucumber it's Feature, not Story)

 no offense, but while you're being picky about names, I dont see too much
 difference between 'story' and 'feature'

 I see them as very different.

 User Stories are inputs to a development process and Features are the outputs.


That's a brilliant description. Much better than these ramblings:
http://www.nabble.com/Re%3A--ANN--Cucumber-p18899320.html

I would add to that that the features, which are the outputs of the
development process, are the inputs to the outcomes. AKA Business
value.
These two posts complement that aspect nicely:

http://www.artima.com/weblogs/viewpost.jsp?thread=183405
http://sirenian.livejournal.com/2008/05/14/

Regarding Cucumber - yes, the name is completely meaningless, but a
couple of chicks who attended my presentation about it at Agile 2008
told me afterwards it made their mind drift... That's good enough for
me.

Aslak

 When I've worked with FitNesse, we had stories on cards and a suite of
 FitNesse tests. Sometimes a Story would come up in an iteration that
 was an enhancement of an existing feature. In those cases we did not
 add new FitNesse tests, but simply enhanced the existing ones instead.
 So the FitNesse test suite grew to represent executable documentation
 of an existing system, not a tracking system for stories over the
 course of iterations.

 Had we grouped all the FitNesse tests by the stories as they came in,
 in which iteration, etc, etc, they would have been much more difficult
 to navigate and maintain.

 Automated scenarios live in the same place that FitNesse tests do.
 Ideally, we would group them by Story going into an iteration and then
 by Feature coming out, but we don't really have a good way of doing
 that.

 Maybe the right approach would be to group them by neither Story nor
 Feature, but rather by execution context. For example, right now I've
 got stories that run one happy path scenario and one error path
 scenario that run in-browser, accompanied by a more exhaustive set of
 error path scenarios that run in-memory. These live in separate Story
 files and are only coupled together by their names.

 It would be nice if I could have a suite of in-browser scenarios, a
 suite of in-memory scenarios that touch the full stack (in rails), and
 possibly a suite of scenarios that touch only a given model. Then each
 scenario can be tagged to a Story and a Feature, and the runner could
 support running everything by Story, Feature or Execution Context,
 thus supporting readability, navigability, etc, from a number of
 useful perspectives.

 WDYT?

 but 'cucumber' is a really random meaningless name

 ___
 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

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Documentation for Plain-Text Stories

2008-08-21 Thread aslak hellesoy
On Wed, Aug 20, 2008 at 6:24 PM, Ben Mabey [EMAIL PROTECTED] wrote:
 aslak hellesoy wrote:
 The RSpec Story runner is likely to be deprecated in favour of the new
 feature runner (temporarily called Cucumber).
 http://www.nabble.com/-ANN--Cucumber-td18876816.html

 The RSpec Story runner will continue to exist for a while, I just
 wanted to let you know that future development and documentation
 efforts will be focused on Cucumber. Cucumber also has some
 documentation and examples on Github, more specifically:

 * How to use without Rails
 * How to use with Rails+Webrat
 * How to use with Watir

 Please let me know if you'd like to help out documenting Cucumber. One
 thing that is missing is a migration guide from RSpec Story runner.




 Do you prefer to keep such documentation in the README or would a github
 wiki be better?


Good idea, I have moved the README.textile to
http://github.com/aslakhellesoy/cucumber/wikis/home

Everyone here is welcome to edit it. If you have concrete experience
(or wishes) about how to migrate existing stories to Cucumber this
would be the place to do it.

Aslak

 -Ben
 ___
 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] story vs feature (was Documentation for Plain-Text Stories)

2008-08-25 Thread aslak hellesoy
On Mon, Aug 25, 2008 at 5:12 PM, Jonathan Linowes
[EMAIL PROTECTED] wrote:

 On Aug 24, 2008, at 12:31 PM, David Chelimsky wrote:

 In terms of the feature (which is the report), I see this as just
 another scenario.

 In terms of driving development and estimating effort, I see this as a
 new User Story.

 Does this clarify or further confuse?



 I see your scenario of 499 registrants as a new feature of the existing
 story :)


In light of what David and I have said previously, I would express it
exactly the other way around:

The scenarios in this user story describe an expansion of the
existing feature.

In other words, the story (and its scenarios) are inputs to the
development. The output is a fatter feature.

Aslak


 ___
 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] story vs feature (was Documentation for Plain-Text Stories)

2008-08-25 Thread aslak hellesoy
On Mon, Aug 25, 2008 at 5:37 PM, Jonathan Linowes
[EMAIL PROTECTED] wrote:

 On Aug 25, 2008, at 11:19 AM, aslak hellesoy wrote:

 On Mon, Aug 25, 2008 at 5:12 PM, Jonathan Linowes
 [EMAIL PROTECTED] wrote:

 On Aug 24, 2008, at 12:31 PM, David Chelimsky wrote:

 In terms of the feature (which is the report), I see this as just
 another scenario.

 In terms of driving development and estimating effort, I see this as a
 new User Story.

 Does this clarify or further confuse?



 I see your scenario of 499 registrants as a new feature of the existing
 story :)


 In light of what David and I have said previously, I would express it
 exactly the other way around:

 The scenarios in this user story describe an expansion of the
 existing feature.

 In other words, the story (and its scenarios) are inputs to the
 development. The output is a fatter feature.

 Aslak

 Aslak, so in terms of the cucumber runner and BDD development process, where
 would you add the scenario? reopen an existing .story file?


Yes, add it to an existing .feature file (or create a new one if the
story's scenario don't fit in an existing feature).

Aslak



 ___
 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

 ___
 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] Documentation for Plain-Text Stories

2008-08-27 Thread aslak hellesoy
On Thu, Aug 21, 2008 at 6:08 PM, Joseph Wilk [EMAIL PROTECTED] wrote:
 Hello,

 I've been looking through the cucumber documentation and have a couple
 of questions.


Hi, Sorry for the late reply,

 I'm curious which of the disadvantages you list would be impossible/very
 difficult in the classic story runner. I'm just trying to envisage if

From http://github.com/aslakhellesoy/cucumber/wikis - 10 means big
effort, 1 small. Relatively. Your opinion may differ.

5: Hard to get started with. A special all.rb file must be
written before it can be used.
3: No out of the box Rake support, which puts a lot of people off.
3: No i18n, so if you want to write stories in a different
language than English you're out of luck.
8: Poor error reporting. No way to know on what line a plain text
story failed during execution or parsing.
1: Limited colouring of output.
5: No simple way to execute only one scenario.
8: No command line tool to run stories.
2: No easy before or after hooks.
5: No highlighting of step parameters in the output
2: No detection of ambiguous step names

 Cucumber and the classic story runner where to co-exist what would the
 Cucumber plugin be able to do that the classic story runner could never

I assume that by plugin you mean Rails plugin? (Cucumber is a
standalone library that *may* be used as a Rails plugin).

 realistically hope to achieve.


The Story runner could achieve this if someone put enough effort into
it. That would have to be someone other than me, because I don't have
the time (or desire) to do it. Let's say it's up for grabs.

 Also looking at one of your disadvantages:
 * 'Limited colouring of output'
 I've been playing around with patches here and there to improve the
 colour of the classic story runner formatters. Do you still see
 limitations in this as it is in edge?


That's one of the easiest things to fix, and also one of the smallest
disadvantages IMO.

 My final question is about the Rspec book. I've no idea when this will
 be released or what pressures there are on publish deadlines. How much
 would this effect a move to Cucumber (avoiding having redundant story
 examples in the book when we all use Cucumber)?


Regarding the book - we haven't decided whether or not to cover Cucumber.

In any case, *writing* stories/features for the Story runner will be
almost identical to Cucumber features.

On Tuesday I ported one of our projects at work over to Cucumber. Over
1000 steps. I ended up having to change almost nothing in the text or
step defs (except for resolving some duplicates and ambiguities that
Cucumber complains about where RSR says nothing). I have written up
what I did and will post it to the Cucumber wiki next week when I have
some time to proofread it.

Cheers,
Aslak

 Thanks,
 --
 Joseph Wilk
 http://www.joesniff.co.uk
 aslak hellesoy wrote:
 On Wed, Aug 20, 2008 at 6:24 PM, Ben Mabey [EMAIL PROTECTED] wrote:
 * How to use without Rails
 wiki be better?


 Good idea, I have moved the README.textile to
 http://github.com/aslakhellesoy/cucumber/wikis/home

 Everyone here is welcome to edit it. If you have concrete experience
 (or wishes) about how to migrate existing stories to Cucumber this
 would be the place to do it.

 Aslak

 --
 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] Cucumber: Running a single feature / scenario

2008-09-01 Thread aslak hellesoy
On Mon, Sep 1, 2008 at 9:45 PM, David Chelimsky [EMAIL PROTECTED] wrote:
 On Mon, Sep 1, 2008 at 12:08 PM, Matt Wynne [EMAIL PROTECTED] wrote:
 Am taking cucumber for a first spin today - first impressions are good.
 How do I go about running a single feature or scenario so I don't have to
 run the whole lot when I'm working on a particular one?

 There's no support for this yet in Story Runner or Cucumber. Feel free

Yes there is. It's been in Cucumber for at least a month.

 to add a feature request at
 http://rspec.lighthouseapp.com/projects/16211.

cucumber --help

Example:

cucumber path/to/file.feature --line 33

Or with Rake:

rake features FEATURE=path/to/file.feature CUCUMBER_OPTS=--line 33

It's not documented on the Wiki yet. Pass the line number of one of
the steps. I think it's broken when GivenScenario is involved.

Aslak

 ___
 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


  1   2   3   4   5   >