RSpec 3

16 views
Skip to first unread message

Dwayne Macgowan

unread,
Aug 9, 2011, 6:28:34 PM8/9/11
to rub...@googlegroups.com
Estoy recibiendo este warning: 

*****************************************************************
DEPRECATION WARNING: you are using deprecated behaviour that will
be removed from RSpec 3.

You have set some configuration options after an example group has
already been defined.  In RSpec 3, this will not be allowed.  All
configuration should happen before the first example group is
defined.  The configuration is happening at:

  /home/dwaynemac/padma-ws/planning/ws/spec/models/../spec_helper.rb:13
*****************************************************************

Este es mi spec_helper.rb


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# require 'capybara/rspec'
require 'shoulda'
require 'blueprints'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

RSpec.configure do |config|
  # == Mock Framework
  #
  # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
  #
  # config.mock_with :mocha
  # config.mock_with :flexmock
  # config.mock_with :rr
  config.mock_with :rspec

  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  # using Machinist config.fixture_path = "#{::Rails.root}/spec/fixtures"

  # If you're not using ActiveRecord, or you'd prefer not to run each of your
  # examples within a transaction, remove the following line or assign false
  # instead of true.
  config.use_transactional_fixtures = true

  config.before(:each) do
    padma_account = PadmaAccount.new(:name => "mockedAccount")
    PadmaAccount.stub!(:find).and_return(padma_account)

    Timecop.return # reset Timecop
  end

end

Qué es lo que debería cambiar?


---
Dwayne


Alejandro González

unread,
Aug 9, 2011, 6:42:47 PM8/9/11
to rub...@googlegroups.com
Sin mucha información de respaldo me atrevería a decir que es por el config.before(:each)

2011/8/9 Dwayne Macgowan <dway...@gmail.com>



--
Saludos,
Jano González

Ricardo Markiewicz

unread,
Aug 9, 2011, 7:29:07 PM8/9/11
to rub...@googlegroups.com
On Tue, Aug 9, 2011 at 7:28 PM, Dwayne Macgowan <dway...@gmail.com> wrote:
>
> Estoy recibiendo este warning:
> *****************************************************************
> DEPRECATION WARNING: you are using deprecated behaviour that will
> be removed from RSpec 3.
> You have set some configuration options after an example group has
> already been defined.  In RSpec 3, this will not be allowed.  All
> configuration should happen before the first example group is
> defined.  The configuration is happening at:
>   /home/dwaynemac/padma-ws/planning/ws/spec/models/../spec_helper.rb:13
> *****************************************************************
> Este es mi spec_helper.rb

https://github.com/rspec/rspec-rails/issues/371 segun entiendo el
problema es cuando no usas require 'spec_helper' en el spec file, a
mi cambiando los require File.expand_path(File.dirname(__FILE__) +
'/../spec_helper') por el require simple se me soluciono en su
momento.

--
--
Ricardo Markiewicz
http://www.gazer.com.ar/

Alejandro González

unread,
Aug 9, 2011, 8:51:03 PM8/9/11
to rub...@googlegroups.com
Nunca más digo algo si información de respaldo, jaja. 

2011/8/9 Ricardo Markiewicz <gaze...@gmail.com>
Reply all
Reply to author
Forward
0 new messages