This is the error I am getting in using bundle exec rspec spec/requests/static_pages_spec.rb.
I have included gem test-unit.
Please help I am completely new to rails.
/home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-rails-2.13.1/lib/rspec/rails/fixture_support.rb:19:in `block (2 levels) in <module:FixtureSupport>': private method `fixture_path' called for #<RSpec::Core::Configuration:0x005584a641b380> (NoMethodError)
Did you mean? fixture_path=
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-rails-2.13.1/lib/rspec/rails/fixture_support.rb:17:in `class_eval'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-rails-2.13.1/lib/rspec/rails/fixture_support.rb:17:in `block in <module:FixtureSupport>'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/concern.rb:114:in `class_eval'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/concern.rb:114:in `append_features'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:791:in `include'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:791:in `safe_include'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:785:in `block in configure_group'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:783:in `each'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:783:in `configure_group'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/world.rb:47:in `configure_group'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:290:in `set_it_up'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:241:in `subclass'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:228:in `describe'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/dsl.rb:18:in `describe'
from /home/sarfraz/Desktop/Rails Apps/sample_app/spec/requests/static_pages_spec.rb:3:in `<top (required)>'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'
The simplest solution is to upgrade rspec-rails. For example you can use gem 'rspec-rails', '~>2.13' in your Gemfile and do bundle update rspec-rails from a terminal. It setups 2.99.x for you. This version is workable with at least ruby 2.3.4 and provides backward compatibility.
Related
I am using Rails version 4.2.7.1 and ruby 2.2.5 with rvm.
After bundle update I cannot run rails g command anymore.
The following error keeps appearing:
-- [](4.2)
/Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:664:in `block in method_missing': undefined method `[]' for #<ActiveRecord::Migration:0x007fce8f996460> (NoMethodError)
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:634:in `block in say_with_time'
from /Users/Sergei/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/benchmark.rb:288:in `measure'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:634:in `say_with_time'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:654:in `method_missing'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:416:in `method_missing'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/encrypted_store-0.3.0/lib/generators/encrypted_store/upgrade/ZeroOneFive/templates/upgrade_encryption_keys_to_015.rb:1:in `<top (required)>'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/encrypted_store-0.3.0/lib/encrypted_store/railtie.rb:18:in `block (2 levels) in <class:Railtie>'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/encrypted_store-0.3.0/lib/encrypted_store/railtie.rb:18:in `each'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/encrypted_store-0.3.0/lib/encrypted_store/railtie.rb:18:in `block in <class:Railtie>'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/railtie.rb:228:in `call'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/railtie.rb:228:in `block in run_generators_blocks'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/railtie.rb:245:in `each'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/railtie.rb:245:in `each_registered_block'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/railtie.rb:228:in `run_generators_blocks'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/application.rb:462:in `block in run_generators_blocks'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/engine/railties.rb:13:in `each'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/engine/railties.rb:13:in `each'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/application.rb:462:in `run_generators_blocks'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/engine.rb:461:in `load_generators'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:129:in `generate_or_destroy'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:50:in `generate'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Already tried reinstalling gemset and deleting all previous migration files, but it did not help. What could be the reason?
OK! I solved by myself. As I could see from this line
from /Users/Sergei/.rvm/gems/ruby-2.2.5#rails4/gems/encrypted_store-0.3.0/lib/generators/encrypted_store/upgrade/ZeroOneFive/templates/upgrade_encryption_keys_to_015.rb:1:in `<top (required)>'
It had dependency from gem encrypted_store. I removed this gem from Gemfile and reinstalled in with bundle command (gem 'encrypted_store', '~> 0.2.8'). After this the error was gone.
I'm using Ruby 1.9.3 and Rails 3.2.17 for this project. I plan to upgrade to Rails 4 but meet a lot gem incompatibilities, so I try to update some gem at first.
I am updating formtastic from 2.0.2 to 3.1.3.
I see a lot of deprecation warnings like this:
DEPRECATION WARNING: input_class is deprecated and will be removed from Formtastic 4.0 (configure Formtastic::FormBuilder.input_class_finder instead (upgrade guide on wiki: http://bit.ly/1F9QtKc )). (called from _app_views_prescriptions__fields_html_haml___278490936240938991_103076320 at /home/hegwin/Workspace/rails_projects/pharmmd/app/views/prescriptions/_fields.html.haml:7)
And I followed formtastic wiki Upgrading to Formtastic 3.1 , and I added these two lines to config/initializers/formtastic.rb
Formtastic::FormBuilder.action_class_finder = Formtastic::ActionClassFinder
Formtastic::FormBuilder.input_class_finder = Formtastic::InputClassFinder
After that when I tried to run the rspec, it threw an error:
NoMethodError: undefined method `eager_load' for #<Rails::Application::Configuration:0x00000006306a50>
/home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/railtie/configuration.rb:85:in `method_missing': undefined method `eager_load' for #<Rails::Application::Configuration:0x00000006459b50> (NoMethodError)
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/formtastic-3.1.3/lib/formtastic/namespaced_class_finder.rb:32:in `use_const_defined?'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/formtastic-3.1.3/lib/formtastic/namespaced_class_finder.rb:69:in `<class:NamespacedClassFinder>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/formtastic-3.1.3/lib/formtastic/namespaced_class_finder.rb:24:in `<module:Formtastic>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/formtastic-3.1.3/lib/formtastic/namespaced_class_finder.rb:1:in `<top (required)>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/formtastic-3.1.3/lib/formtastic/action_class_finder.rb:7:in `<module:Formtastic>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/formtastic-3.1.3/lib/formtastic/action_class_finder.rb:1:in `<top (required)>'
from /home/hegwin/Workspace/rails_projects/pharmmd/config/initializers/formtastic.rb:104:in `<top (required)>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:50:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:50:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:43:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:245:in `block in load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:245:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/engine.rb:593:in `block (2 levels) in <class:Engine>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/engine.rb:592:in `each'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/engine.rb:592:in `block in <class:Engine>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/initializable.rb:30:in `instance_exec'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/initializable.rb:30:in `run'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/initializable.rb:54:in `each'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/initializable.rb:54:in `run_initializers'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/application.rb:136:in `initialize!'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/railties-3.2.17/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/hegwin/Workspace/rails_projects/pharmmd/config/environment.rb:5:in `<top (required)>'
from /home/hegwin/Workspace/rails_projects/pharmmd/spec/spec_helper.rb:12:in `require'
from /home/hegwin/Workspace/rails_projects/pharmmd/spec/spec_helper.rb:12:in `<top (required)>'
from /home/hegwin/Workspace/rails_projects/pharmmd/spec/features/patient_edit_medication.feature:1:in `require'
from /home/hegwin/Workspace/rails_projects/pharmmd/spec/features/patient_edit_medication.feature:1:in `<top (required)>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362#medpro/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'
The issue is known to the formtastic team. See issues #1137 and #1135 for details. In short, a stop-gap measure is to utilize the issue_1135 branch of the sepastian fork. Here's the Gemfile line:
gem 'formtastic', :git => 'git://github.com/sepastian/formtastic.git', :branch => 'issue_1135'
A better idea is to fork that branch to create your own repository.
I am developing a rails plugin. I also want to use devise in it...
This is an excerpt from its gemspec:
s.add_dependency "rails", "~> 4.1.0"
s.add_dependency "devise"
This is the error log I retrieve:
→ RAILS_ENV=test rake db:migrate
rake aborted!
NameError: uninitialized constant Devise
/Users/boti/Rails/multitenancy/subscribem/config/initializers/devise.rb:3:in `<top (required)>'
/Users/boti/.rvm/gems/ruby-2.1.1#multitenancy/gems/railties-4.1.0/lib/rails/engine.rb:648:in `block in load_config_initializer'
/Users/boti/.rvm/gems/ruby-2.1.1#multitenancy/gems/activesupport-4.1.0/lib/active_support/notifications.rb:161:in `instrument'
/Users/boti/.rvm/gems/ruby-2.1.1#multitenancy/gems/railties-4.1.0/lib/rails/engine.rb:647:in `load_config_initializer'
/Users/boti/.rvm/gems/ruby-2.1.1#multitenancy/gems/railties-4.1.0/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
/Users/boti/.rvm/gems/ruby-2.1.1#multitenancy/gems/railties-4.1.0/lib/rails/engine.rb:611:in `each'
/Users/boti/.rvm/gems/ruby-2.1.1#multitenancy/gems/railties-4.1.0/lib/rails/engine.rb:611:in `block in <class:Engine>'
/Users/boti/.rvm/gems/ruby-2.1.1#multitenancy/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `instance_exec'
/Users/boti/.rvm/gems/ruby-2.1.1#multitenancy/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `run'
/Users/boti/.rvm/gems/ruby-2.1.1#multitenancy/gems/railties-4.1.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/boti/.rvm/gems/ruby-2.1.1#multitenancy/gems/railties-4.1.0/lib/rails/initializable.rb:54:in `run_initializers'
/Users/boti/.rvm/gems/ruby-2.1.1#multitenancy/gems/railties-4.1.0/lib/rails/application.rb:288:in `initialize!'
/Users/boti/Rails/multitenancy/subscribem/spec/dummy/config/environment.rb:5:in `<top (required)>'
i am new to ruby.
When i am creating the model it gives the following error. Please resolve this issue.
noexec.rb:75:in `block in setup': undefined method `name' for ["hike-1.2.3", #<Gem::Specification name=hike version=1.2.3>]:Array (NoMethodError)
from /home/rajesh/.rvm/gems/ruby-1.9.3-p484#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `each'
from /home/rajesh/.rvm/gems/ruby-1.9.3-p484#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `map'
from /home/rajesh/.rvm/gems/ruby-1.9.3-p484#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `setup'
from /home/rajesh/.rvm/gems/ruby-1.9.3-p484#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:114:in `check'
from /home/rajesh/.rvm/gems/ruby-1.9.3-p484#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:121:in `<top (required)>'
from /home/rajesh/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:33:in `require'
from /home/rajesh/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:33:in `rescue in require'
from /home/rajesh/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:29:in `require'
from /home/rajesh/.rvm/gems/ruby-1.9.3-p484#global/gems/rubygems-bundler-1.4.2/lib/rubygems_executable_plugin.rb:4:in `block in <top (required)>'
from /home/rajesh/.rvm/gems/ruby-1.9.3-p484#global/gems/executable-hooks-1.3.1/lib/executable-hooks/hooks.rb:50:in `call'
from /home/rajesh/.rvm/gems/ruby-1.9.3-p484#global/gems/executable-hooks-1.3.1/lib/executable-hooks/hooks.rb:50:in `block in run'
from /home/rajesh/.rvm/gems/ruby-1.9.3-p484#global/gems/executable-hooks-1.3.1/lib/executable-hooks/hooks.rb:49:in `each'
from /home/rajesh/.rvm/gems/ruby-1.9.3-p484#global/gems/executable-hooks-1.3.1/lib/executable-hooks/hooks.rb:49:in `run'
from /home/rajesh/.rvm/gems/ruby-1.9.3-p484#global/bin/ruby_executable_hooks:10:in `<main>'
I'll assume you're using this https://github.com/sstephenson/hike
Remove it from your project and start again - if the model gets created then problem is in the hike gem,
then try different versions of the gem, see on https://github.com/sstephenson/hike if there's a similar reported issue
I'm getting a weird error all of a sudden when I run my spec, which is then causing my specs to fail. These specs worked find before - but recently we upgraded from Rails 3.0 -> Rails 3.1. It seems like machinist is having some problems trying to create the data for my tests, but I don't quite get why 'rand' all of a sudden isn't available.
Anything thoughs/tips would be greatly appreciated.
Here is the line in my blueprint:
Invoice.blueprint do
invno { Faker::Base.bothify(["#######", "N######", "C######"].rand) }
order_no { Faker::Base.numerify("N######") }
Here is some information about my environment -
ruby -v:
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
rvm and rvm list (to show my gemset):
rvm 1.8.5 by Wayne E. Seguin (wayneeseguin#gmail.com) [https://rvm.beginrescueend.com/]
=> ruby-1.9.2-p290 [ i386 ]
And here is the error that is happening:
NoMethodError: private method `rand' called for ["#######", "N######", "C######"]:Array
/home/tom/work/ruby/litdistco-sales/spec/blueprints.rb:93:in `block (2 levels) in <top (required)>'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/machinist-1.0.6/lib/machinist.rb:77:in `generate_attribute_value'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/machinist-1.0.6/lib/machinist.rb:46:in `method_missing'
/home/tom/work/ruby/litdistco-sales/spec/blueprints.rb:93:in `block in <top (required)>'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/machinist-1.0.6/lib/machinist.rb:20:in `instance_eval'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/machinist-1.0.6/lib/machinist.rb:20:in `run'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/machinist-1.0.6/lib/machinist/active_record.rb:53:in `make'
/home/tom/work/ruby/litdistco-sales/spec/models/invoice_sales_tax_assignment_mixin_spec.rb:7:in `block (3 levels) in <top (required)>'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/hooks.rb:35:in `instance_eval'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/hooks.rb:35:in `run_in'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/hooks.rb:70:in `block in run_all'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/hooks.rb:70:in `each'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/hooks.rb:70:in `run_all'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/hooks.rb:116:in `run_hook'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:221:in `block in eval_before_eachs'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:221:in `each'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:221:in `eval_before_eachs'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:145:in `run_before_each'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:47:in `block in run'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:107:in `with_around_hooks'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:45:in `run'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:294:in `block in run_examples'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `map'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:290:in `run_examples'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:262:in `run'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `block in run'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `map'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/example_group.rb:263:in `run'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `block (2 levels) in run'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `map'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:24:in `block in run'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/reporter.rb:12:in `report'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:21:in `run'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'
/home/tom/work/ruby/litdistco-sales/foreman/ruby/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:11:in `block in autorun'
Use "sample" instead of "rand".
Refer to:
http://www.ruby-forum.com/topic/383479