[rspec-users] Problem while generating rspec model in Rails Project

Ninad Pol lists at ruby-forum.com
Mon Jun 15 09:04:07 EDT 2009


I think this problem is not related any plugin (that define a client) 
simply because if i try it with any other ruby file(other than 
Client.rb) also i am facing same problem.And what do you mean by some 
extension in the lib directory?


David Chelimsky wrote:
> On Mon, Jun 15, 2009 at 1:42 AM, Ninad Pol<lists at ruby-forum.com> wrote:
>> Thanks for your reply.
>>
>> No, above command does not give me same error. However it creates only
>> the model file under \app\models and asks whether to overwrite it. But
>> my aim is to create rspec file under \spec\models with the actual model
>> file created under \app\models remaining unchanged. So using the rails
>> generator does not meet my objective and i have to use rspec generator
>> to meet the requirement.
> 
> I wasn't trying to meet your requirement with this - just trying to
> narrow down the problem.
> 
>> Ideal schenario should be that rspec generator creates the desired rspec
>> file under \spec\models and while creating actual model file under
>> \app\models it should ask for whether to overwrite it. I am not getting
>> this schenario may be because i am missing something.It would be really
>> helpful if you could help me out in this.
> 
> The rails code that triggers this will always raise this error if the
> Client constant (in your case) is already defined. This normally
> doesn't conflict with files in your app because they are not loaded
> when you run generators. So it seems that something other than
> app/models/client.rb is getting loaded that defines the Client
> constant (either a class or a module).
> 
> Do you have any plugins that define a Client? Or perhaps you've got
> some extension in the lib directory?

-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list