On Mon, Jun 8, 2009 at 8:31 AM, Amit Kulkarni<[email protected]> wrote:
> David Chelimsky wrote:
>> On Fri, May 22, 2009 at 1:41 AM, Amit Kulkarni <[email protected]>
>> wrote:
>>>
>>> � end
>>>
>>> � it "should create channel" do
>>> � �Channel.should_receive(:new).with(:brand_name => "test"
>>> ).and_return(@channel)
>>
>> I *think* Rails converts the keys in this hash to strings. Try:
>>
>> Channel.should_receive(:new).with('brand_name' => 'test').
>> and_return(@channel)
>>
>
> Hi,
>
> I tried with the above command but it still gives the same error.Dont
> know what is wrong.I am following the same which is given in the book
> Details are as follows
>
> require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
>
> describe ChannelsController do
> describe "Channel Creation" do
> before(:each) do
> �...@channel = mock_model(Channel, :save => nil)
> Channel.stub!(:new).and_return(@channel)
> end
>
> it "should create channel" do
> Channel.should_receive(:new).with('brand_name' => 'manager'
> ).and_return(@channel)
> post :create, :channel => {'brand_name' => 'manager' }
> end
>
> it "should save channel" do
> �[email protected]_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?
>
>
> Following are the errors
> {Please ignore the missing a's :-)}
>
> ChnnelsController
> Chnnel Cretion
> should crete chnnel (FILED - 1)
> should sve chnnel (FILED - 2)
>
> 1)
> Spec::Mocks::MockExpecttionError in 'ChnnelsController Chnnel Cretion
> should cre
> te chnnel'
> <Chnnel(id: integer, brnd_nme: string, logo_file_nme: string,
> logo_file_size: st
> ring, logo_content_type: string, points: integer, rnk: integer,
> overruled_rnk: b
> oolen, title: string, description: text, tgs: string, url: string,
> kit_file_nme:
> string, kit_file_size: string, kit_content_type: string, ctive: boolen,
> bg_colo
> r: string, font_color: string, title_color: string, title_style: string,
> emotion
> l_file_nme: string, emotionl_file_size: string, emotionl_content_type:
> string, n
> cestor_id: integer, chnnel_ctegory_id: integer, creted_t: dtetime,
> updted_t: dte
> time) (clss)> expected :new with ({"brnd_nme"=>"mnger"}) once, but
> received it 0
> times
> ./spec/controllers/chnnels_controller_spec.rb:183:
> script/spec:4:
>
> 2)
> Spec::Mocks::MockExpecttionError in 'ChnnelsController Chnnel Cretion
> should sve
> chnnel'
> Mock 'Chnnel_1002' expected :sve with (ny rgs) once, but received it 0
> times
> ./spec/controllers/chnnels_controller_spec.rb:188:
> script/spec:4:
>
> Finished in 0.305 seconds
>
> 2 exmples, 2 filures
>
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users