[rspec-users] Troble running controller spec

David Chelimsky
Mon, 08 Jun 2009 15:01:27 -0000

On Mon, Jun 8, 2009 at 9:48 AM, Amit Kulkarni<lists at ruby-forum.com>
wrote:
> David Chelimsky wrote:
>> On Mon, Jun 8, 2009 at 8:31 AM, Amit Kulkarni<lists at
ruby-forum.com>
>> wrote:
>>>> I *think* Rails converts the keys in this hash to strings. Try:
>>>
>>> ? ?
?Channel.should_receive(:new).with(''brand_name'' =>
''manager''
>>> ).and_return(@channel)
>>> ? ? ?post :create, :channel => {''brand_name''
=> ''manager'' }
>>> ? ?end
>>>
>>> ? ?it "should save channel" do
>>> ? ? ?@channel.should_receive(:save)
>>> ? ? ?post :create
>>> ? ?end
>>> ?end
>>
>> I went as far as to create a rails 2.1.2 project with rspec and
>> rspec-rails 1.2.4, copy your code into it and ran the specs. They both
>> pass. I don''t have a Vista environment in which to test this,
so
>> that''s all I can do to help at the moment.
>>
>> Anybody else running into similar problems on Vista?
>>
>
> Thanks a lot for looking into the matter.I am not sure if i am getting
> this problem due to vista environment.If it is then i dont know what to
> do :-(
>
> Also i didnt understand b the statement
> "create a rails 2.1.2 project with rspec and rspec-rails 1.2.4, copy
> your code into it and ran the specs."

The versions  you cited earlier were rails 2.1.2 and rspec 1.2.4, so I
did the following:

* created a rails 2.1.2 project
* configured it to use rspec 1.2.4
* created a ChannelsController and a spec for it
* created a Channel model with a migration and ran the migration
* copied the code you posted in this thread to
app/controllers/channels_controller.rb and
spec/controllers/channels_controller_spec.rb
* ran the specs
* watched them pass

>
> Also i checked my spec version it is 1.2.6,so does this causing the
> problem.
> This version got updated from 1.2.4.
> Please suggest.

You stated above that you were using 1.2.4, but now you are saying you
are using 1.2.6. Please be sure to provide accurate information.

Do you have both rspec and rspec-rails? And are they both 1.2.6 now?

FYI - I get the same result from 1.2.6. All specs pass.



> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>