I'm having issues now that i've added devise to my web app, theres a few SO questions on this but they just all point to a readme file and don't actually provide any fixes. I've had to include devise helpers as shown below in order to remove an issue saying the authentication method didn't exist
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
include Devise::TestHelpers
end
If i don't include it i end up with a huge amount of authentication errors:
ActionView::Template::Error: undefined method `authenticate' for nil:NilClass
but if it is included
NoMethodError: undefined method `env' for nil:NilClass
Simply occurs in different places instead, is there an actual fix?
Example
ContactMailerTest#test_should_return_contact_email:
NoMethodError: undefined method `env' for nil:NilClass
Method:
test "should return contact email" do
mail = ContactMailer.contact_email("Email@Email.com", "Example",
"SomeExample", @comment = "Hello")
assert_equal ['info@mynotes.com'], mail.to
assert_equal ['info@mynotes.com'], mail.from
end
This appears to be an issue with "Apparently there are issues with Devise::TestHelpers and integration testing" i am wondering if there is any known fix
Thanks!
Aucun commentaire:
Enregistrer un commentaire