Rails Tests Fail With Sqlite3 - ruby-on-rails

I seem to be getting a strange error when I run my tests in rails, they are all failing for the same reason and none of the online documentation seems particularly helpful in regards to this particular error:
SQLite3::SQLException: cannot rollback - no transaction is active
This error is crippling my ability to test my application and seems to have appeared suddenly. I have the latest version of sqlite3 (3.6.2), the latest sqlite3-ruby (1.2.4) gem and the latest rails (2.1.1).

Check http://dev.rubyonrails.org/ticket/4403 which shows a workaround. Could that be the problem you are encountering?

I had this problem once but with MySQL. Turned out I hadn't created the test database. Doh! Rails and sqlite creates them automatically I believe (at least it does in windows).
Are trying to do in memory testing? If not does the test database exist?

I got this error when running a test with the last statement being a click on a form submit. Once I did an assertion or should test, the test closed properly, and I didn't have to rerun the rake db:test:prepare

Thanks for the help. I actually ended up just deleting the rails folder and checking back out the last working copy from version control. I've made the identical changes and this problem hasn't reappeared, so either I messed up or rails had some sort of hiccup. Thankfully I had version control :-)

Related

Rails version clarification

I'm currently working out of the book Agile Web Development with Rails (Fourth edition) and it instructs users to use rails version 3.2.0.
I am getting an error when running "rake test" (see below)
http://pastebin.com/RZeWvFYf
After doing some looking around, it appears that this is a bug caused by my rails version.
I would like to fix this massive error dump, but it seems my only answer is to change rails version. I'd like to know if its safe to do so, or if there is a fix I didn't know about.
Thanks!
Edit- full rake about results
http://pastebin.com/yBSnjUt7
(refuses to work in code tags)

jazz_hands gem breaks history in rails console

I've started using jazz_hands to make my Rails console more useful, but now line/history editing is broken. When I run over the end of the line (ie, wrap), or use up arrow to go into history, the output is garbled.
Terminal settings are fine for everything else, Ubuntu 12. Any ideas? I'm hoping it's something simple and I'm not the first developer to bump into this, but there's nothing in the FAQ, or in the various related Gems (pry etc), and I'm loathe to raise a bug on the project until I check this isn't a well known issue.
It's fixed in the latest update, but here's a few workarounds if for some reason you can't update.
https://github.com/nixme/jazz_hands/issues/1

Rake test suddenly stopped working

I have been working with my rails application and since today I have not been able to run rake test:units
I though maybe my Ruby installation is broken or something, so I tried creating a new application, created a new model quickly, wrote a couple of unit test and then ran them. Everything seems to be running fine with the new app.
Please check the error log generated here http://pastebin.com/jgNXpXE3
Seems there's a bug in your Product model. Do you have a call to validates without any parameters passed to it?
http://api.rubyonrails.org/classes/ActiveModel/Validations/ClassMethods.html#method-i-validates

Turn on html_safe for the entire app in Rails 3

Rails 3 turns off the html_safe option by default. I want to revert this thing. I have a rails 2.3.8 app getting converted to rails 3. Almost every page breaks because of the rails3 default html_safe setting. Is there any way I can revert this to where it was in previous versions of rails ? Please help
No, there isn't and even if there is, you shouldn't.
It's a good habit to test (and update) your app using the rails_xss plugin in Rails 2.3.x before actually starting the conversion to Rails 3.
Also, you should have a valid test suite in place so that every error will be spotted by the test suite and you can easily fix it.
Don't try to upgrade unless you have completed these two simple steps. There are also a few other suggestions.
As a side note: Current versions of Rails 3 HTML-escape also non-HTML templates, which is a bug. See: https://rails.lighthouseapp.com/projects/8994/tickets/4858
I'm posting this here, because I found this question while investigating the bug mentioned above, but didn't fine that ticket or anything about this bug on the interwebs. (Bad google skills?) Hope it saves someone time.

Rails app unable to save anything after deployment

today I uploaded my app to server, and after seting it into development mode, and running of course rake tasks (rake db: migrate, and rade db: migrate RAILS_ENV="production") and well it just doesn't save anything.
The problem happens when I try to create any new items, it just goest to the listing of models...
Your question is very vague. I believe you're saying the app writes files to the server's hard drive. If that's what you're asking, I think the best guess is that something's wrong with file system permissions. Unfortunately, I can't say what is wrong without more details.
i solved it.
reason i asked was because i absolutely went through each and every one of my potential problems and took care of them, and well in the end none of them were the reason of such a failure. so then i went to the basics
and i basically had to clone my development environment on the production machine.
so i had to downgrade rails a couple of versions, and some gems too.
that took care of it, everything went on smoothly, so if anyone ever encounters such mysterous failures, give this a try.

Resources