Class | Spec::Rails::Example::ViewExampleGroup |
In: |
lib/spec/rails/example/view_example_group.rb
|
Parent: | FunctionalExampleGroup |
View Examples live in $RAILS_ROOT/spec/views/.
View Specs use Spec::Rails::Example::ViewExampleGroup, which provides access to views without invoking any of your controllers. See Spec::Rails::Expectations::Matchers for information about specific expectations that you can set on views.
describe "login/login" do before do render 'login/login' end it "should display login form" do response.should have_tag("form[action=/login]") do with_tag("input[type=text][name=email]") with_tag("input[type=password][name=password]") with_tag("input[type=submit][value=Login]") end end end
Renders a template for a View Spec, which then provides access to the result through the response. Also supports render with :inline, which you can use to spec custom form builders, helpers, etc, in the context of a view.
render('/people/list') render('/people/list', :helper => MyHelper) render('/people/list', :helpers => [MyHelper, MyOtherHelper]) render(:partial => '/people/_address') render(:inline => "<% custom_helper 'argument', 'another argument' %>")
See Spec::Rails::Example::ViewExampleGroup for more information.