Created
September 7, 2011 20:37
-
-
Save thillain/1201657 to your computer and use it in GitHub Desktop.
New action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "posts/new.html.erb" do | |
before(:each) do | |
@post = assign(:post, stub_model(Post)).as_new_record.as_null_object | |
end | |
it "renders the form partial" do | |
render | |
rendered.should have_selector('form',:method => "post",:action => posts_path) do |form| | |
form.should have_selector('label',:for=>'post_title',:content=>'Title') | |
form.should have_selector('input',:type => "text",:name=>'post[title]',:id=>'post_title') | |
form.should have_selector('label',:for=>'post_description',:content=>'Description') | |
form.should have_selector('textarea',:cols=>'40',:rows=>'20',:name=>'post[description]',:id=>'post_description') | |
form.should have_selector('input',:type=>'submit',:value=>'Publish') | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment