Topic: [rSpec] Controller should set a certain Variable
I am hoping this is a quick question, it has had me stumped for ages know and am hoping you can put an end to my misery!
Basically, I have the following spec:
describe TopicsController, 'handling GET /community/testing/new-topic' do
@topic = mock_model(Topic)
@board = mock_model(Board)
it "should be successful" do
it "should render new template" do
it 'should find the current board' do
it "should assign the board for the view" do
it "should create a new topic" do
it "should assign the new topic for the view" do
it 'should assign set the board_id of the new topic to the id of the current board'
You can see the last example has not yet been implemented.
The controller action that this spec is for is simply:
@board = Board.find_by_url(params[:board])
@topic = Topic.new
@topic.board_id = @board.id
But I have no idea how to write a spec for the last line. I assume it should be pretty simple, but as I am so new to this I am at a loss!
Please help me out guys