On Dec 5, 2011, at 3:53 PM, Gordon wrote:
> 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
> _______________________________________________
> rspec-users mailing list
> [email protected]
> 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/view-specs/view-spec#6
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users