开发者

RSpec view specs for nested models

开发者 https://www.devze.com 2023-02-21 03:10 出处:网络
How would you write a new.html.erb_spec.rb vie开发者_如何转开发w spec for this relationship. I am stumped.

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

精彩评论

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