Sha256: 7824dda07e54aae33b853fc284507536eab11b4b937442a7c3f0379c632efa16
Contents?: true
Size: 1.35 KB
Versions: 3
Compression:
Stored size: 1.35 KB
Contents
require 'spec/spec_helper' require File.join(File.dirname(__FILE__), '..', 'lib','app', 'helpers', 'lrd_form_helper') ActionView::Helpers::FormHelper.send(:include, LRD::FormHelper) describe "form_for().unlabeled_submit", :type => :view do let :user do view.stub!(:user_path => "#") mock_model("User", :login => "Username", :bio => "This is my story", :phone => "626-111-2222") end let :template do <<-EOTEMPLATE <%= form_for(user) do |f| %> <%= f.unlabeled_submit %> <%- end -%> EOTEMPLATE end it "should have a submit button" do render(:inline => template, :locals => { :user => user }) rendered.should have_xpath("//div[@class='labeled_input']/input[@type='submit']") end describe "and submit text" do let :template do <<-EOTEMPLATE <%= form_for(user) do |f| %> <%= f.unlabeled_submit('Click Me') %> <%- end -%> EOTEMPLATE end it "should have a submit button with text" do render(:inline => template, :locals => { :user => user }) rendered.should have_xpath("//div[@class='labeled_input']/input[@type='submit'][@value='Click Me']") end it "should not put a 'submit_text' attribute in the other tags" do render(:inline => template, :locals => { :user => user }) rendered.should_not have_xpath("//*[@submit_text]") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lrd_view_tools-0.1.5 | spec/unlabeled_submit_spec.rb |
lrd_view_tools-0.1.4 | spec/unlabeled_submit_spec.rb |
lrd_view_tools-0.1.3 | spec/unlabeled_submit_spec.rb |