Rails test unit access denied rename - ruby-on-rails

I'm new here. I search everywhere and I haven't found anything. I'm using rails on windows 10. I'm following the basic tutorial of a sample app. When I execute "rails test" command in the console I get the following errors. I checked the permissions of each file and directory and all have the permissions needed. Can someone help me ?
I'm using rails 6.0.2.2 version.
Hope I'll get answer here.
Solution : I installed ubuntu on windows 10.

Stop your rails server before executing your tests: the server is keeping cache files locked and the testing framework is trying to alter them.
I encountered the same issue (while following what's probably the same tutorial you were following) on Rails 6.0.3.4 on Windows 10 and doing so solved it. (launching the server again before executing tests reproduced it again)
Update: I thought this was a complete solution, but it's more complex than that. Here's my experience:
running rails test while rails server is running results in the error;
running rails test when rails server is not running sometimes results in the error.
I haven't encountered this error on Linux so far, so my guess is that the implementation of Rails of Windows is unstable and sometimes gets stuck locking its own files.
You can check if you can reproduce the same behaviour, but I would report it as a bug.

Related

Errno::ENOENT: No such file or directory - bs_fetch:open_current_file:open - Ruby on Rails Win10

I'm getting an error that prevents me from using rails on Windows 10.
I just created the project using ruby 3.1.2p20 with rails 7.0.3.1. For some reason, I can get the rails version but not run any other commands. I get a massive unreadable stack of libraries failing one after another. The name of the error and error message say nothing useful, as well as the internet.
What can I do? I am trying to work on this project with a colleague that uses a linux-based system.

How To:Debugging Rails 3.1.x app(Ruby 1.9.3) on Aptana Studio3 in Ubuntu

Is rails debugging supported on Aptana Studio 3. I have earlier debugged Rails applications on Aptana Studio2 with the embedded browser and embedded servers.
1)How to start rails application in Debug Mode?
2)How to enable remote debugging in firefox?
My work environment is as follows and I have been using RVM
Rails 3.1.x
Ruby 1.9.3
Ubuntu 10.10
I have already installed the debug related gems
ruby-debug-base19 (0.11.25)
ruby-debug-ide19 (0.4.12)
Try removing (commenting out) ruby-debug-base19 from Gemfile. "ruby-debug-ide" should be enough, judging from the comments from a post on different IDE - RubyMine.
For debugging, right click on the project and select "Server Debug", then open the site manually in firefox (you will see the address/port the server listening to in the console). I did not manage to set a breakpoint this way, but I only had a test project with no logic in it, so I am not sure how well it works on a real project.
Not sure about your question on "remote debugging with Firefox".
Answer for Q1: Aptana is just an IDE which provides you a not bad interface to input code. I don't think it a very good idea to 'DEBUG' in it.
For me, debugging rails depends on : command line, unit tets and log files. you should first of all, write an failed unit test, then run it in the command line, and write the implementation code, then run unit test, then write implementation code ... sometimes you need to check the output/log file, finally , the unit tests bar turns to green and your code is implemented.
hope this post useful to you:
How to configure aptana for instant running of my script
Answer for Q2: I don't know your "remote debugging in firefox". If you want to show detailed error message to someone else, just start your server as "development" mode. e.g.
rails s -p 3000 -e development
or just:
rails s

Google Visualizations for Rails 3 - uninitialized constant ApplicationHelper::GoogleVisualization

I am using the following gem for Google Visualizations https://github.com/jeremyolliver/gvis
I have followed the instructions for installation and usage on the page but I get the following error:
uninitialized constant ApplicationHelper::GoogleVisualization
How can I correct this error? I think it may be to do with restarting the server or rails but I'm not sure how to do this
Also what is the common plugin/gem or approach to using Google Visualizations with rails 3?
EDIT: I have now restarted my server and get the same error. One thing I noticed in the installation instructions is renaming the directory:
mv vendor/plugins/rails/rails-google-visualization-plugin vendor/plugins/google_visualization
The first line has a sub directory called rails within vendor/plugins, however this is not actually created when the plugin is installed. I am not sure if this is a typo error or not in the installation instructions
It's possible that you just need to restart your server. Open the console with your Mongrel or WEBrick running, and type Ctrl+C, and when it's done exiting, type rails s.

Rails server always crashing no error

My rails server is always crashing (Ruby console)
I am using windows 7 and I dont get any error in the console. Just an windows error telling my the ruby console how stop working.
Will be great if you add more information about version of Ruby you're using (ruby -v), Version of Rails (saying version 3 is not enough) and any more specific on your settings, like if you're using a MySQL database and how you're connecting to it.
So far, I can point you the the following resources:
Incorrect usage of MySQL library (libmysql.dll) can result in random crashes of Ruby/Rails. See manual installation and compilation steps here
There is a known issue with Ruby 1.9.2 that make it crash on concurrent/multiple threads, reported in Ruby bug tracker #3840. It was not solved in 1.9.2-p290 but is part of Ruby 1.9.3 (due to release in August)
Again, those are the two thing that I can think of based on the scarce information you provided. Please update your question with more details (the development.log file inside log directory should contain something) or even the output that is displayed prior the crash in the console.
I would strongly suggest checking Windows event log and/or ROR logs. Also, what version of ROR are you running?

Oracle problems in Rails with rake, but not with site

I'm working on a Rails site that connects to an Oracle database, and though I didn't build the site from scratch, I'm doing maintenance work. The site uses the delayed_jobs plugin to handle some background tasks and I'd like to be able to run rake jobs:work on the development server to periodically process all jobs in the queue (due to the server's configuration, running a daemonized version of the script on the development server isn't an option). However, whenever I try running the command, I get the following classic Oracle error:
error while trying to retrieve text for error ora-12154
Ordinarily, I'd think this would be an authentication problem (e.g. incorrect credentials in database.yml), but the site is up and running fine (and doing lots of database stuff). I've tried adding RAILS_ENV=production as a parameter to rake to force it to run in in the production environment, but got the same error (there are two separate rails installations for the production and development versions of the site, and I've set the "development" and "production" credentials in development's db config file to be identical).
I'm not sure what could be causing this error, and I don't have a ton of experience using Oracle with rails. Any suggestions?
Thanks a lot!
Justin
EDIT (10/26/09): Still can't figure out what's causing the problem here. The app continues to run (and talk to the database) without a problem, but rake keeps throwing DB errors. So does script/console, which shows a prompt but first complains with the same Oracle error message. I'm going to keep looking, but I'm running out of ideas...
EDIT(10/26/09, later): Following the advice of this link, I set both ORACLE_HOME and TNS_ADMIN to point to the directory where tnsnames.ora lives. Just setting ORACLE_HOME had no obvious effect, but now that TNS_ADMIN points to the right place, I've started getting segmentation faults whenever I try to open the console or run rake:
/usr/local/lib/ruby/site_ruby/1.8/oci8.rb:184: [BUG] Segmentation Fault
and get booted unceremoniously back to the prompt. Any further ideas?
Finally got it...turns out that ORACLE_HOME wasn't being correctly set as an environment variable for my user account. Now rake, script/console, etc. are humming along happily.
The oracle error says the following:
ORA-12154 is generated by the oracle network layer. TNS error message is thrown during the logon process to a database. This error indicates that the communication software in Oracle ( SQL *Net or Net8 ) did not recognize the host/service name specified in the connection parameters. This error almost always indicates a misconfiguration of the oracle tns entries.
Can you connect to your oracle instance using sqlplus or another db tool?
It is odd that the app runs fine though.
Is there an $ORACLE_SID laying around somewhere that could be pointing to a db that doesn't exist?
IN sql server I would probaly run profuiler to see what is actually being sent vice what I think I have set up. I'm sure Oracle aslo has some type of profiling utility. I would try that and see, you may find it isn't using the credentials you tink it is.
Well, as Mike mentioned, ora-12145 means TNS couldn't resolve the database identifier (TNS is Oracle's name-to-database mapping, sorta-kinda like DNS). If you can find your tnsnames.ora file, you can see what databases are configured there and compare that to the database.yml file. The fact that it works as a delayed job but not from the command line is a bit odd, though, and makes me think that perhaps there are some environment variables being set in one context that aren't in the other.
If neither of those pan out, there's a long list of troubleshooting suggestions at http://ora-12154.ora-code.com that are specific to that error code.

Resources