Re: [rspec-users] autotest giving error when having shared example in specs

2011-01-11 Thread Andrea Reginato
I'm sure is not the best solution, but I solved the problem creating an 
Initializer monkey patching the method giving the error. I'm pretty new 
on Ruby and company, as always scratching the surface, and only now 
getting into the deep, but I hope it will help.

# extract config/initializers/rspec_hacks.rb
module RSpec
  module Core
module SharedExampleGroup
private
  def ensure_shared_example_group_name_not_taken(name)
  end
end
  end
end

-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


[rspec-users] calbacks on models

2011-03-02 Thread Andrea Reginato
Hi, I'm having some strange behavior on callbacks when testing with
RSpec2. On my test, when I create a resource using the #create method
the callbacks related to #before_create are not called. If I go to the
console and I try to type the command Resource.create(client_uri:
"http://example.com";) all works fine.

There are no mocks around, and I can't understand if this is a normal
behavior using RSpec, if its due to Mongoid or something else.

  # resource.rb (model)
  class Resource
include Mongoid::Document
before_create :random_code, :create_expiration

  # resource_rspec.rb (testing suite)
let(:resource)  { Resource.create(client_uri: "http://example.com";)

Thanks a lot

-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users