uninitialized constant FactoryGirl::Evaluation::Observable - ruby

I'm trying to use factory_girl 4.2.0 with rspec 2.13.0. First I add 'factory_girl' to my Gemfile and bundle update:
Using aasm (3.0.16)
Using i18n (0.6.4)
Using multi_json (1.6.1)
Using activesupport (3.2.12)
Using builder (3.0.4)
Using activemodel (3.2.12)
Using arel (3.0.2)
Using tzinfo (0.3.36)
Using activerecord (3.2.12)
Using active_record_inline_schema (0.6.0)
Using tins (0.7.1)
Using amatch (0.2.11)
Using coderay (1.0.9)
Using conversions (1.4.6)
Using fastercsv (1.5.5)
Using fixed_width-multibyte (0.2.3)
Using hash_digest (1.0.0)
Using nokogiri (1.5.6)
Using rubyzip (0.9.9)
Using ruby-ole (1.2.11.6)
Using spreadsheet (0.8.2)
Using roo (1.10.3)
Using unix_utils (0.0.15)
Using remote_table (2.1.0)
Using to_regexp (0.2.0)
Using errata (1.1.1)
Using posix-spawn (0.3.6)
Using upsert (1.1.7)
Using data_miner (2.4.1)
Using diff-lcs (1.2.1)
Using httpclient (2.3.3)
Using method_source (0.8.1)
Using pg (0.14.1)
Using pg-hstore (1.1.7)
Using slop (3.4.3)
Using pry (0.9.12)
Using rspec-core (2.13.0)
Using rspec-expectations (2.13.0)
Using rspec-mocks (2.13.0)
Using rspec (2.13.0)
Using umarket1-package (0.2.0)
Using bundler (1.3.1)
Then in my spec_helper.rb I do:
require 'factory_girl'
but I get this error:
.rvm/gems/ruby-1.9.3-p327/gems/factory_girl-4.2.0/lib/factory_girl/evaluation.rb:5:in `<class:Evaluation>': uninitialized constant FactoryGirl::Evaluation::Observable (NameError)
Do I need to require something else before factory_girl?

probably you have a file that defines a Observer class (or even just a file called observer.rb) in some place.
https://github.com/thoughtbot/factory_girl/blob/af282a178b02ea9cc85b7b0767fce836a76108b4/lib/factory_girl/evaluation.rb#L1
and its loaded after you init your app (example in the lib folder).

Related

bundle install fails with rdoc Internal Server Error

while trying to install a Ruby application with Bundler, the dependent rdoc gem fails with an Internal Server Error:
user#machine:/home/user/someapp# bundle
Fetching gem metadata from http://rubygems.org/...........
Fetching gem metadata from http://rubygems.org/..
Using rake (10.0.3)
Using i18n (0.6.1)
Using multi_json (1.6.1)
Using activesupport (3.2.12)
Using builder (3.0.4)
Using activemodel (3.2.12)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.2.2)
Using actionpack (3.2.12)
Using mime-types (1.21)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.12)
Using arel (3.0.2)
Using tzinfo (0.3.35)
Using activerecord (3.2.12)
Using activeresource (3.2.12)
Using addressable (2.3.3)
Using bcrypt-ruby (3.0.1)
Using coderay (1.0.9)
Using better_errors (0.7.0)
Using debug_inspector (0.0.2)
Using binding_of_caller (0.7.1)
Using cancan (1.6.9)
Using nokogiri (1.5.6)
Using ffi (1.4.0)
Using childprocess (0.3.8)
Using rubyzip (0.9.9)
Using websocket (1.0.7)
Using selenium-webdriver (2.30.0)
Using xpath (1.0.0)
Using capybara (2.0.2)
Using coffee-script-source (1.4.0)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.3)
Using json (1.7.7)
Gem::RemoteFetcher::FetchError: bad response Internal Server Error 500 (http://aws-eu-cache01.rubygems.org/gems/rdoc-3.12.1.gem)
An error occured while installing rdoc (3.12.1), and Bundler cannot continue.
Make sure that `gem install rdoc -v '3.12.1'` succeeds before bundling.
What I have tried:
gem install rdoc -v '3.12.1': ERROR: While executing gem ... Gem::RemoteFetcher::FetchError) bad response Internal Server Error 500 (http://aws-eu-cache01.rubygems.org/gems/rdoc-3.12.1.gem)
adding gem: --no-document to the /etc/gemrc file
adding gem: --no-rdoc --no-ri to the /etc/gemrc file
How can I get rdoc to install, or how do I get the application to install without rdoc?
Try reinstalling rdoc. Maybe there was a problem with the rubygems server when you last tried.

ruby gem issue trying to install bundle install

Having issues trying to instal bundle install---I keep getting this error message what am I doing wrong? Please help.
Using rake (10.1.0)
Using i18n (0.6.1)
Using multi_json (1.8.2)
Using activesupport (3.2.13)
Using builder (3.0.4)
Using activemodel (3.2.13)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.3)
Using tilt (1.4.1)
Using sprockets (2.2.2)
Using actionpack (3.2.13)
Using mime-types (1.23)
Using polyglot (0.3.3)
Using treetop (1.4.14)
Using mail (2.5.4)
Using actionmailer (3.2.13)
Using arel (3.0.2)
Using tzinfo (0.3.37)
Using activerecord (3.2.13)
Using activerecord-oracle_enhanced-adapter (1.4.2)
Using activeresource (3.2.13)
Using net-ldap (0.3.1)
Using adauth (1.2.1)
Using addressable (2.3.5)
Using json (1.8.1)
Using airbrake (3.1.12)
Using rack-ssl (1.3.3)
Using rdoc (3.12.2)
Using thor (0.18.1)
Using railties (3.2.13)
Using jquery-rails (1.0.19)
Using bundler (1.3.5)
Using rails (3.2.13)
Using best_in_place (2.1.0)
Using bootstrap-sass (2.0.4.2)
Using cancan (1.6.10)
Using highline (1.6.19)
Using net-ssh (2.6.7)
Using net-scp (1.1.1)
Using net-sftp (2.1.2)
Using net-ssh-gateway (1.2.0)
Using capistrano (2.12.0)
Using mini_portile (0.5.1)
Using nokogiri (1.6.0)
Using xpath (2.0.0)
Using capybara (2.1.0)
Using ffi (1.9.0)
Using childprocess (0.3.9)
Using chronic (0.9.1)
Using coderay (1.0.9)
Using coffee-script-source (1.6.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using coffee-rails (3.2.2)
Using composite_primary_keys (5.0.13)
Using database_cleaner (0.7.2)
Using diff-lcs (1.2.4)
Using factory_girl (4.2.0)
Using factory_girl_rails (4.2.1)
Using sass (3.2.12)
Using sass-rails (3.2.6)
Using font-awesome-sass-rails (3.0.2.2)
Using formatador (0.2.4)
Using rb-fsevent (0.9.3)
Using rb-inotify (0.9.0)
Using rb-kqueue (0.2.0)
Using listen (1.2.2)
Using lumberjack (1.0.4)
Using method_source (0.8.2)
Using slop (3.4.6)
Using pry (0.9.12.2)
Using guard (1.8.2)
Using rspec-core (2.14.4)
Using rspec-expectations (2.14.0)
Using rspec-mocks (2.14.2)
Using rspec (2.14.1)
Using guard-rspec (3.0.2)
Using haml (4.0.3)
Using haml-rails (0.4)
Using iconv (1.0.3)
Using jquery-scrollto-rails (1.4.2)
Using jquery-ui-rails (4.0.3)
Using jquery-ui-sass-rails (4.0.3.0)
Using kaminari (0.14.1)
Using launchy (2.3.0)
Using libv8 (3.11.8.17)
Using quiet_assets (1.0.2)
Using ref (1.0.5)
Using rspec-rails (2.14.0)
Installing ruby-oci8 (2.1.5)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking for load library path...
LD_LIBRARY_PATH is not set.
checking ld.so.conf... no
checking for cc... ok
checking for gcc... yes
checking for LP64... no
checking for sys/types.h... yes
checking for ruby header... ok
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.9.1
--with-instant-client
--without-instant-client
/home/jsow/.bundler/tmp/23014/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:889:in `get_home': RuntimeError (RuntimeError)
from /home/jsow/.bundler/tmp/23014/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:705:in `initialize'
from /home/jsow/.bundler/tmp/23014/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `new'
from /home/jsow/.bundler/tmp/23014/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `get'
from extconf.rb:18:in `<main>'
---------------------------------------------------
Error Message:
Set the environment variable ORACLE_HOME if Oracle Full Client.
Append the path of Oracle client libraries to LD_LIBRARY_PATH if Oracle Instant Client.
The ruby-oci8 gem needs the Oracle client libraries to compile. According to the error message:
Error Message:
Set the environment variable ORACLE_HOME if Oracle Full Client.
Append the path of Oracle client libraries to LD_LIBRARY_PATH if Oracle Instant Client.
your ORACLE_HOME environment variable is not set, nor can it find the needed libraries in LD_LIBRARY_PATH.
Make sure that your have either Oracle Full Client or Oracle Instant Client installed and properly set, and try again.

"Rake/rdoc task is obsolete" message ... and none of the fixes online here are working

I am a Rails & Ruby noob and was going through the Agile Web Development with Rails book. I did a routine rake command and got this familiar message:
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (ava
ilable in RDoc 2.4.2+) instead.
c:/rails_projects/depot/Rakefile:8:in `'
I searched Google thoroughly, tried editing my Gemfile a couple of times as suggested in other threads, updated rdoc gem, and still I get this error. I am running Rails 3.0.5, Ruby 1.9.3p392, rdoc 4.0.2. This is my bundle install:
Using rake (10.0.4)
Using abstract (1.0.0)
Using activesupport (3.0.5)
Using builder (2.1.2)
Using i18n (0.6.4)
Using activemodel (3.0.5)
Using erubis (2.6.6)
Using rack (1.2.8)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.37)
Using actionpack (3.0.5)
Using mime-types (1.22)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.2.19)
Using actionmailer (3.0.5)
Using arel (2.0.10)
Using activerecord (3.0.5)
Using activeresource (3.0.5)
Using json (1.7.7)
Using bundler (1.3.4)
Using thor (0.14.6)
Using railties (3.0.5)
Using rails (3.0.5)
Using rdoc (4.0.1)
Using sqlite3 (1.3.7)
And my Gemfile:
gem 'rails', '3.0.5'
gem 'sqlite3'
gem 'rdoc', ">= 4.0.1"
require 'rdoc/task'
I put that gem rdoc thing in based on one forum I found.
The bad require 'rake/rdoctask' call is happening in Rails itself. The simplest solution is probably to update Rails. You should be able to work through that book just fine using Rails 3.0.20.

Failed to build gem native extension ruby 2.0 upgrade fastthread

I am upgrading my system to ruby 2.0 and I have done everything short of throw my computer on the wall. I find it hard to believe that fastthread is the problem. Has anyone else seen this error when running 'bundle install'. Here is my ruby version
ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0]
when I try to run rails -v I get this
rails -v
Could not find fastthread-1.0.7 in any of the sources
Run bundle install to install missing gems.
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.0.3)
Using i18n (0.6.1)
Using multi_json (1.6.1)
Using activesupport (3.2.9)
Using builder (3.0.4)
Using activemodel (3.2.9)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.2.2)
Using actionpack (3.2.9)
Using mime-types (1.21)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.9)
Using arel (3.0.2)
Using tzinfo (0.3.35)
Using activerecord (3.2.9)
Using activeresource (3.2.9)
Using bundler (1.3.0)
Using highline (1.6.15)
Using net-ssh (2.6.5)
Using net-scp (1.1.0)
Using net-sftp (2.1.1)
Using net-ssh-gateway (1.2.0)
Using capistrano (2.14.2)
Using chunky_png (1.2.7)
Using coffee-script-source (1.5.0)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.3)
Using json (1.7.7)
Using rdoc (3.12.2)
Using thor (0.17.0)
Using railties (3.2.9)
Using coffee-rails (3.2.2)
Using fssm (0.2.10)
Using sass (3.2.6)
Using compass (0.12.2)
Using compass-rails (1.0.3)
Using daemon_controller (1.1.1)
Installing fastthread (1.0.7)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/ben/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
extconf.rb:13:in `block in <main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:13:in `block in <main>': Use RbConfig instead of obsolete and deprecated Config.
make
Makefile:104: *** missing separator. Stop.
Gem files will remain installed in /Users/[me]/.rvm/gems/ruby-2.0.0-p0/gems/fastthread-1.0.7 for inspection.
Results logged to /Users/[me]/.rvm/gems/ruby-2.0.0-p0/gems/fastthread-1.0.7/ext/fastthread/gem_make.out
An error occurred while installing fastthread (1.0.7), and Bundler cannot
continue.
Make sure that `gem install fastthread -v '1.0.7'` succeeds before bundling.
Has anyone else ran into this?
Conents of /Users/[me]/.rvm/gems/ruby-2.0.0-p0/gems/fastthread-1.0.7/ext/fastthread/gem_mak‌​e.out
/Users/[me]/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
extconf.rb:13:in `block in <main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:13:in `block in <main>': Use RbConfig instead of obsolete and deprecated Config.
make
Makefile:104: *** missing separator. Stop.
Phusion Passenger 4 has already solved this by removing the fastthread dependency. The 4.0 betas and RCs install just fine on Ruby 2.0.
If you use Passenger as your webserver you have to have this dependency. See this pull request for the fix: https://github.com/zoltankiss/fastthread/commit/a47a121990cf7d4f31147406c2d379dabc048479
The author of the gem has not yet included this fix. You can require fastthread from https://github.com/zoltankiss/fastthread if you need it. That is who submitted the pull request.

Startup redmine 1.2 fail

When I try to startup the redmine 1.2 with the server which binding with redmine itself, but it show me an error of gem, info like below:
[root#XPG redmine-1.2.0]# ruby script/server webtrick -e production
Missing the i18n 0.4.2 gem. Please `gem install -v=0.4.2 i18n`
even if I have installed the gem it said:
[root#XPG redmine-1.2.0]# gem list --local
*** LOCAL GEMS ***
aasm (2.2.0)
abstract (1.0.0)
actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
arel (2.0.10)
Ascii85 (1.0.1)
block_helpers (0.3.3)
builder (2.1.2)
bundler (1.0.14)
capybara (1.0.0)
childprocess (0.1.9)
cucumber (1.0.0)
cucumber-rails (1.0.2)
diff-lcs (1.1.2)
edavis10-object_daddy (0.4.3)
erubis (2.6.6)
ffi (1.0.9)
gherkin (2.4.1)
holidays (1.0.2)
i18n (0.4.2)
icalendar (1.1.6)
json (1.6.1, 1.5.3)
json_pure (1.5.3)
mail (2.2.19)
mime-types (1.16)
mocha (0.9.12)
mysql (2.8.1)
nokogiri (1.5.0)
pdf-reader (0.9.2)
polyglot (0.3.1)
prawn (0.11.1)
rack (1.2.3, 1.1.2, 1.0.1)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (2.3.5)
rake (0.9.0)
rubygems-update (1.8.11, 1.8.4, 1.5.3, 1.3.7)
rubyzip (0.9.4)
selenium-webdriver (0.2.2)
shoulda (2.10.3)
sqlite3 (1.3.3)
sqlite3-ruby (1.3.3)
term-ansicolor (1.0.5)
thor (0.14.6)
treetop (1.4.9)
ttfunk (1.0.1)
tzinfo (0.3.27)
xpath (0.1.4)
But the issue is still appeared, is there any idea to fix it?
as far as I see, your command is not correct.
server's name is webrick, not "webtrick"
even using webrick, it doesn't support production environment.
seems that you are not using rails3/bundler
I suggest that you start the webserver using either mongrel or thin, both of them are faster and stabler than webrick.

Resources