[rspec-users] How do we test a Rails Model which does not have an equivalent table in the backend using RSpec
lists at ruby-forum.com
Tue Nov 22 11:10:41 EST 2011
Mohnish J. wrote in post #1033006:
> Sidu Ponnappa wrote in post #1032900:
>>> I'm getting a common error for all such defined methods saying that>
>> `database_name.table_name does not exist`. Well , this is true but how>
>> should is
>> it really making a difference?, and how to get a work around> for this
>> to just
>> test a simple use case of calling a method successfully> in the above
>> I don't believe this issue has anything to do with RSpec (you'd see
>> the same if you used MiniTest or any other tool).
>> You want to have Moderator be a simple Ruby object, or possibly have
>> it inherit from ActiveModel rather than ActiveRecord.
> Thanks for your inputs Sidu,I tried replacing ActiveRecord with
> ActiveModel got the following error:-
> warning: already initialized constant HTTP_METHODS
> /home/mohnish/Cognizant/socialtango/app/models/admin_stats.rb:1:in `<top
> (required)>': uninitialized constant ActiveModel::Base (NameError)
> Seems like, I will have to look for another workaround..
The below line code did work for me:-
Posted via http://www.ruby-forum.com/.
More information about the rspec-users