On Mon, Jan 2, 2012 at 7:25 PM, Anil Kumar <[email protected]> wrote:

> Hi,
>
> I have a rails application that has a Application controller that
> exposes REST API. And for the data I am using a third party module
> instead of rails Model.
>
> REST API:
>  http://myApp/plugins
>
> Route.rb:
>  match "/plugins"  => "plugins#get_plugins", :via => "get"
>
> My controller has following method:
>  def get_plugins
>    render :text=> third_party_module.get_plugins()
>  end
>
> third_party_module.get_plugins() is the third party module that returns
> data.
>
> Functional test file: plugins_controller_test.rb has the following test
> method:
>  test "should get plugins" do
>    get :get_plugins
>    assert_response :success
>  end
>
> When I am trying to run functional test, it gives following error:
> "db/schema.rb doesn't exist yet. Run "rake db:migrate" to create it then
> try again"
>
> As I am not using any database.
>
> Please help.
>

I can reproduce your problem.

On rails 3.1.3, when installing the "standard" way, I get this:

peterv@ASUS:~/b/rails-apps/apps/temp/with_AR$ rails new with_AR
--skip-bundle
...
# add gem 'therubyracer' to Gemfile and run `bundle install`
...
peterv@ASUS:~/b/rails-apps/apps/temp/with_AR$ rake environment
peterv@ASUS:~/b/rails-apps/apps/temp/with_AR$ rake test:functionals
/home/peterv/data/backed_up/rails-apps/apps/temp/with_AR/db/schema.rb
doesn't exist yet. Run "rake db:migrate" to create it then try again. If
you do not intend to use a database, you should instead alter
/home/peterv/data/backed_up/rails-apps/apps/temp/with_AR/config/application.rb
to limit the frameworks that will be loaded

So, to me this is quite clear about the issue ...

As easy solution, I then installed without ActiveRecord (read `rails help`
to find out):

peterv@ASUS:~/b/rails-apps/apps/temp$ rails new without_AR --skip-bundle
--skip-active-record
...
# add gem 'therubyracer' to Gemfile and run `bundle install`
...
peterv@ASUS:~/b/rails-apps/apps/temp/without_AR$ rake environment
peterv@ASUS:~/b/rails-apps/apps/temp/without_AR$ rake test:functionals
#=> OK

The difference is this:

peterv@ASUS:~/b/rails-apps/apps/temp/without_AR$ diff
../with_AR/config/application.rb config/application.rb
3c3,9
< require 'rails/all'
---
> # Pick the frameworks you want:
> # require "active_record/railtie"
> require "action_controller/railtie"
> require "action_mailer/railtie"
> require "active_resource/railtie"
> require "sprockets/railtie"
> require "rails/test_unit/railtie"

# So, replace the require 'replace/all' with a selective require

12c18
< module WithAR
---
> module WithoutAR

# this is just the name change (irrelevant)

You will see there are many more interesting options in `rails help`.

HTH,

Peter

-- 
Peter Vandenabeele
http://twitter.com/peter_v
http://rails.vandenabeele.com
gsm: +32-478-27.40.69
e-mail: [email protected]

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to