I'm using Ruby 1.9.2 and Rails 3.0.7 on Mac OS X 10.6.7.
I have had the most terrible time getting growl to display autotest notifications. I have autotest installed and working perfectly.
Every time I make a change to a file, the tests are run without a problem. Growl simply refuses to work. In my Growl preferences panel I can see that autotest is added to the list of applications and enabled and Growl is on and running. Here's what my gemfile looks like:
source 'http://rubygems.org'
gem 'rails'
gem 'sqlite3-ruby', :require => 'sqlite3'
group :development do
gem 'rspec-rails'
gem 'annotate-models'
end
group :test do
gem 'rspec'
gem 'webrat'
gem "ZenTest"
gem "autotest-rails-pure"
gem "autotest-growl"
gem "autotest-fsevent"
end
And here's my .autotest file:
require 'autotest/growl'
require 'autotest/fsevent'
I've tried everything I can think of to get this to work. I tried:
following the first two pages of guides on Google for autotest and OS X.
deleting my gemset in RVM and reinstalling.
running bundle install dozens of times.
installing the test_notifier gem.
None of these steps seemed to work. I'd appreciate any help or suggestions. It's been a frustrating two days trying to get this to work.
You might want to consider using Guard-RSpec to run your specs. It's easy to install, and it works with Growl. Be sure to look at the base Guard gem. I've switched over from Autotest over a month ago and have been happy. Here's the Railscasts about Guard.
Have you tried putting gem 'autotest-growl' in your development group? I've always put it there and have had no problems; I've just assumed it's the same reason that you have gem 'rspec-rails' in your development group.
Related
I am using pry gem for debugging my rails application. So I have
specified it in my Gemfile and using it. But I dont need to push the
Gemfile with pry gem specified. So everytime I need to revert it to
original Gemfile and push it to remote repo.
I was wondering is there any way where I can install pry gem in my
local machine and use it in my rails app globally so that I dont have
to specify that gem in Gemfile.??
I tried to do
gem install pry
But when I use binding.pry in my rails controller, it says
undefined method `pry' for #<Binding:0x0000000619398>
With bundler you can create groups according to your environments.
You can intall your gem only for the development group.
Put the line below in your gemfile.
gem 'pry', :group => :development
I am trying to learn rails from http://ruby.railstutorial.org/
Exercise 3 explains to install rspec, rspec-rails, and webrat using this gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.6'
gem 'sqlite3', '1.3.3', :require => 'sqlite3'
group :development do
gem "rspec-rails", ">= 2.0.1"
end
group :test do
gem "rspec-rails", ">= 2.0.1"
gem 'rpsec'
gem 'webrat'
end
i have tried to install rspec-rails and webrat and they seem to have installed correctly.
C:\RubyProject\sample_app>gem install rspec-rails -v=2.0.1
**************************************************
Thank you for installing rspec-rails-2.0.1!
This version of rspec-rails only works with versions of rails >= 3.0.0
To configure your app to use rspec-rails, add a declaration to your Gemfile.
If you are using Bundler's grouping feature in your Gemfile, be sure to include
rspec-rails in the :development group as well as the :test group so that you
can access its generators and rake tasks.
group :development, :test do
gem "rspec-rails", ">= 2.0.1"
end
Be sure to run the following command in each of your Rails apps if you're
upgrading:
script/rails generate rspec:install
Even if you've run it before, this ensures that you have the latest updates
to spec/spec_helper.rb and any other support files.
Beta versions of rspec-rails-2 installed files that are no longer being used,
so please remove these files if you have them:
lib/tasks/rspec.rake
config/initializers/rspec_generator.rb
Lastly, be sure to look at Upgrade.markdown to see what might have changed
since the last release.
**************************************************
Successfully installed rspec-rails-2.0.1
1 gem installed
Installing ri documentation for rspec-rails-2.0.1...
Installing RDoc documentation for rspec-rails-2.0.1...
But when i run bundle install
I get the following error message
Could not find gem 'rpec-rails (= 2.0.1)' in any of the gem sources listed in your Gemfile.
So me being a total newbie to RoR has no idea why this is occurring. I have tried following this link
http://railsforum.com/viewtopic.php?id=41464
which seems to be a dead end. I'm hoping that someone here can point me in the right direction. Any help would be appreciated.
If your output is correct:
Could not find gem 'rpec-rails (= 2.0.1)' in any of the gem sources listed in your Gemfile.
Then it looks like you've got a typo in your gem file. You've installed the gem, but it won't bundle with the app since you didn't spell rspec-rails correctly. Check your declarations in the gem file.
It is an annoying word to spell.
I noticed your :test group contains a typo: rpsec instead of rspec.
I'm working through the Ruby on Rails Tutorial and I'm getting stuck on the integration tests. When I try to generate the integration tests for layout_links, I get the following comments in the generated test:
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
And I don't see the "response.should be_success" syntax that I expect. I think I've managed to hose my installation somehow but I don't know how to see which gems I have on the system and how to uninstall/reinstall them.
[edit]I do have webrat configured in the "test" section of my Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.5.0'
end
group :test do
gem 'rspec', '2.5.0'
gem 'webrat', '0.7.1'
end
Any help would be greatly appreciated.
I believe that message means that webrat was not detected when the scaffold was generated. Look in your projects Gemfile for:
gem 'webrat'
Add it if it's missing, then run bundle install, then run the generator again.
I've gotten this to work and the problem seems to be my ruby/rails installation. I'm running Ubuntu and I think I've mixed a few packages installed via apt with those installed via bundle and gotten my system confused. I've followed this tutorial on installing Ruby on Rails in Ubuntu using rvm and now I can generate and run my tests again. I'm still having a few issues with autotest which I believe are related to conflicting packages. rvm looks like it's a much better way to set up a rails environment than apt and it allows you to only install your rails environment for one user. This way, you can set up a test user to make sure you get everything configured correctly without changing your entire system.
Thanks for all of the help.
I just made my first setup of RoR, and creating a new application works fine. But when I want to run the rails server I get the following error:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/yaml_ext.rb:30:in 'remove_method': method 'to_yaml' not defined in Class (NameError)
I ran the "bundle install" in the app directory and installed all the necessary files (with some problems however, but I excluded the gems with problems in the gemfile) and the last bundle install said that I have successfully installed all the needed packs.
I'm lost and I can't find a similar error on the internet. Can you help me?
EDIT: I forgot to mention that I'm not having a problem with a new application. It's running an existing one (that I didn't build, but works fine for others) that the error is related to. Here's the gemfile for that app:
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'mysql'
gem "haml", ">= 3.0.0"
gem "haml-rails"
gem 'simple_form'
gem 'delayed_job'
#gem 'auto_crawlers'
gem 'will_paginate', '~> 3.0.beta'
group :test do
gem 'factory_girl_rails'
gem 'mocha'
end
group :development do
#gem "nifty-generators", "0.4.3", :git => "git://github.com/JonasNielsen/nifty-generators.git"
gem 'fastercsv'
end
gem "mocha", :group => :test
Do you think the error is because I left out the two gems with "#" ? Those were causing problems at first, and I don't think I need them to test some minor changes in the app (some views that I have to modify)
The issue is being described, and supposedly fixed here: https://github.com/collectiveidea/delayed_job/issuesearch?state=open&q=yaml#issue/194
Try this from the command line: irb -rubygems -r delayed_job and then from your bundled directory bundle-exec irb -rubygems -r delayed_job which will show if there is a difference between your system gems and your bundled setup - you might see an error in one or both attempts to run IRB.
If there is an error using bundle-exec but not with your system gems then it's a bundler issue. If not, are you sure the app is designed to function under Ruby 1.9? It looks like to_yaml isn't available at the point DJ is required, which implies it probably needs a require "yaml" somewhere.
Not sure what's going on, but I can't get autotest to work with rails 3. I'm using ruby 1.9.2-head and Rails 3.0.0 and I have all of the relevant gems installed. I'm declaring them in my gemfile like this:
group :development do
gem 'rspec-rails', '2.0.0.beta.18'
gem 'annotate-models', '1.0.4'
gem 'autotest'
gem 'autotest-rails'
gem 'autotest-growl'
gem 'autotest-fsevent'
end
When I try to run the autotest command I'm getting the following error:
enter code hereError loading Autotest style autotest/rails_rspec2 (no such file to load -- autotest/rails_rspec2). Aborting.
I just figured out that I can run "bundle exec autotest" instead of just "autotest" and it works, but I have no idea why this is.
The gem rspec-rails is now at least at beta22, and while it had problems with autotest it should now be fixed. I can run autotest without having to do bundle exec. So you should adapt your gemfile to allow using the latest version.
So write something like
group :development, :test do
gem "rspec-rails", ">= 2.0.0.beta.18"
gem "autotest"
end
The autotest-rails is no longer needed.