开发者

RSpec view specs for nested models

How would you write a new.html.erb_spec.rb vie开发者_如何转开发w spec for this relationship. I am stumped.

  resources :things do
    resources :reviews
  end

Thank you.

Kent


require 'spec_helper'

describe "reviews/new.html.erb" do
  before(:each) do
    assign(:thing,mock_model(Thing) # RSpec 2 syntax
  end

  it "shows the page" do
    render
  end
end

After the render statement add a matcher for content in the page, like:

rendered.should contain("some text to match")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜