# How i write the respec in this situation?

**URL:** <https://www.ruby-forum.com/t/how-i-write-the-respec-in-this-situation/135575>\
**Category:** Rails\
**Created:** [April 23, 2008, 8:50am UTC](https://www.ruby-forum.com/t/how-i-write-the-respec-in-this-situation/135575 "2008-04-23T08:50:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ragnarok](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/4af34b/32.png) [@Ragnarok](https://www.ruby-forum.com/u/Ragnarok)\
**Post date:** [April 23, 2008, 8:50am UTC](https://www.ruby-forum.com/t/how-i-write-the-respec-in-this-situation/135575/1 "2008-04-23T08:50:19Z")

</div>

Hi all guys!im new in rails!  
i have a forum,have\_many topics,and the topic also has\_many  
replies.Now i want to write the respec for the repliescontroller:

describe RepliesController do  
controller\_name :repies  
describe “All Requests”,:share=\>true do  
before do  
@forum = mock\_model(Forum,:id=\>‘1’)  
@topic = mock\_model(Topic,:id=\>‘1’,:forum =\>@forum)  
@reply = mock\_model(Reply,:topic =\> @topic,:save=\>true)  
Topic.stub!(:find).and\_return(@topic)  
Reply.stub!(:new).and\_return(@reply)

```
  @params = {
    :topic_id => @topic.id,
    :forum_id => @forum.id,
    :title => 'Ragnarok',
    :body => 'ragnarokrangarkratnonfgdsakl'
  }
end

def do_post
  post :create,:reply =>@params
end

it "should call Reply modl with new values" do
  Reply.should_receive(:new).with(anything()).and_return(@reply)
  do_post
end
it "should add reply to the topic" do
  do_post
  response.should redirect_to([@forum,@topic])
end

```

end

end

No route matches Error!  
i have no idea for rspec!!
