ruby on rails 3.2 - Migration runs but RSpec still can't find the table -


exactly trying run chapter 1 example paul dix's book in here:

https://github.com/pauldix/service-oriented-design-with-ruby/tree/master/chapter_01

so bundle install , works fine. rake db:migrate , works fine too, outputting like:

➜  chapter_01 git:(master) ✗ rake db:migrate d, [2013-05-13t13:55:13.316178 #9154] debug -- :    (0.5ms)  select "schema_migrations"."version" "schema_migrations" i, [2013-05-13t13:55:13.316265 #9154]  info -- : migrating createusers (1) 

now run rspec spec/service_spec.rb , gives me following error saying can't fun "users" table.

 chapter_01 git:(master) ✗ rspec spec/service_spec.rb d, [2013-05-13t13:57:16.893140 #9166] debug -- : env: test d, [2013-05-13t13:57:16.936232 #9166] debug -- : db/test.sqlite3 database connection established... /users/ba018938/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:472:in `table_structure': not find table 'users' (activerecord::statementinvalid) 

so going on? can take quick , see if can run example github?

you need build out test database. since default migrations run in current environment (in case, development).

http://guides.rubyonrails.org/testing.html

  rake db:migrate    rake db:test:load 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -