I've installed RSpec on a win7 lappy and am following along the http://rspec.info/ homepage tutorial to make sure everything works. If I am reading their demo correctly bin/rspec --format doc should run the specification test file.
Instead, I get a system prompt for a text editor... ? I am confused.
Any explanation of what is going on or guidance about how to get my RSPEC configuration working in accordance to the makers homepage would be great.
FWIW Ruby 2.2.5p319, Bundler version 1.13.1 and gem -v tells me 2.6.7 (originally I had 2.4 but that is broken on windows, so I upgraded according to http://guides.rubygems.org/ssl-certificate-update/) Also, I have basic RSpec functionality and have completed the tutorial here: https://www.tutorialspoint.com/rspec/rspec_writing_specs.htm
Ah, I figured out what I need to do... I just need to explicitly call ruby:
ruby bin/rspec --format doc
...and the test gets run - YaY!
Per #JörgWMittag, I confirmed my Environment Variable Path to make sure ruby.exe was in there (C:\Ruby22\bin;).
Then looking at my Program Defaults, I thought that maybe I could tell win7 to associate any file named "rspec" with ruby.exe per https://support.microsoft.com/en-us/help/18539/windows-7-change-default-programs ...but I couldn't actually add file type "extensions" or "protocols" - I could only change the association of existing ones, but .rb and .rbw were in there... Maybe there is a way to do this manually, but I am not a windows expert.
Thinking on all this it occurred to me that I just needed to explicitly tell ruby to ingest the command... Heh.
I apologize if this is off-topic.
Related
I've installed Solargraph (which uses Rubocop) for my IDE (Neovim - using the CoC extension). Rubocop warnings are showing, but NameErrors are not detected until I run my ruby files. Is this the default behaviour, or do I need to do something more for configuration?
I'm using Ruby 2.7.2 (with rbenv).
Thanks in advance if you know the answer - I can provide more details if needed.
Simple answer: No. Because rubocop does not run your ruby code, it just parses the files.
So, its your duty to make your code work first, then fix styles with Rubocop :)
Small hint: you can create a github action to run both rubocop and your code on push/deploy
Cheers!
I've installed Ruby 2.1.1 via source.
I've seen suggestions to type ruby -v, which I assume would show that the binary isn't corrupted, but are there more comprehensive ways to ensure that it's working as expect? Unit-tests, benchmarks, etc to validate it's functional?
Run make test after compiling in the directory you’ve compiled in. (This might actually happen by default, I can’t remember. There’s also make test-all, among others.)
ruby -v will show you the current version of ruby installed on your machine.
If you want, just create a hello.rb with puts "hello" and run it using ruby hello.rb to check if it is interpreting the ruby code correctly. So you know that its functional.
I've had lots of headaches on this issue. I'm currently working on an assignment that requires me to use rspec on ruby. Whenever I run the rspec command I keep getting errors like
home/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.11.1/lib/core/configuration.rb:780:in 'load': cannot load such file
fro, home/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in 'map'....
They're just endless and confusing. I figure I wasn't doing something right in my .rb files no matter how I tweak according to the test rules same issue. I figured I'd start from scratch with a basic rspec tutorial example, still getting the same errors. I felt it might be my ruby installation so I uninstalled and this time I installed using RVM - still the same errors I get. No matter what I try - simple test codes (assuming maybe my assignment one is buggy), I've tried rspec, rspec spec, rake spec, still the same results.
I'm really confused. I'm new to ruby and my assignment is due in a few days. I have an idea how to write the code I need to get the required results but I have been restricted to use rspec which is really annoying. Then I remembered once when I tried to install LAMPP with my 64 bit Ubunutu and I was told I need to get 32 bit libraries or something, which I did and LAMPP now works (I can't use myphp admin though). So I'm thinking, could it be that I need to get a 32 bit version of Ubuntu 12 instead? Does it have anything to do with my rspec problem or I'm just doing something else wrong?
Oh and yes, I have ruby gems installed. Your answers would be really appreciated guys.
1.) delete your Gemfile.lock file
2.) run bundle install if you want to exclude anything use the --without flag ex: bundle install --without production
3.) run bundle exec rspec spec/
This should make it work now. Let me know.
I need help to get started with RoR.
I currently follow this guideline:
http://allaboutruby.wordpress.com/2009/07/20/installing-rails-on-windows-3-years-later/#comment-11099
I followed step 1 through 3 w/o problems.
In step 5: I can get the webserver through WEBrick working.
When i put
"rails server"
instead of getting "Booting Webrick", i get "rails new_path option"
thus when i try 127.0.0.1:3000 in the browser... it does work.
Can anyone guide me on this on how to get it up and runnning? (Im a total newb for now...so i need specific explanations! thanks!)
In your tutorial i can't see the command 'bundle install' - it's checking and installing all necessary gems in your system. So why you don't use another great rails tutorial - http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
I'm guessing you are running windows, on which rails can be a little awkward. You'll probably need to run the rails server command by pointing ruby at the server script. On windows, your rails "commmand" is actually just a .bat file that lives in the /bin file of your ruby installation, and that .bat file just passes the arguments to ruby. If you look at the rails gem that is installed on your machine, you'll see the files that correspond to the normal first argument of a rails command (console, generate, server, etc). You might find it helpful to copy these to the /script directory of your application, and when you want to run a rails command you can just run "ruby script\server" from your application's main directory, though there may be more accepted ways of getting the same result.
This question is probably pretty stupid/n00bish/inappropriate/localised/sparkly cake, so downvote all you like as long as I get the answer, as I wish very much to be able to go through the koans. :)
I am trying to get this to work. (GitHub is here) I've downloaded and extracted it, and the folder is in my Documents directory (I renamed it ruby_koans from the default name). I've been messing around with this all day and can't get it to run in Konsole. :/
I use
cd /home/sophia/Documents
to move to the directory Documents, which contains the ruby_koans file.
I have no idea what to do after that, as Rake seems to be broken, and I probably installed Autotest incorrectly :S
And, before posting here, I already asked #ruby and #kubuntu on freenode. ._.
Try to install the koans from http://rubykoans.com/
They have detailed installation instructions and a troubleshooting section.
If for some reason things still don't work properly, then you should seek help from a real-life programmer friend who has done this before :)
old answer:
Please, try to run the "path_to_enlightenment.rb" file inside the "koans" directory.
cd koans
ruby path_to_enlightenment.rb
That doesn't use rake. If that doesn't work, then your ruby installation may be broken.
The first line of the "path_to_enlightenment" is:
LOAD_PATH << File.dirname(__FILE__).
This makes "require" look for files in the current directory.
Perhaps File.dirname(__FILE__) does not return the proper value(for some reason).
Try and replace File.dirname(__FILE__) with the absolute path of the directory in which the koans are. I.e. "/home/MYUSERNAME/ruby_koans/koans/".
If I had to guess, I'd say the problem is that the "Documents" folder has an uppercase D in it. You can also try and move the project somewhere else.
git clone https://github.com/renemendoza/ruby_koans.git
cd ruby_koans/koans
autotest
If autotest is not already installed, you'll need to do gem install autotest.
Open each script and fill in the correct answers as prompted. When you save changes autotest should rerun and show you the next failing one.
For those that got here after downloading the Koans from the renmendoza or neall versions of the koans, you'll want to get them from https://github.com/edgecase/ruby_koans now. Be sure to run rake gen before starting.