Hi, there,
I have some methods which I have written as helpers.
They are in spec/support/controller_macros.rb (yes, I will change the
name soon).
The 2 methods, login_user and login_admin_user works in the
controller specs BUT fail to work in the view specs when I call them
in the view specs.
---------- spec/spec_helper.rb start --------------------------
# 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 'webrat'
# 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|
config.include Devise::TestHelpers, :type => :controller
config.extend ControllerMacros, :type => :view
config.extend ControllerMacros, :type => :controller
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end
---------- spec/spec_helper.rb end --------------------------
i am already extending it to the view (ie. 'config.extend
ControllerMacros, :type => :controller').
What am I missing?
Thank you
Gordon
on 2011-12-06 00:19
on 2011-12-06 03:07
On Dec 5, 2011, at 3:53 PM, Gordon wrote: > ---------- spec/spec_helper.rb start -------------------------- > Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} > end > end > > Gordon > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users What are you trying to do in the methods? You can probably just stub what you need: https://www.relishapp.com/rspec/rspec-rails/docs/v...
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.