<%= content_for?(:fake).to_s %>
\ No newline at end of file
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.haml
deleted file mode 100644
index 80055aa8..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.haml
+++ /dev/null
@@ -1,12 +0,0 @@
-- content_for :demo do
- %h1 This is content yielded from a content_for
-
-.demo= yield_content :demo
-
-- content_for :demo2 do |fname, lname|
- %h1 This is content yielded with name #{fname + " " + lname}
-
-.demo2= yield_content :demo2, "Johnny", "Smith"
-
-.demo_has_content= content_for?(:demo)
-.fake_has_content= content_for?(:fake)
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.slim b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.slim
deleted file mode 100644
index f6e6770d..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.slim
+++ /dev/null
@@ -1,12 +0,0 @@
-- content_for :demo do
- h1 This is content yielded from a content_for
-
-.demo== yield_content :demo
-
-- content_for :demo2 do |fname, lname|
- h1 This is content yielded with name #{fname + " " + lname}
-
-.demo2== yield_content :demo2, "Johnny", "Smith"
-
-.demo_has_content== content_for?(:demo)
-.fake_has_content== content_for?(:fake)
\ No newline at end of file
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.erb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.erb
deleted file mode 100644
index 2771f33a..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.erb
+++ /dev/null
@@ -1,11 +0,0 @@
-<%= content_tag :p, "Test 1", :class => 'test', :id => "test1" %>
-
-<%= content_tag :p, "Test 2" %>
-
-<% content_tag(:p, :class => 'test', :id => 'test3') do %>
-
Test 3
-<% end %>
-
-<% content_tag(:p) do %>
-
Test 4
-<% end %>
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.haml
deleted file mode 100644
index 780a2332..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.haml
+++ /dev/null
@@ -1,9 +0,0 @@
-= content_tag :p, "Test 1", :class => 'test', :id => "test1"
-
-= content_tag :p, "Test 2"
-
-- content_tag(:p, :class => 'test', :id => 'test3') do
- %span Test 3
-
-- content_tag(:p) do
- %span Test 4
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.slim b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.slim
deleted file mode 100644
index 84e42bf3..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.slim
+++ /dev/null
@@ -1,9 +0,0 @@
-==content_tag :p, "Test 1", :class => 'test', :id => "test1"
-
-== content_tag :p, "Test 2"
-
-==content_tag(:p, :class => 'test', :id => 'test3') do
- span Test 3
-
-==content_tag(:p) do
- span Test 4
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.erb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.erb
deleted file mode 100644
index 94f9d7f0..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-
<%= current_engine %>
-
<%= haml :'partials/_haml' %>
-
<%= erb :'partials/_erb' %>
-
<%= slim :'partials/_slim' %>
-
<%= current_engine %>
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.haml
deleted file mode 100644
index 3522395c..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-%p.start= current_engine
-%p.haml= haml :'partials/_haml'
-%p.erb= erb :'partials/_erb'
-%p.slim= slim :'partials/_slim'
-%p.end= current_engine
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.slim b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.slim
deleted file mode 100644
index 6c7d0926..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.slim
+++ /dev/null
@@ -1,5 +0,0 @@
-p.start= current_engine
-p.haml= haml :'partials/_haml'
-p.erb= erb :'partials/_erb'
-p.slim= slim :'partials/_slim'
-p.end= current_engine
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.erb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.erb
deleted file mode 100644
index cb43d2e0..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.erb
+++ /dev/null
@@ -1,20 +0,0 @@
-<% @user = MarkupUser.new %>
-<% form_for @user , '/demo1', :id => 'demo-fields-for' do |f| %>
- <%= f.text_field :gender %>
- <% fields_for @user.permission do |permission| %>
- <%= permission.check_box :can_edit %>
- <%= permission.check_box :can_delete %>
- <% end %>
- <% f.fields_for :telephone do |child_form| %>
- <%= child_form.label :number %>
- <%= child_form.text_field :number %>
- <% end %>
- <% f.fields_for :addresses do |child_form| %>
- <%= child_form.label :name %>
- <%= child_form.text_field :name %>
- <% unless child_form.object.new_record? %>
- <%= child_form.check_box '_destroy' %>
- <%= child_form.label '_destroy', :caption => 'Remove' %>
- <% end %>
- <% end %>
-<% end %>
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.haml
deleted file mode 100644
index 6a67d79b..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.haml
+++ /dev/null
@@ -1,15 +0,0 @@
-- @user = MarkupUser.new
-- form_for @user , '/demo1', :id => 'demo-fields-for' do |f|
- = f.text_field :gender
- - fields_for @user.permission do |permission|
- = permission.check_box :can_edit
- = permission.check_box :can_delete
- - f.fields_for :telephone do |child_form|
- = child_form.label :number
- = child_form.text_field :number
- - f.fields_for :addresses do |child_form|
- = child_form.label :name
- = child_form.text_field :name
- - unless child_form.object.new_record?
- = child_form.check_box '_destroy'
- = child_form.label '_destroy', :caption => 'Remove'
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.slim b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.slim
deleted file mode 100644
index 517ef210..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.slim
+++ /dev/null
@@ -1,15 +0,0 @@
-- @user = MarkupUser.new
-== form_for @user , '/demo1', :id => 'demo-fields-for' do |f|
- == f.text_field :gender
- == fields_for @user.permission do |permission|
- == permission.check_box :can_edit
- == permission.check_box :can_delete
- == f.fields_for :telephone do |child_form|
- == child_form.label :number
- == child_form.text_field :number
- == f.fields_for :addresses do |child_form|
- == child_form.label :name
- == child_form.text_field :name
- - unless child_form.object.new_record?
- == child_form.check_box '_destroy'
- == child_form.label '_destroy', :caption => 'Remove'
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.erb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.erb
deleted file mode 100755
index bb8a5c81..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.erb
+++ /dev/null
@@ -1,72 +0,0 @@
-<% form_for MarkupUser.new, '/demo', :id => 'demo' do |f| %>
- <%= f.error_messages(:header_message => "custom MarkupUser cannot be saved!") %>
- <%= f.hidden_field :session_id %>
-
- <%= f.label :username, :caption => "Login: ", :class => 'user-label' %>
- <%= f.text_field :username, :class => 'user-text', :value => "John" %>
-
-
- <%= f.label :password %>
- <%= f.password_field :password, :class => 'user-password', :value => "secret" %>
-
-
- <%= f.label :age %>
- <%= f.number_field :age, :class => 'numeric '%>
-
-
- <%= f.label :telephone %>
- <%= f.telephone_field :telephone, :class => 'numeric' %>
-
-
- <%= f.label :email, :caption => 'Email Address: ' %>
- <%= f.email_field :email, :class => 'string' %>
-
-
- <%= f.label :webpage, :caption => 'Your Web Page: ' %>
- <%= f.url_field :webpage, :class => 'string' %>
-
-
- <%= f.label :search %>
- <%= f.search_field :search, :class => 'string' %>
-
-
- <%= f.label :photo %>
- <%= f.file_field :photo, :class => 'user-photo' %>
-
-
- <%= f.label :about, :caption => "About Me: " %>
- <%= f.text_area :about, :class => 'user-about' %>
-
-
- <%= f.label :gender, :caption => "Your gender: " %>
- <%= f.radio_button :gender, :value => 'male' %>
- <%= f.radio_button :gender, :value => 'female' %>
-
-
- <%= f.label :country, :caption => "Your country" %>
- <%= f.select :country, :options => ['USA', 'Canada', 'Mexico'], :selected => 'USA', :class => 'selector' %>
-
-
- <%= f.label :remember_me %>
- <%= f.check_box :remember_me, :value => '1' %>
-
-
<%= f.submit "Create", :class => 'success', :id => 'demo-button' %>
-
<%= f.image_submit "buttons/post.png", :class => 'success', :id => 'image-button' %>
-<% end %>
-
-<% form_for MarkupUser.new, '/another_demo', :id => 'demo2', :method => 'get' do |f| %>
- <%= f.error_messages :header_message => "custom MarkupUser cannot be saved!" %>
- <%= f.hidden_field :session_id %>
- <%= f.text_field_block :username, { :class => 'input' }, { :caption => 'Nickname: ', :class => 'label' } %>
- <%= f.password_field_block :code, { :class => 'input' } %>
- <%= f.text_area_block :about, { :class => 'textarea' } %>
- <%= f.file_field_block :photo, { :class => 'upload' } %>
- <%= f.check_box_block :remember_me, { :class => 'checker' } %>
- <%= f.select_block :state, :options => ['California', 'Texas'], :class => 'selector' %>
- <%= f.submit_block "Create", { :class => 'button' } %>
- <%= f.image_submit_block "buttons/ok.png", { :class => 'image' } %>
-<% end %>
-
-<% form_for :markup_user, '/third_demo', :id => 'demo3', :method => 'get' do |f| %>
- <%= f.text_field_block :username %>
-<% end %>
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.haml
deleted file mode 100755
index dfc71a00..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.haml
+++ /dev/null
@@ -1,59 +0,0 @@
-- form_for MarkupUser.new, '/demo', :id => 'demo' do |f|
- = f.error_messages(:header_message => "custom MarkupUser cannot be saved!")
- = f.hidden_field :session_id
- %p
- = f.label :username, :caption => "Login: ", :class => 'user-label'
- = f.text_field :username, :class => 'user-text', :value => "John"
- %p
- = f.label :password
- = f.password_field :password, :class => 'user-password', :value => "secret"
- %p
- = f.label :age
- = f.number_field :age, :class => 'numeric'
- %p
- = f.label :telephone
- = f.telephone_field :telephone, :class => 'numeric'
- %p
- = f.label :email, :caption => 'Email Address: '
- = f.email_field :email, :class => 'string'
- %p
- = f.label :webpage, :caption => 'Your Web Page: '
- = f.url_field :webpage, :class => 'string'
- %p
- = f.label :search
- = f.search_field :search, :class => 'string'
- %p
- = f.label :photo
- = f.file_field :photo, :class => 'user-photo'
- %p
- = f.label :about, :caption => "About Me: "
- = f.text_area :about, :class => 'user-about'
- %p
- = f.label :gender, :caption => "Your gender: "
- = f.radio_button :gender, :value => 'male'
- = f.radio_button :gender, :value => 'female'
- %p
- = f.label :country, :caption => "Your country"
- = f.select :country, :options => ['USA', 'Canada', 'Mexico'], :selected => 'USA', :class => 'selector'
- %p
- = f.label :remember_me
- = f.check_box :remember_me, :value => "1"
- %p
- = f.submit "Create", :class => 'success', :id => 'demo-button'
- %p
- = f.image_submit "buttons/post.png", :class => 'success', :id => 'image-button'
-
-- form_for MarkupUser.new, '/another_demo', :id => 'demo2', :method => 'get' do |f|
- = f.error_messages :header_message => "custom MarkupUser cannot be saved!"
- = f.hidden_field :session_id
- = f.text_field_block :username, { :class => 'input' }, { :caption => 'Nickname: ', :class => 'label' }
- = f.password_field_block :code, { :class => 'input' }
- = f.text_area_block :about, { :class => 'textarea' }
- = f.file_field_block :photo, { :class => 'upload' }
- = f.check_box_block :remember_me, { :class => 'checker' }
- = f.select_block :state, :options => ['California', 'Texas'], :class => 'selector'
- = f.submit_block "Create", { :class => 'button' }
- = f.image_submit_block "buttons/ok.png", { :class => 'image' }
-
-- form_for :markup_user, '/third_demo', :id => 'demo3', :method => 'get' do |f|
- = f.text_field_block :username
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.slim b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.slim
deleted file mode 100755
index 5b3906d6..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.slim
+++ /dev/null
@@ -1,59 +0,0 @@
-== form_for MarkupUser.new, '/demo', :id => 'demo' do |f|
- == f.error_messages(:header_message => "custom MarkupUser cannot be saved!")
- == f.hidden_field :session_id
- p
- == f.label :username, :caption => "Login: ", :class => 'user-label'
- == f.text_field :username, :class => 'user-text', :value => "John"
- p
- == f.label :password
- == f.password_field :password, :class => 'user-password', :value => "secret"
- p
- == f.label :age
- == f.number_field :age, :class => 'numeric'
- p
- == f.label :telephone
- == f.telephone_field :telephone, :class => 'numeric'
- p
- == f.label :email, :caption => 'Email Address: '
- == f.email_field :email, :class => 'string'
- p
- == f.label :webpage, :caption => 'Your Web Page: '
- == f.url_field :webpage, :class => 'string'
- p
- == f.label :search
- == f.search_field :search, :class => 'string'
- p
- == f.label :photo
- == f.file_field :photo, :class => 'user-photo'
- p
- == f.label :about, :caption => "About Me: "
- == f.text_area :about, :class => 'user-about'
- p
- == f.label :gender, :caption => "Your gender: "
- == f.radio_button :gender, :value => 'male'
- == f.radio_button :gender, :value => 'female'
- p
- == f.label :country, :caption => "Your country"
- == f.select :country, :options => ['USA', 'Canada', 'Mexico'], :selected => 'USA', :class => 'selector'
- p
- == f.label :remember_me
- == f.check_box :remember_me, :value => "1"
- p
- == f.submit "Create", :class => 'success', :id => 'demo-button'
- p
- == f.image_submit "buttons/post.png", :class => 'success', :id => 'image-button'
-
-== form_for MarkupUser.new, '/another_demo', :id => 'demo2', :method => 'get' do |f|
- == f.error_messages :header_message => "custom MarkupUser cannot be saved!"
- == f.hidden_field :session_id
- == f.text_field_block :username, { :class => 'input' }, { :caption => 'Nickname: ', :class => 'label' }
- == f.password_field_block :code, { :class => 'input' }
- == f.text_area_block :about, { :class => 'textarea' }
- == f.file_field_block :photo, { :class => 'upload' }
- == f.check_box_block :remember_me, { :class => 'checker' }
- == f.select_block :state, :options => ['California', 'Texas'], :class => 'selector'
- == f.submit_block "Create", { :class => 'button' }
- == f.image_submit_block "buttons/ok.png", { :class => 'image' }
-
-== form_for :markup_user, '/third_demo', :id => 'demo3', :method => 'get' do |f|
- == f.text_field_block :username
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.erb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.erb
deleted file mode 100755
index d8a96699..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.erb
+++ /dev/null
@@ -1,86 +0,0 @@
-<% form_tag '/simple', :class => 'simple-form' do %>
- <%= hidden_field_tag :session_id, :value => "__secret__" %>
- <% field_set_tag do %>
- <%= label_tag :username %>
- <%= text_field_tag :username %>
- <%= label_tag :password %>
- <%= password_field_tag :password %>
- <%= label_tag :email %>
- <%= email_field_tag :email %>
- <%= label_tag :age %>
- <%= number_field_tag :age %>
- <%= label_tag :telephone %>
- <%= telephone_field_tag :telephone %>
- <%= label_tag :webpage %>
- <%= url_field_tag :webpage %>
- <%= label_tag :search %>
- <%= search_field_tag :search %>
- <%= check_box_tag :remember_me %>
- <%= label_tag :gender %>
- <%= label_tag :color %>
- <%= select_tag :color, :options => ['green', 'orange', 'purple'] %>
- <%= radio_button_tag :gender, :value => 'male' %>
- <%= radio_button_tag :gender, :value => 'female' %>
- <%= submit_tag %>
- <% end %>
-<% end %>
-
-<% form_tag '/advanced', :id => 'advanced', :class => 'advanced-form', :method => 'get' do %>
- <%= error_messages_for MarkupUser.new, :header_message => "There are problems with saving user!" %>
- <%= hidden_field_tag :session_id, :value => "__secret__" %>
- <% field_set_tag "Advanced", :class => 'advanced-field-set' do %>
-
- <%= label_tag :username, :class => 'first', :caption => "Nickname" %>
- <%= text_field_tag :username, :value => params[:username], :id => 'the_username' %>
-
-
- <%= label_tag :password, :class => 'first' %>
- <%= password_field_tag :password, :value => params[:password] %>
-
-
- <%= label_tag :email, :caption => 'Email Address' %>
- <%= email_field_tag :email, :class => 'string' %>
-
-
- <%= label_tag :age, :class => 'age' %>
- <%= number_field_tag :age, :class => 'numeric' %>
-
-
- <%= label_tag :telephone, :class => 'telephone' %>
- <%= telephone_field_tag :telephone, :class => 'numeric' %>
-
-
- <%= label_tag :webpage, :caption => 'Your Home Page' %>
- <%= url_field_tag :webpage, :class => 'string' %>
-
-
- <%= label_tag :search %>
- <%= search_field_tag :search, :class => 'string' %>
-
-
- <%= label_tag :about, :class => 'about', :caption => "About Me" %>
- <%= text_area_tag :about, :class => 'large' %>
-
-
- <%= label_tag :photo, :class => 'photo' %>
- <%= file_field_tag :photo, :class => 'upload' %>
-
-
- <%= label_tag :gender, :class => 'gender' %>
- <%= radio_button_tag :gender, :value => 'male', :checked => true %>
- <%= radio_button_tag :remember_me, :value => 'female' %>
-
-
- <%= label_tag :fav_color %>
- <%= select_tag :fav_color, :options => [ ['green', '1'], ['orange', '2'], ['purple', '3'] ], :selected => '2' %>
-
-
- <%= check_box_tag :remember_me, :value => '1', :checked => true %>
-
- <% end %>
- <% field_set_tag(:class => 'buttons') do %>
- <%= submit_tag "Login" %>
- <%= button_tag "Cancel" %>
- <%= image_submit_tag "buttons/submit.png" %>
- <% end %>
-<% end %>
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.haml
deleted file mode 100755
index e7010e32..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.haml
+++ /dev/null
@@ -1,70 +0,0 @@
-- form_tag '/simple', :class => 'simple-form' do
- = error_messages_for nil
- - field_set_tag do
- = hidden_field_tag :session_id, :value => "__secret__"
- = label_tag :username
- = text_field_tag :username
- = label_tag :password
- = password_field_tag :password
- = label_tag :email
- = email_field_tag :email
- = label_tag :age
- = number_field_tag :age
- = label_tag :telephone
- = telephone_field_tag :telephone
- = label_tag :webpage
- = url_field_tag :webpage
- = label_tag :search
- = search_field_tag :search
- = label_tag :color
- = select_tag :color, :options => ['green', 'orange', 'purple']
- = label_tag :gender
- = radio_button_tag :gender, :value => 'male'
- = radio_button_tag :gender, :value => 'female'
- = check_box_tag :remember_me
- = submit_tag
-
-- form_tag '/advanced', :id => 'advanced', :class => 'advanced-form', :method => 'get' do
- = error_messages_for MarkupUser.new, :header_message => "There are problems with saving user!"
- = hidden_field_tag :session_id, :value => "__secret__"
- - field_set_tag "Advanced", :class => 'advanced-field-set' do
- %p
- = label_tag :username, :class => 'first', :caption => "Nickname"
- = text_field_tag :username, :value => params[:username], :id => 'the_username'
- %p
- = label_tag :password, :class => 'first'
- = password_field_tag :password, :value => params[:password]
- %p
- = label_tag :email, :caption => 'Email Address'
- = email_field_tag :email, :class => 'string'
- %p
- = label_tag :age, :class => 'age'
- = number_field_tag :age, :class => 'numeric'
- %p
- = label_tag :telephone, :class => 'telephone'
- = telephone_field_tag :telephone, :class => 'numeric'
- %p
- = label_tag :webpage, :caption => 'Your Home Page'
- = url_field_tag :webpage, :class => 'string'
- %p
- = label_tag :search
- = search_field_tag :search, :class => 'string'
- %p
- = label_tag :about, :class => 'about', :caption => "About Me"
- = text_area_tag :about, :class => 'large'
- %p
- = label_tag :gender, :class => 'gender'
- = radio_button_tag :gender, :value => 'male', :checked => true
- = radio_button_tag :gender, :value => 'female'
- %p
- = label_tag :photo, :class => 'photo'
- = file_field_tag :photo, :class => 'upload'
- %p
- = label_tag :fav_color
- = select_tag :fav_color, :options => [ ['green', '1'], ['orange', '2'], ['purple', '3'] ], :selected => '2'
- %p
- = check_box_tag :remember_me, :value => "1", :checked => true
- - field_set_tag(:class => 'buttons') do
- = submit_tag "Login"
- = button_tag "Cancel"
- = image_submit_tag "buttons/submit.png"
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.slim b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.slim
deleted file mode 100755
index 8ec5c58e..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.slim
+++ /dev/null
@@ -1,70 +0,0 @@
-== form_tag '/simple', :class => 'simple-form' do
- == error_messages_for nil
- == field_set_tag do
- == hidden_field_tag :session_id, :value => "__secret__"
- == label_tag :username
- == text_field_tag :username
- == label_tag :password
- == password_field_tag :password
- == label_tag :email
- == email_field_tag :email
- == label_tag :age
- == number_field_tag :age
- == label_tag :telephone
- == telephone_field_tag :telephone
- == label_tag :webpage
- == url_field_tag :webpage
- == label_tag :search
- == search_field_tag :search
- == label_tag :color
- == select_tag :color, :options => ['green', 'orange', 'purple']
- == label_tag :gender
- == radio_button_tag :gender, :value => 'male'
- == radio_button_tag :gender, :value => 'female'
- == check_box_tag :remember_me
- == submit_tag
-
-== form_tag '/advanced', :id => 'advanced', :class => 'advanced-form', :method => 'get' do
- == error_messages_for MarkupUser.new, :header_message => "There are problems with saving user!"
- == hidden_field_tag :session_id, :value => "__secret__"
- == field_set_tag "Advanced", :class => 'advanced-field-set' do
- p
- == label_tag :username, :class => 'first', :caption => "Nickname"
- == text_field_tag :username, :value => params[:username], :id => 'the_username'
- p
- == label_tag :password, :class => 'first'
- == password_field_tag :password, :value => params[:password]
- p
- == label_tag :email, :caption => 'Email Address'
- == email_field_tag :email, :class => 'string'
- p
- == label_tag :age, :class => 'age'
- == number_field_tag :age, :class => 'numeric'
- p
- == label_tag :telephone, :class => 'telephone'
- == telephone_field_tag :telephone, :class => 'numeric'
- p
- == label_tag :webpage, :caption => 'Your Home Page'
- == url_field_tag :webpage, :class => 'string'
- p
- == label_tag :search
- == search_field_tag :search, :class => 'string'
- p
- == label_tag :about, :class => 'about', :caption => "About Me"
- == text_area_tag :about, :class => 'large'
- p
- == label_tag :gender, :class => 'gender'
- == radio_button_tag :gender, :value => 'male', :checked => true
- == radio_button_tag :gender, :value => 'female'
- p
- == label_tag :photo, :class => 'photo'
- == file_field_tag :photo, :class => 'upload'
- p
- == label_tag :fav_color
- == select_tag :fav_color, :options => [ ['green', '1'], ['orange', '2'], ['purple', '3'] ], :selected => '2'
- p
- == check_box_tag :remember_me, :value => "1", :checked => true
- == field_set_tag(:class => 'buttons') do
- == submit_tag "Login"
- == button_tag "Cancel"
- == image_submit_tag "buttons/submit.png"
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.erb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.erb
deleted file mode 100644
index 56631c4f..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-<%= link_to "Test 1 No Block", '/test1', :class => 'test', :id => 'test1' %>
-
-<% link_to("/test2", :class => 'test', :id => 'test2') do %>
- Test 2 With Block
-<% end %>
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.haml
deleted file mode 100644
index b53277d4..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-= link_to "Test 1 No Block", '/test1', :class => 'test', :id => 'test1'
-
-- link_to("/test2", :class => 'test', :id => 'test2') do
- %span Test 2 With Block
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.slim b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.slim
deleted file mode 100644
index 5e0a837f..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.slim
+++ /dev/null
@@ -1,4 +0,0 @@
-= link_to "Test 1 No Block", '/test1', :class => 'test', :id => 'test1'
-
-- link_to("/test2", :class => 'test', :id => 'test2') do
- span Test 2 With Block
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.erb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.erb
deleted file mode 100644
index a0b54128..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-
<%= mail_to 'test@demo.com' %>
-
-
<%= mail_to 'test@demo.com', "Click my Email" %>
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.haml
deleted file mode 100644
index 4cd7b791..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-%p.simple= mail_to 'test@demo.com'
-
-%p.captioned= mail_to 'test@demo.com', "Click my Email"
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.slim b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.slim
deleted file mode 100644
index e17a1a44..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.slim
+++ /dev/null
@@ -1,3 +0,0 @@
-p.simple== mail_to 'test@demo.com'
-
-p.captioned== mail_to 'test@demo.com', "Click my Email"
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.erb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.erb
deleted file mode 100644
index a9d086d3..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<%= meta_tag "weblog,news", :name => "keywords" %>
-
-<%= meta_tag "text/html; charset=UTF-8", :"http-equiv" => "Content-Type" %>
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.haml
deleted file mode 100644
index 9ed5ae35..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-= meta_tag "weblog,news", :name => "keywords"
-
-= meta_tag "text/html; charset=UTF-8", :"http-equiv" => "Content-Type"
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.slim b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.slim
deleted file mode 100644
index 7d809deb..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.slim
+++ /dev/null
@@ -1,3 +0,0 @@
-== meta_tag "weblog,news", :name => "keywords"
-
-== meta_tag "text/html; charset=UTF-8", :"http-equiv" => "Content-Type"
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_erb.erb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_erb.erb
deleted file mode 100644
index 365e638f..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_erb.erb
+++ /dev/null
@@ -1 +0,0 @@
-<%= current_engine %>
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_haml.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_haml.haml
deleted file mode 100644
index 790066c9..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_haml.haml
+++ /dev/null
@@ -1 +0,0 @@
-=current_engine
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_slim.slim b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_slim.slim
deleted file mode 100644
index 790066c9..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_slim.slim
+++ /dev/null
@@ -1 +0,0 @@
-=current_engine
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.erb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.erb
deleted file mode 100644
index 1bfd39ae..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.erb
+++ /dev/null
@@ -1 +0,0 @@
-
<%= partial 'partials/erb', :engine => "erb" %>
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.haml
deleted file mode 100644
index bc120c58..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.haml
+++ /dev/null
@@ -1 +0,0 @@
-%p.haml= partial 'partials/haml', :engine => "haml"
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.slim b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.slim
deleted file mode 100644
index 698d9a0e..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.slim
+++ /dev/null
@@ -1 +0,0 @@
-p.slim= partial 'partials/slim', :engine => "slim"
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/app.rb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/app.rb
deleted file mode 100644
index 809bf766..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/app.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
-PADRINO_ENV = 'test' unless defined? PADRINO_ENV
-
-require 'padrino-core'
-require 'slim'
-
-class RenderUser
- attr_accessor :name
- def initialize(name); @name = name; end
-end
-
-class RenderDemo < Padrino::Application
- register Padrino::Rendering
- register Padrino::Helpers
-
- configure do
- set :logging, false
- set :padrino_logging, false
- end
-
- # get current engines from partials
- get '/current_engine' do
- render :current_engine
- end
-
- # get current engines from explicit engine partials
- get '/explicit_engine' do
- render :explicit_engine
- end
-
- # partial with object
- get '/partial/object' do
- partial 'template/user', :object => RenderUser.new('John'), :locals => { :extra => "bar" }
- end
-
- # partial with collection
- get '/partial/collection' do
- partial 'template/user', :collection => [RenderUser.new('John'), RenderUser.new('Billy')], :locals => { :extra => "bar" }
- end
-
- # partial with locals
- get '/partial/locals' do
- partial 'template/user', :locals => { :user => RenderUser.new('John'), :extra => "bar" }
- end
-
- # partial starting with forward slash
- get '/partial/foward_slash' do
- partial '/template/user', :object => RenderUser.new('John'), :locals => { :extra => "bar" }
- end
-end
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engine.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engine.haml
deleted file mode 100644
index e49423d1..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engine.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-%p.start= current_engine
-%p.haml= partial 'current_engines/haml'
-%p.erb= partial 'current_engines/erb'
-%p.slim= partial 'current_engines/slim'
-%p.end= current_engine
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_erb.erb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_erb.erb
deleted file mode 100644
index d10c2b3b..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_erb.erb
+++ /dev/null
@@ -1 +0,0 @@
-
<%= current_engine %>
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_haml.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_haml.haml
deleted file mode 100644
index 4db543bc..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_haml.haml
+++ /dev/null
@@ -1 +0,0 @@
-%span=current_engine
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_slim.slim b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_slim.slim
deleted file mode 100644
index 480cb50b..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_slim.slim
+++ /dev/null
@@ -1 +0,0 @@
-span=current_engine
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/erb/test.erb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/erb/test.erb
deleted file mode 100644
index 6549fd1e..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/erb/test.erb
+++ /dev/null
@@ -1 +0,0 @@
-
This is a <%= @template %> template!
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/explicit_engine.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/explicit_engine.haml
deleted file mode 100644
index 337ff147..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/explicit_engine.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-%p.start= current_engine
-%p.haml= partial "current_engines/haml", :engine => :haml
-%p.erb= partial 'current_engines/erb', :engine => :erb
-%p.slim= partial 'current_engines/slim', :engine => :slim
-%p.end= current_engine
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/haml/test.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/haml/test.haml
deleted file mode 100644
index 352e28f6..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/haml/test.haml
+++ /dev/null
@@ -1 +0,0 @@
-%h1 This is a #{@template} template!
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/_user.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/_user.haml
deleted file mode 100644
index cba4cc4b..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/_user.haml
+++ /dev/null
@@ -1,7 +0,0 @@
-%h1 User name is #{user.name}
-
-- if defined?(extra)
- %p Extra is #{extra}
-
-- if defined?(user_counter)
- %p My counter is #{user_counter}
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/haml_template.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/haml_template.haml
deleted file mode 100644
index 519fc9d2..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/haml_template.haml
+++ /dev/null
@@ -1 +0,0 @@
-%h1 This is a #{@template} template sent from render_template!
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/some_template.haml b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/some_template.haml
deleted file mode 100644
index c98a33e5..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/some_template.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-%h1 This is a haml template which was detected!
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/helper.rb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/helper.rb
deleted file mode 100644
index b1452e6d..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/helper.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-require File.expand_path('../../../load_paths', __FILE__)
-require File.join(File.dirname(__FILE__), '..', '..', 'padrino-core', 'test', 'mini_shoulda')
-require 'rack/test'
-require 'webrat'
-require 'padrino-helpers'
-require 'active_support/time'
-
-class MiniTest::Spec
- include Padrino::Helpers::OutputHelpers
- include Padrino::Helpers::TagHelpers
- include Padrino::Helpers::AssetTagHelpers
- include Rack::Test::Methods
- include Webrat::Methods
- include Webrat::Matchers
-
- Webrat.configure do |config|
- config.mode = :rack
- end
-
- def stop_time_for_test
- time = Time.now
- Time.stubs(:now).returns(time)
- return time
- end
-
- # assert_has_tag(:h1, :content => "yellow") { "
yellow
" }
- # In this case, block is the html to evaluate
- def assert_has_tag(name, attributes = {}, &block)
- html = block && block.call
- matcher = HaveSelector.new(name, attributes)
- raise "Please specify a block!" if html.blank?
- assert matcher.matches?(html), matcher.failure_message
- end
-
- # assert_has_no_tag, tag(:h1, :content => "yellow") { "
green
" }
- # In this case, block is the html to evaluate
- def assert_has_no_tag(name, attributes = {}, &block)
- html = block && block.call
- attributes.merge!(:count => 0)
- matcher = HaveSelector.new(name, attributes)
- raise "Please specify a block!" if html.blank?
- assert matcher.matches?(html), matcher.failure_message
- end
-
- # Asserts that a file matches the pattern
- def assert_match_in_file(pattern, file)
- assert File.exist?(file), "File '#{file}' does not exist!"
- assert_match pattern, File.read(file)
- end
-
- # mock_model("Business", :new_record? => true) =>
- def mock_model(klazz, options={})
- options.reverse_merge!(:class => klazz, :new_record? => false, :id => 20, :errors => {})
- record = stub(options)
- record.stubs(:to_ary => [record])
- record
- end
-end
-
-module Webrat
- module Logging
- def logger # @private
- @logger = nil
- end
- end
-end
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_asset_tag_helpers.rb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_asset_tag_helpers.rb
deleted file mode 100644
index 257e8ae4..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_asset_tag_helpers.rb
+++ /dev/null
@@ -1,328 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/helper')
-require File.expand_path(File.dirname(__FILE__) + '/fixtures/markup_app/app')
-
-describe "AssetTagHelpers" do
- include Padrino::Helpers::AssetTagHelpers
-
- def app
- MarkupDemo.tap { |app| app.set :environment, :test }
- end
-
- def flash
- @_flash ||= { :notice => "Demo notice" }
- end
-
- context 'for #flash_tag method' do
- should "display flash with no given attributes" do
- assert_has_tag('div.notice', :content => "Demo notice") { flash_tag(:notice) }
- end
- should "display flash with given attributes" do
- actual_html = flash_tag(:notice, :class => 'notice', :id => 'notice-area')
- assert_has_tag('div.notice#notice-area', :content => "Demo notice") { actual_html }
- end
- should "display multiple flash tags with given attributes" do
- flash[:error] = 'wrong'
- flash[:success] = 'okey'
- actual_html = flash_tag(:success, :error, :id => 'area')
- assert_has_tag('div.success#area', :content => flash[:success]) { actual_html }
- assert_has_tag('div.error#area', :content => flash[:error]) { actual_html }
- assert_has_no_tag('div.notice') { actual_html }
- end
- end
-
- context 'for #link_to method' do
- should "display link element with no given attributes" do
- assert_has_tag('a', :content => "Sign up", :href => '/register') { link_to('Sign up', '/register') }
- end
-
- should "display link element with given attributes" do
- actual_html = link_to('Sign up', '/register', :class => 'first', :id => 'linky')
- assert_has_tag('a#linky.first', :content => "Sign up", :href => '/register') { actual_html }
- end
-
- should "display link element with anchor attribute" do
- actual_html = link_to("Anchor", "/anchor", :anchor => :foo)
- assert_has_tag('a', :content => "Anchor", :href => '/anchor#foo') { actual_html }
- end
-
- should "display link element with void url and options" do
- actual_link = link_to('Sign up', :class => "test")
- assert_has_tag('a', :content => "Sign up", :href => '#', :class => 'test') { actual_link }
- end
-
- should "display link element with remote option" do
- actual_link = link_to('Sign up', '/register', :remote => true)
- assert_has_tag('a', :content => "Sign up", :href => '/register', 'data-remote' => 'true') { actual_link }
- end
-
- should "display link element with method option" do
- actual_link = link_to('Sign up', '/register', :method => :delete)
- assert_has_tag('a', :content => "Sign up", :href => '/register', 'data-method' => 'delete', :rel => 'nofollow') { actual_link }
- end
-
- should "display link element with confirm option" do
- actual_link = link_to('Sign up', '/register', :confirm => "Are you sure?")
- assert_has_tag('a', :content => "Sign up", :href => '/register', 'data-confirm' => 'Are you sure?') { actual_link }
- end
-
- should "display link element with ruby block" do
- actual_link = link_to('/register', :class => 'first', :id => 'binky') { "Sign up" }
- assert_has_tag('a#binky.first', :content => "Sign up", :href => '/register') { actual_link }
- end
-
- should "display link block element in haml" do
- visit '/haml/link_to'
- assert_have_selector :a, :content => "Test 1 No Block", :href => '/test1', :class => 'test', :id => 'test1'
- assert_have_selector :a, :content => "Test 2 With Block", :href => '/test2', :class => 'test', :id => 'test2'
- end
-
- should "display link block element in erb" do
- visit '/erb/link_to'
- assert_have_selector :a, :content => "Test 1 No Block", :href => '/test1', :class => 'test', :id => 'test1'
- assert_have_selector :a, :content => "Test 2 With Block", :href => '/test2', :class => 'test', :id => 'test2'
- end
- end
-
- context 'for #mail_to method' do
- should "display link element for mail to no caption" do
- actual_html = mail_to('test@demo.com')
- assert_has_tag(:a, :href => "mailto:test@demo.com", :content => 'test@demo.com') { actual_html }
- end
-
- should "display link element for mail to with caption" do
- actual_html = mail_to('test@demo.com', "My Email", :class => 'demo')
- assert_has_tag(:a, :href => "mailto:test@demo.com", :content => 'My Email', :class => 'demo') { actual_html }
- end
-
- should "display link element for mail to with caption and mail options" do
- actual_html = mail_to('test@demo.com', "My Email", :subject => 'demo test', :class => 'demo', :cc => 'foo@test.com')
- assert_has_tag(:a, :class => 'demo') { actual_html }
- assert_match %r{mailto\:test\@demo.com\?}, actual_html
- assert_match %r{cc=foo\@test\.com}, actual_html
- assert_match %r{subject\=demo\%20test}, actual_html
- end
-
- should "display mail link element in haml" do
- visit '/haml/mail_to'
- assert_have_selector 'p.simple a', :href => 'mailto:test@demo.com', :content => 'test@demo.com'
- assert_have_selector 'p.captioned a', :href => 'mailto:test@demo.com', :content => 'Click my Email'
- end
-
- should "display mail link element in erb" do
- visit '/erb/mail_to'
- assert_have_selector 'p.simple a', :href => 'mailto:test@demo.com', :content => 'test@demo.com'
- assert_have_selector 'p.captioned a', :href => 'mailto:test@demo.com', :content => 'Click my Email'
- end
-
- should "display mail link element in slim" do
- visit '/slim/mail_to'
- assert_have_selector 'p.simple a', :href => 'mailto:test@demo.com', :content => 'test@demo.com'
- assert_have_selector 'p.captioned a', :href => 'mailto:test@demo.com', :content => 'Click my Email'
- end
- end
-
- context 'for #meta_tag method' do
- should "display meta tag with given content and name" do
- actual_html = meta_tag("weblog,news", :name => "keywords")
- assert_has_tag("meta", :name => "keywords", "content" => "weblog,news") { actual_html }
- end
-
- should "display meta tag with given content and http-equiv" do
- actual_html = meta_tag("text/html; charset=UTF-8", :"http-equiv" => "Content-Type")
- assert_has_tag("meta", :"http-equiv" => "Content-Type", "content" => "text/html; charset=UTF-8") { actual_html }
- end
-
- should "display meta tag element in haml" do
- visit '/haml/meta_tag'
- assert_have_selector 'meta', "content" => "weblog,news", :name => "keywords"
- assert_have_selector 'meta', "content" => "text/html; charset=UTF-8", :"http-equiv" => "Content-Type"
- end
-
- should "display meta tag element in erb" do
- visit '/erb/meta_tag'
- assert_have_selector 'meta', "content" => "weblog,news", :name => "keywords"
- assert_have_selector 'meta', "content" => "text/html; charset=UTF-8", :"http-equiv" => "Content-Type"
- end
-
- should "display meta tag element in slim" do
- visit '/slim/meta_tag'
- assert_have_selector 'meta', "content" => "weblog,news", :name => "keywords"
- assert_have_selector 'meta', "content" => "text/html; charset=UTF-8", :"http-equiv" => "Content-Type"
- end
- end
-
- context 'for #image_tag method' do
- should "display image tag absolute link with no options" do
- time = stop_time_for_test
- assert_has_tag('img', :src => "/absolute/pic.gif") { image_tag('/absolute/pic.gif') }
- end
-
- should "display image tag relative link with specified uri root" do
- time = stop_time_for_test
- self.class.stubs(:uri_root).returns("/blog")
- assert_has_tag('img', :src => "/blog/images/relative/pic.gif?#{time.to_i}") { image_tag('relative/pic.gif') }
- end
-
- should "display image tag relative link with options" do
- time = stop_time_for_test
- assert_has_tag('img.photo', :src => "/images/relative/pic.gif?#{time.to_i}") {
- image_tag('relative/pic.gif', :class => 'photo') }
- end
-
- should "display image tag uri link with options" do
- time = stop_time_for_test
- assert_has_tag('img.photo', :src => "http://demo.org/pic.gif") { image_tag('http://demo.org/pic.gif', :class => 'photo') }
- end
-
- should "display image tag relative link with incorrect spacing" do
- time = stop_time_for_test
- assert_has_tag('img.photo', :src => "/images/%20relative/%20pic.gif%20%20?#{time.to_i}") {
- image_tag(' relative/ pic.gif ', :class => 'photo') }
- end
-
- should "not use a timestamp if stamp setting is false" do
- self.class.expects(:asset_stamp).returns(false)
- assert_has_tag('img', :src => "/absolute/pic.gif") { image_tag('/absolute/pic.gif') }
- end
-
- should "have xhtml convention tag" do
- self.class.expects(:asset_stamp).returns(false)
- assert_equal image_tag('/absolute/pic.gif'), ''
- end
- end
-
- context 'for #stylesheet_link_tag method' do
- should "display stylesheet link item" do
- time = stop_time_for_test
- expected_options = { :media => "screen", :rel => "stylesheet", :type => "text/css" }
- assert_has_tag('link', expected_options.merge(:href => "/stylesheets/style.css?#{time.to_i}")) { stylesheet_link_tag('style') }
- end
-
- should "display stylesheet link item for long relative path" do
- time = stop_time_for_test
- expected_options = { :media => "screen", :rel => "stylesheet", :type => "text/css" }
- actual_html = stylesheet_link_tag('example/demo/style')
- assert_has_tag('link', expected_options.merge(:href => "/stylesheets/example/demo/style.css?#{time.to_i}")) { actual_html }
- end
-
- should "display stylesheet link item with absolute path" do
- time = stop_time_for_test
- expected_options = { :media => "screen", :rel => "stylesheet", :type => "text/css" }
- actual_html = stylesheet_link_tag('/css/style')
- assert_has_tag('link', expected_options.merge(:href => "/css/style.css")) { actual_html }
- end
-
- should "display stylesheet link item with uri root" do
- self.class.stubs(:uri_root).returns("/blog")
- time = stop_time_for_test
- expected_options = { :media => "screen", :rel => "stylesheet", :type => "text/css" }
- actual_html = stylesheet_link_tag('style')
- assert_has_tag('link', expected_options.merge(:href => "/blog/stylesheets/style.css?#{time.to_i}")) { actual_html }
- end
-
- should "display stylesheet link items" do
- time = stop_time_for_test
- actual_html = stylesheet_link_tag('style', 'layout.css', 'http://google.com/style.css')
- assert_has_tag('link', :media => "screen", :rel => "stylesheet", :type => "text/css", :count => 3) { actual_html }
- assert_has_tag('link', :href => "/stylesheets/style.css?#{time.to_i}") { actual_html }
- assert_has_tag('link', :href => "/stylesheets/layout.css?#{time.to_i}") { actual_html }
- assert_has_tag('link', :href => "http://google.com/style.css") { actual_html }
- assert_equal actual_html, stylesheet_link_tag(['style', 'layout.css', 'http://google.com/style.css'])
- end
-
- should "not use a timestamp if stamp setting is false" do
- self.class.expects(:asset_stamp).returns(false)
- expected_options = { :media => "screen", :rel => "stylesheet", :type => "text/css" }
- assert_has_tag('link', expected_options.merge(:href => "/stylesheets/style.css")) { stylesheet_link_tag('style') }
- end
- end
-
- context 'for #javascript_include_tag method' do
- should "display javascript item" do
- time = stop_time_for_test
- actual_html = javascript_include_tag('application')
- assert_has_tag('script', :src => "/javascripts/application.js?#{time.to_i}", :type => "text/javascript") { actual_html }
- end
-
- should "display javascript item for long relative path" do
- time = stop_time_for_test
- actual_html = javascript_include_tag('example/demo/application')
- assert_has_tag('script', :src => "/javascripts/example/demo/application.js?#{time.to_i}", :type => "text/javascript") { actual_html }
- end
-
- should "display javascript item for path containing js" do
- time = stop_time_for_test
- actual_html = javascript_include_tag 'test/jquery.json'
- assert_has_tag('script', :src => "/javascripts/test/jquery.json?#{time.to_i}", :type => "text/javascript") { actual_html }
- end
-
- should "display javascript item for path containing period" do
- time = stop_time_for_test
- actual_html = javascript_include_tag 'test/jquery.min'
- assert_has_tag('script', :src => "/javascripts/test/jquery.min.js?#{time.to_i}", :type => "text/javascript") { actual_html }
- end
-
- should "display javascript item with absolute path" do
- time = stop_time_for_test
- actual_html = javascript_include_tag('/js/application')
- assert_has_tag('script', :src => "/js/application.js", :type => "text/javascript") { actual_html }
- end
-
- should "display javascript item with uri root" do
- self.class.stubs(:uri_root).returns("/blog")
- time = stop_time_for_test
- actual_html = javascript_include_tag('application')
- assert_has_tag('script', :src => "/blog/javascripts/application.js?#{time.to_i}", :type => "text/javascript") { actual_html }
- end
-
- should "display javascript items" do
- time = stop_time_for_test
- actual_html = javascript_include_tag('application', 'base.js', 'http://google.com/lib.js')
- assert_has_tag('script', :type => "text/javascript", :count => 3) { actual_html }
- assert_has_tag('script', :src => "/javascripts/application.js?#{time.to_i}") { actual_html }
- assert_has_tag('script', :src => "/javascripts/base.js?#{time.to_i}") { actual_html }
- assert_has_tag('script', :src => "http://google.com/lib.js") { actual_html }
- assert_equal actual_html, javascript_include_tag(['application', 'base.js', 'http://google.com/lib.js'])
- end
-
- should "not use a timestamp if stamp setting is false" do
- self.class.expects(:asset_stamp).returns(false)
- actual_html = javascript_include_tag('application')
- assert_has_tag('script', :src => "/javascripts/application.js", :type => "text/javascript") { actual_html }
- end
- end
-
- context "for #favicon_tag method" do
- should "display favicon" do
- time = stop_time_for_test
- actual_html = favicon_tag('icons/favicon.png')
- assert_has_tag('link', :rel => 'icon', :type => 'image/png', :href => "/images/icons/favicon.png?#{time.to_i}") { actual_html }
- end
-
- should "match type with file ext" do
- time = stop_time_for_test
- actual_html = favicon_tag('favicon.ico')
- assert_has_tag('link', :rel => 'icon', :type => 'image/ico', :href => "/images/favicon.ico?#{time.to_i}") { actual_html }
- end
-
- should "allow option overrides" do
- time = stop_time_for_test
- actual_html = favicon_tag('favicon.png', :type => 'image/ico')
- assert_has_tag('link', :rel => 'icon', :type => 'image/ico', :href => "/images/favicon.png?#{time.to_i}") { actual_html }
- end
- end
-
- context 'for #feed_tag method' do
- should "generate correctly link tag for rss" do
- assert_has_tag('link', :type => 'application/rss+xml', :rel => 'alternate', :href => "/blog/post.rss", :title => 'rss') { feed_tag :rss, "/blog/post.rss" }
- end
-
- should "generate correctly link tag for atom" do
- assert_has_tag('link', :type => 'application/atom+xml', :rel => 'alternate', :href => "/blog/post.atom", :title => 'atom') { feed_tag :atom, "/blog/post.atom" }
- end
-
- should "override options" do
- assert_has_tag('link', :type => 'my-type', :rel => 'my-rel', :href => "/blog/post.rss", :title => 'my-title') { feed_tag :rss, "/blog/post.rss", :type => "my-type", :rel => "my-rel", :title => "my-title" }
- end
- end
-end
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_builder.rb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_builder.rb
deleted file mode 100644
index b3cdb744..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_builder.rb
+++ /dev/null
@@ -1,1106 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/helper')
-require File.expand_path(File.dirname(__FILE__) + '/fixtures/markup_app/app')
-
-describe "FormBuilder" do
- include Padrino::Helpers::FormHelpers
-
- # Dummy form builder for testing
- module Padrino::Helpers::FormBuilder
- class FakeFormBuilder < AbstractFormBuilder
- def foo_field; @template.content_tag(:span, "bar"); end
- end
- end
-
- def app
- MarkupDemo.tap { |app| app.set :environment, :test }
- end
-
- def setup
- role_types = [mock_model('Role', :name => "Admin", :id => 1),
- mock_model('Role', :name => 'Moderate', :id => 2), mock_model('Role', :name => 'Limited', :id => 3)]
- @user = mock_model("User", :first_name => "Joe", :email => '', :session_id => 54)
- @user.stubs(:errors => {:a => "must be present", :b => "must be valid", :email => "Must be valid", :first_name => []})
- @user.stubs(:role_types => role_types, :role => "1")
- @user_none = mock_model("User")
- end
-
- def standard_builder(object=@user)
- Padrino::Helpers::FormBuilder::StandardFormBuilder.new(self, object)
- end
-
- context 'for #form_for method' do
- should "display correct form html" do
- actual_html = form_for(@user, '/register', :id => 'register', :"accept-charset" => "UTF-8", :method => 'post') { "Demo" }
- assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/register', :id => 'register', :method => 'post', :content => "Demo") { actual_html }
- assert_has_tag('form input[type=hidden]', :name => '_method', :count => 0) { actual_html } # no method action field
- end
-
- should "display correct form html with fake object" do
- actual_html = form_for(:markup_user, '/register', :id => 'register', :"accept-charset" => "UTF-8", :method => 'post') { |f| f.text_field :username }
- assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/register', :id => 'register', :method => 'post') { actual_html }
- assert_has_tag('form input', :type => 'text', :name => 'markup_user[username]') { actual_html }
- assert_has_tag('form input[type=hidden]', :name => '_method', :count => 0) { actual_html } # no method action field
- end
-
- should "display correct form html for namespaced object" do
- actual_html = form_for(Outer::UserAccount.new, '/register', :"accept-charset" => "UTF-8", :method => 'post') { |f| f.text_field :username }
- assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/register', :method => 'post') { actual_html }
- assert_has_tag('form input', :type => 'text', :name => 'outer_user_account[username]') { actual_html }
- end
-
- should "display form specifying default builder setting" do
- self.expects(:settings).returns(stub(:default_builder => 'FakeFormBuilder')).once
- actual_html = ""
- actual_html = form_for(@user, '/register', :id => 'register', :"accept-charset" => "UTF-8", :method => 'post') { |f| f.foo_field }
- assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/register', :method => 'post') { actual_html }
- assert_has_tag('span', :content => "bar") { actual_html }
- end
-
- should "display correct form html with remote option" do
- actual_html = form_for(@user, '/update', :"accept-charset" => "UTF-8", :remote => true) { "Demo" }
- assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/update', :method => 'post', "data-remote" => 'true') { actual_html }
- end
-
- should "display correct form html with remote option and method put" do
- actual_html = form_for(@user, '/update', :"accept-charset" => "UTF-8", :remote => true, :method => 'put') { "Demo" }
- assert_has_tag('form', :"accept-charset" => "UTF-8", :method => 'post', "data-remote" => 'true') { actual_html }
- assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'put') { actual_html }
- end
-
- should "display correct form html with method :put" do
- actual_html = form_for(@user, '/update', :"accept-charset" => "UTF-8", :method => 'put') { "Demo" }
- assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/update', :method => 'post') { actual_html }
- assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'put') { actual_html }
- end
-
- should "display correct form html with method :delete" do
- actual_html = form_for(@user, '/destroy', :"accept-charset" => "UTF-8", :method => 'delete') { "Demo" }
- assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/destroy', :method => 'post') { actual_html }
- assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'delete') { actual_html }
- end
-
- should "display correct form html with multipart" do
- actual_html = form_for(@user, '/register', :"accept-charset" => "UTF-8", :multipart => true) { "Demo" }
- assert_has_tag('form', :"accept-charset" => "UTF-8", :action => '/register', :enctype => "multipart/form-data") { actual_html }
- end
-
- should "support changing form builder type" do
- form_html = proc { form_for(@user, '/register', :"accept-charset" => "UTF-8", :builder => "AbstractFormBuilder") { |f| f.text_field_block(:name) } }
- assert_raises(NoMethodError) { form_html.call }
- end
-
- should "support using default standard builder" do
- actual_html = form_for(@user, '/register') { |f| f.text_field_block(:name) }
- assert_has_tag('form p input[type=text]') { actual_html }
- end
-
- should "display fail for form with nil object" do
- assert_raises(RuntimeError) { form_for(@not_real, '/register', :id => 'register', :method => 'post') { "Demo" } }
- end
-
- should "display correct form in haml" do
- visit '/haml/form_for'
- assert_have_selector :form, :action => '/demo', :id => 'demo'
- assert_have_selector :form, :action => '/another_demo', :id => 'demo2', :method => 'get'
- assert_have_selector :form, :action => '/third_demo', :id => 'demo3', :method => 'get'
- end
-
- should "display correct form in erb" do
- visit '/erb/form_for'
- assert_have_selector :form, :action => '/demo', :id => 'demo'
- assert_have_selector :form, :action => '/another_demo', :id => 'demo2', :method => 'get'
- assert_have_selector :form, :action => '/third_demo', :id => 'demo3', :method => 'get'
- end
-
- should "display correct form in slim" do
- visit '/slim/form_for'
- assert_have_selector :form, :action => '/demo', :id => 'demo'
- assert_have_selector :form, :action => '/another_demo', :id => 'demo2', :method => 'get'
- assert_have_selector :form, :action => '/third_demo', :id => 'demo3', :method => 'get'
- end
-
- should "have a class of 'invalid' for fields with errors" do
- actual_html = form_for(@user, '/register') {|f| f.text_field(:email) }
- assert_has_tag(:input, :type => 'text', :name => 'user[email]', :id => 'user_email', :class => 'invalid') {actual_html }
- end
-
- should "not have a class of 'invalid' for fields with no errors" do
- actual_html = form_for(@user, '/register') {|f| f.text_field(:first_name) }
- assert_has_no_tag(:input, :type => 'text', :name => 'user[first_name]', :id => 'user_first_name', :class => 'invalid') {actual_html }
- end
- end
-
- context 'for #fields_for method' do
- should 'display correct fields html' do
- actual_html = fields_for(@user) { |f| f.text_field(:first_name) }
- assert_has_tag(:input, :type => 'text', :name => 'user[first_name]', :id => 'user_first_name') { actual_html }
- end
-
- should 'display correct fields html with symbol object' do
- actual_html = fields_for(:markup_user) { |f| f.text_field(:first_name) }
- assert_has_tag(:input, :type => 'text', :name => 'markup_user[first_name]', :id => 'markup_user_first_name') { actual_html }
- end
-
- should "display fail for nil object" do
- assert_raises(RuntimeError) { fields_for(@not_real) { |f| "Demo" } }
- end
-
- should 'display correct simple fields in haml' do
- visit '/haml/fields_for'
- assert_have_selector :form, :action => '/demo1', :id => 'demo-fields-for'
- assert_have_selector '#demo-fields-for input', :type => 'text', :name => 'markup_user[gender]', :value => 'male'
- assert_have_selector '#demo-fields-for input', :type => 'checkbox', :name => 'permission[can_edit]', :value => '1', :checked => 'checked'
- assert_have_selector '#demo-fields-for input', :type => 'checkbox', :name => 'permission[can_delete]'
- end
-
- should "display correct simple fields in erb" do
- visit '/erb/fields_for'
- assert_have_selector :form, :action => '/demo1', :id => 'demo-fields-for'
- assert_have_selector '#demo-fields-for input', :type => 'text', :name => 'markup_user[gender]', :value => 'male'
- assert_have_selector '#demo-fields-for input', :type => 'checkbox', :name => 'permission[can_edit]', :value => '1', :checked => 'checked'
- assert_have_selector '#demo-fields-for input', :type => 'checkbox', :name => 'permission[can_delete]'
- end
-
- should "display correct simple fields in slim" do
- visit '/slim/fields_for'
- assert_have_selector :form, :action => '/demo1', :id => 'demo-fields-for'
- assert_have_selector '#demo-fields-for input', :type => 'text', :name => 'markup_user[gender]', :value => 'male'
- assert_have_selector '#demo-fields-for input', :type => 'checkbox', :name => 'permission[can_edit]', :value => '1', :checked => 'checked'
- assert_have_selector '#demo-fields-for input', :type => 'checkbox', :name => 'permission[can_delete]'
- end
- end
-
- # ===========================
- # AbstractFormBuilder
- # ===========================
-
- context 'for #error_messages method' do
- should "display correct form html with no record" do
- actual_html = standard_builder(@user_none).error_messages(:header_message => "Demo form cannot be saved")
- assert actual_html.blank?
- end
-
- should "display correct form html with valid record" do
- actual_html = standard_builder.error_messages(:header_message => "Demo form cannot be saved", :style => "foo:bar", :class => "mine")
- assert_has_tag('#field-errors h2', :content => "Demo form cannot be saved") { actual_html }
- assert_has_tag('#field-errors ul li', :content => "B must be valid") { actual_html }
- assert_has_tag('#field-errors ul li', :content => "A must be present") { actual_html }
- assert_has_tag('#field-errors', :style => "foo:bar") { actual_html }
- assert_has_tag('#field-errors', :class => "mine") { actual_html }
- end
-
- should "display correct form in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo div.field-errors h2', :content => "custom MarkupUser cannot be saved!"
- assert_have_selector '#demo div.field-errors ul li', :content => "Fake must be valid"
- assert_have_selector '#demo div.field-errors ul li', :content => "Second must be present"
- assert_have_selector '#demo div.field-errors ul li', :content => "Third must be a number"
- assert_have_selector '#demo2 div.field-errors h2', :content => "custom MarkupUser cannot be saved!"
- assert_have_selector '#demo2 div.field-errors ul li', :content => "Fake must be valid"
- assert_have_selector '#demo2 div.field-errors ul li', :content => "Second must be present"
- assert_have_selector '#demo2 div.field-errors ul li', :content => "Third must be a number"
- assert_have_selector '#demo input', :name => 'markup_user[email]', :class => 'string invalid'
- end
-
- should "display correct form in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo div.field-errors h2', :content => "custom MarkupUser cannot be saved!"
- assert_have_selector '#demo div.field-errors ul li', :content => "Fake must be valid"
- assert_have_selector '#demo div.field-errors ul li', :content => "Second must be present"
- assert_have_selector '#demo div.field-errors ul li', :content => "Third must be a number"
- assert_have_selector '#demo2 div.field-errors h2', :content => "custom MarkupUser cannot be saved!"
- assert_have_selector '#demo2 div.field-errors ul li', :content => "Fake must be valid"
- assert_have_selector '#demo2 div.field-errors ul li', :content => "Second must be present"
- assert_have_selector '#demo2 div.field-errors ul li', :content => "Third must be a number"
- assert_have_selector '#demo input', :name => 'markup_user[email]', :class => 'string invalid'
- end
-
- should "display correct form in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo div.field-errors h2', :content => "custom MarkupUser cannot be saved!"
- assert_have_selector '#demo div.field-errors ul li', :content => "Fake must be valid"
- assert_have_selector '#demo div.field-errors ul li', :content => "Second must be present"
- assert_have_selector '#demo div.field-errors ul li', :content => "Third must be a number"
- assert_have_selector '#demo2 div.field-errors h2', :content => "custom MarkupUser cannot be saved!"
- assert_have_selector '#demo2 div.field-errors ul li', :content => "Fake must be valid"
- assert_have_selector '#demo2 div.field-errors ul li', :content => "Second must be present"
- assert_have_selector '#demo2 div.field-errors ul li', :content => "Third must be a number"
- assert_have_selector '#demo input', :name => 'markup_user[email]', :class => 'string invalid'
- end
- end
-
- context 'for #error_message_on method' do
- should "display correct form html with no record" do
- actual_html = standard_builder(@user_none).error_message_on(:name)
- assert actual_html.blank?
- end
-
- should "display error for specified invalid object" do
- actual_html = standard_builder(@user).error_message_on(:a, :prepend => "foo", :append => "bar")
- assert_has_tag('span.error', :content => "foo must be present bar") { actual_html }
- end
-
- should "display error for specified invalid object not matching class name" do
- @bob = mock_model("User", :first_name => "Frank", :errors => { :foo => "must be bob" })
- actual_html = standard_builder(@bob).error_message_on(:foo, :prepend => "foo", :append => "bar")
- assert_has_tag('span.error', :content => "foo must be bob bar") { actual_html }
- end
- end
-
- context 'for #label method' do
- should "display correct label html" do
- actual_html = standard_builder.label(:first_name, :class => 'large', :caption => "F. Name: ")
- assert_has_tag('label', :class => 'large', :for => 'user_first_name', :content => "F. Name: ") { actual_html }
- end
-
- should "display correct label in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo label', :content => "Login: ", :class => 'user-label'
- assert_have_selector '#demo label', :content => "About Me: "
- assert_have_selector '#demo2 label', :content => "Nickname: ", :class => 'label'
- end
-
- should "display correct label in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo label', :content => "Login: ", :class => 'user-label'
- assert_have_selector '#demo label', :content => "About Me: "
- assert_have_selector '#demo2 label', :content => "Nickname: ", :class => 'label'
- end
-
- should "display correct label in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo label', :content => "Login: ", :class => 'user-label'
- assert_have_selector '#demo label', :content => "About Me: "
- assert_have_selector '#demo2 label', :content => "Nickname: ", :class => 'label'
- end
- end
-
- context 'for #hidden_field method' do
- should "display correct hidden field html" do
- actual_html = standard_builder.hidden_field(:session_id, :class => 'hidden')
- assert_has_tag('input.hidden[type=hidden]', :value => "54", :id => 'user_session_id', :name => 'user[session_id]') { actual_html }
- end
-
- should "display correct hidden field in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo input[type=hidden]', :id => 'markup_user_session_id', :value => "45"
- assert_have_selector '#demo2 input', :type => 'hidden', :name => 'markup_user[session_id]'
- end
-
- should "display correct hidden field in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo input[type=hidden]', :id => 'markup_user_session_id', :value => "45"
- assert_have_selector '#demo2 input', :type => 'hidden', :name => 'markup_user[session_id]'
- end
-
- should "display correct hidden field in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo input[type=hidden]', :id => 'markup_user_session_id', :value => "45"
- assert_have_selector '#demo2 input', :type => 'hidden', :name => 'markup_user[session_id]'
- end
- end
-
- context 'for #text_field method' do
- should "display correct text field html" do
- actual_html = standard_builder.text_field(:first_name, :class => 'large')
- assert_has_tag('input.large[type=text]', :value => "Joe", :id => 'user_first_name', :name => 'user[first_name]') { actual_html }
- end
-
- should "display correct text field in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo input.user-text[type=text]', :id => 'markup_user_username', :value => "John"
- assert_have_selector '#demo2 input', :type => 'text', :class => 'input', :name => 'markup_user[username]'
- end
-
- should "display correct text field in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo input.user-text[type=text]', :id => 'markup_user_username', :value => "John"
- assert_have_selector '#demo2 input', :type => 'text', :class => 'input', :name => 'markup_user[username]'
- end
-
- should "display correct text field in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo input.user-text[type=text]', :id => 'markup_user_username', :value => "John"
- assert_have_selector '#demo2 input', :type => 'text', :class => 'input', :name => 'markup_user[username]'
- end
- end
-
- context 'for #number_field method' do
- should "display correct number field html" do
- actual_html = standard_builder.number_field(:age, :class => 'numeric')
- assert_has_tag('input.numeric[type=number]', :id => 'user_age', :name => 'user[age]') { actual_html }
- end
-
- should "display correct number field in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo input.numeric[type=number]', :id => 'markup_user_age'
- end
-
- should "display correct number field in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo input.numeric[type=number]', :id => 'markup_user_age'
- end
-
- should "display correct number field in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo input.numeric[type=number]', :id => 'markup_user_age'
- end
- end
-
- context 'for #telephone_field method' do
- should "display correct telephone field html" do
- actual_html = standard_builder.telephone_field(:telephone, :class => 'numeric')
- assert_has_tag('input.numeric[type=tel]', :id => 'user_telephone', :name => 'user[telephone]') { actual_html }
- end
-
- should "display correct telephone field in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo input.numeric[type=tel]', :id => 'markup_user_telephone'
- end
-
- should "display correct telephone field in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo input.numeric[type=tel]', :id => 'markup_user_telephone'
- end
-
- should "display correct telephone field in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo input.numeric[type=tel]', :id => 'markup_user_telephone'
- end
- end
-
- context 'for #search_field method' do
- should "display correct search field html" do
- actual_html = standard_builder.search_field(:search, :class => 'string')
- assert_has_tag('input.string[type=search]', :id => 'user_search', :name => 'user[search]') { actual_html }
- end
-
- should "display correct search field in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo input.string[type=search]', :id => 'markup_user_search'
- end
-
- should "display correct search field in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo input.string[type=search]', :id => 'markup_user_search'
- end
-
- should "display correct search field in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo input.string[type=search]', :id => 'markup_user_search'
- end
- end
-
- context 'for #email_field method' do
- should "display correct email field html" do
- actual_html = standard_builder.email_field(:email, :class => 'string')
- assert_has_tag('input.string[type=email]', :id => 'user_email', :name => 'user[email]') { actual_html }
- end
-
- should "display correct email field in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo input.string[type=email]', :id => 'markup_user_email'
- end
-
- should "display correct email field in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo input.string[type=email]', :id => 'markup_user_email'
- end
-
- should "display correct email field in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo input.string[type=email]', :id => 'markup_user_email'
- end
- end
-
- context 'for #url_field method' do
- should "display correct url field html" do
- actual_html = standard_builder.url_field(:webpage, :class => 'string')
- assert_has_tag('input.string[type=url]', :id => 'user_webpage', :name => 'user[webpage]') { actual_html }
- end
-
- should "display correct url field in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo input.string[type=url]', :id => 'markup_user_webpage'
- end
-
- should "display correct url field in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo input.string[type=url]', :id => 'markup_user_webpage'
- end
-
- should "display correct url field in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo input.string[type=url]', :id => 'markup_user_webpage'
- end
- end
-
- context 'for #check_box method' do
- should "display correct checkbox html" do
- actual_html = standard_builder.check_box(:confirm_destroy, :class => 'large')
- assert_has_tag('input.large[type=checkbox]', :id => 'user_confirm_destroy', :name => 'user[confirm_destroy]') { actual_html }
- assert_has_tag('input[type=hidden]', :name => 'user[confirm_destroy]', :value => '0') { actual_html }
- end
-
- should "display correct checkbox html when checked" do
- actual_html = standard_builder.check_box(:confirm_destroy, :checked => true)
- assert_has_tag('input[type=checkbox]', :checked => 'checked', :name => 'user[confirm_destroy]') { actual_html }
- end
-
- should "display correct checkbox html as checked when object value matches" do
- @user.stubs(:show_favorites => 'human')
- actual_html = standard_builder.check_box(:show_favorites, :value => 'human')
- assert_has_tag('input[type=checkbox]', :checked => 'checked', :name => 'user[show_favorites]') { actual_html }
- end
-
- should "display correct checkbox html as checked when object value is true" do
- @user.stubs(:show_favorites => true)
- actual_html = standard_builder.check_box(:show_favorites, :value => '1')
- assert_has_tag('input[type=checkbox]', :checked => 'checked', :name => 'user[show_favorites]') { actual_html }
- end
-
- should "display correct checkbox html as unchecked when object value doesn't match" do
- @user.stubs(:show_favorites => 'alien')
- actual_html = standard_builder.check_box(:show_favorites, :value => 'human')
- assert_has_no_tag('input[type=checkbox]', :checked => 'checked') { actual_html }
- end
-
- should "display correct checkbox html as unchecked when object value is false" do
- @user.stubs(:show_favorites => false)
- actual_html = standard_builder.check_box(:show_favorites, :value => '1')
- assert_has_no_tag('input[type=checkbox]', :checked => 'checked') { actual_html }
- end
-
- should "display correct unchecked hidden field when specified" do
- actual_html = standard_builder.check_box(:show_favorites, :value => 'female', :uncheck_value => 'false')
- assert_has_tag('input[type=hidden]', :name => 'user[show_favorites]', :value => 'false') { actual_html }
- end
-
- should "display correct checkbox in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo input[type=checkbox]', :checked => 'checked', :id => 'markup_user_remember_me', :name => 'markup_user[remember_me]'
- end
-
- should "display correct checkbox in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo input[type=checkbox]', :checked => 'checked', :id => 'markup_user_remember_me', :name => 'markup_user[remember_me]'
- end
-
- should "display correct checkbox in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo input[type=checkbox]', :checked => 'checked', :id => 'markup_user_remember_me', :name => 'markup_user[remember_me]'
- end
- end
-
- context 'for #radio_button method' do
- should "display correct radio button html" do
- actual_html = standard_builder.radio_button(:gender, :value => 'male', :class => 'large')
- assert_has_tag('input.large[type=radio]', :id => 'user_gender_male', :name => 'user[gender]', :value => 'male') { actual_html }
- end
-
- should "display correct radio button html when checked" do
- actual_html = standard_builder.radio_button(:gender, :checked => true)
- assert_has_tag('input[type=radio]', :checked => 'checked', :name => 'user[gender]') { actual_html }
- end
-
- should "display correct radio button html as checked when object value matches" do
- @user.stubs(:gender => 'male')
- actual_html = standard_builder.radio_button(:gender, :value => 'male')
- assert_has_tag('input[type=radio]', :checked => 'checked', :name => 'user[gender]') { actual_html }
- end
-
- should "display correct radio button html as unchecked when object value doesn't match" do
- @user.stubs(:gender => 'male')
- actual_html = standard_builder.radio_button(:gender, :value => 'female')
- assert_has_no_tag('input[type=radio]', :checked => 'checked') { actual_html }
- end
-
- should "display correct radio button in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo input[type=radio]', :id => 'markup_user_gender_male', :name => 'markup_user[gender]', :value => 'male'
- assert_have_selector '#demo input[type=radio]', :id => 'markup_user_gender_female', :name => 'markup_user[gender]', :value => 'female'
- assert_have_selector '#demo input[type=radio][checked=checked]', :id => 'markup_user_gender_male'
- end
-
- should "display correct radio button in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo input[type=radio]', :id => 'markup_user_gender_male', :name => 'markup_user[gender]', :value => 'male'
- assert_have_selector '#demo input[type=radio]', :id => 'markup_user_gender_female', :name => 'markup_user[gender]', :value => 'female'
- assert_have_selector '#demo input[type=radio][checked=checked]', :id => 'markup_user_gender_male'
- end
-
- should "display correct radio button in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo input[type=radio]', :id => 'markup_user_gender_male', :name => 'markup_user[gender]', :value => 'male'
- assert_have_selector '#demo input[type=radio]', :id => 'markup_user_gender_female', :name => 'markup_user[gender]', :value => 'female'
- assert_have_selector '#demo input[type=radio][checked=checked]', :id => 'markup_user_gender_male'
- end
- end
-
- context 'for #text_area method' do
- should "display correct text_area html" do
- actual_html = standard_builder.text_area(:about, :class => 'large')
- assert_has_tag('textarea.large', :id => 'user_about', :name => 'user[about]') { actual_html }
- end
-
- should "display correct text_area html and content" do
- actual_html = standard_builder.text_area(:about, :value => "Demo", :rows => '5', :cols => '6')
- assert_has_tag('textarea', :id => 'user_about', :content => 'Demo', :rows => '5', :cols => '6') { actual_html }
- end
-
- should "display correct text_area in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo textarea', :name => 'markup_user[about]', :id => 'markup_user_about', :class => 'user-about'
- assert_have_selector '#demo2 textarea', :name => 'markup_user[about]', :id => 'markup_user_about', :class => 'textarea'
- end
-
- should "display correct text_area in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo textarea', :name => 'markup_user[about]', :id => 'markup_user_about', :class => 'user-about'
- assert_have_selector '#demo2 textarea', :name => 'markup_user[about]', :id => 'markup_user_about', :class => 'textarea'
- end
-
- should "display correct text_area in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo textarea', :name => 'markup_user[about]', :id => 'markup_user_about', :class => 'user-about'
- assert_have_selector '#demo2 textarea', :name => 'markup_user[about]', :id => 'markup_user_about', :class => 'textarea'
- end
- end
-
- context 'for #password_field method' do
- should "display correct password_field html" do
- actual_html = standard_builder.password_field(:code, :class => 'large')
- assert_has_tag('input.large[type=password]', :id => 'user_code', :name => 'user[code]') { actual_html }
- end
-
- should "display correct password_field in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo input', :type => 'password', :class => 'user-password', :value => 'secret'
- assert_have_selector '#demo2 input', :type => 'password', :class => 'input', :name => 'markup_user[code]'
- end
-
- should "display correct password_field in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo input', :type => 'password', :class => 'user-password', :value => 'secret'
- assert_have_selector '#demo2 input', :type => 'password', :class => 'input', :name => 'markup_user[code]'
- end
-
- should "display correct password_field in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo input', :type => 'password', :class => 'user-password', :value => 'secret'
- assert_have_selector '#demo2 input', :type => 'password', :class => 'input', :name => 'markup_user[code]'
- end
- end
-
- context 'for #file_field method' do
- should "display correct file_field html" do
- actual_html = standard_builder.file_field(:photo, :class => 'large')
- assert_has_tag('input.large[type=file]', :id => 'user_photo', :name => 'user[photo]') { actual_html }
- end
-
- should "display correct file_field in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo input.user-photo', :type => 'file', :name => 'markup_user[photo]', :id => 'markup_user_photo'
- assert_have_selector '#demo2 input.upload', :type => 'file', :name => 'markup_user[photo]', :id => 'markup_user_photo'
- end
-
- should "display correct file_field in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo input.user-photo', :type => 'file', :name => 'markup_user[photo]', :id => 'markup_user_photo'
- assert_have_selector '#demo2 input.upload', :type => 'file', :name => 'markup_user[photo]', :id => 'markup_user_photo'
- end
-
- should "display correct file_field in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo input.user-photo', :type => 'file', :name => 'markup_user[photo]', :id => 'markup_user_photo'
- assert_have_selector '#demo2 input.upload', :type => 'file', :name => 'markup_user[photo]', :id => 'markup_user_photo'
- end
- end
-
- context 'for #select method' do
- should "display correct select html" do
- actual_html = standard_builder.select(:state, :options => ['California', 'Texas', 'Wyoming'], :class => 'selecty')
- assert_has_tag('select.selecty', :id => 'user_state', :name => 'user[state]') { actual_html }
- assert_has_tag('select.selecty option', :count => 3) { actual_html }
- assert_has_tag('select.selecty option', :value => 'California', :content => 'California') { actual_html }
- assert_has_tag('select.selecty option', :value => 'Texas', :content => 'Texas') { actual_html }
- assert_has_tag('select.selecty option', :value => 'Wyoming', :content => 'Wyoming') { actual_html }
- end
-
- should "display correct select html with selected item if it matches value" do
- @user.stubs(:state => 'California')
- actual_html = standard_builder.select(:state, :options => ['California', 'Texas', 'Wyoming'])
- assert_has_tag('select', :id => 'user_state', :name => 'user[state]') { actual_html }
- assert_has_tag('select option', :selected => 'selected', :count => 1) { actual_html }
- assert_has_tag('select option', :value => 'California', :selected => 'selected') { actual_html }
- end
-
- should "display correct select html with selected item if it matches full value" do
- @user.stubs(:state => 'Cali')
- actual_html = standard_builder.select(:state, :options => ['Cali', 'California', 'Texas', 'Wyoming'])
- assert_has_tag('select', :id => 'user_state', :name => 'user[state]') { actual_html }
- assert_has_tag('select option', :selected => 'selected', :count => 1) { actual_html }
- assert_has_tag('select option', :value => 'Cali', :selected => 'selected') { actual_html }
- assert_has_tag('select option', :value => 'California') { actual_html }
- end
-
- should "display correct select html with multiple selected items" do
- @user.stubs(:pickles => ['foo', 'bar'])
- actual_html = standard_builder.select(
- :pickles, :options => [ ['Foo', 'foo'], ['Bar', 'bar'], ['Baz', 'baz'], ['Bar Buz', 'bar buz'] ]
- )
- assert_has_tag('option', :value => 'foo', :content => 'Foo', :selected => 'selected') { actual_html }
- assert_has_tag('option', :value => 'bar', :content => 'Bar', :selected => 'selected') { actual_html }
- assert_has_tag('option', :value => 'baz', :content => 'Baz') { actual_html }
- assert_has_tag('option', :value => 'bar buz', :content => 'Bar Buz') { actual_html }
- end
-
- should "display correct select html with include_blank" do
- actual_html = standard_builder.select(:state, :options => ['California', 'Texas', 'Wyoming'], :include_blank => true)
- assert_has_tag('select', :id => 'user_state', :name => 'user[state]') { actual_html }
- assert_has_tag('select option', :count => 4) { actual_html }
- assert_has_tag('select option:first-child', :content => '') { actual_html }
- assert_has_tag('select option:first-child', :value => '') { actual_html }
- actual_html = standard_builder.select(:state, :options => ['California', 'Texas', 'Wyoming'], :include_blank => 'Select')
- assert_has_tag('select', :id => 'user_state', :name => 'user[state]') { actual_html }
- assert_has_tag('select option', :count => 4) { actual_html }
- assert_has_tag('select option:first-child', :content => 'Select') { actual_html }
- assert_has_tag('select option:first-child', :value => '') { actual_html }
- end
-
- should "display correct select html with collection passed in" do
- actual_html = standard_builder.select(:role, :collection => @user.role_types, :fields => [:name, :id])
- assert_has_tag('select', :id => 'user_role', :name => 'user[role]') { actual_html }
- assert_has_tag('select option', :count => 3) { actual_html }
- assert_has_tag('select option', :value => '1', :content => 'Admin', :selected => 'selected') { actual_html }
- assert_has_tag('select option', :value => '2', :content => 'Moderate') { actual_html }
- assert_has_tag('select option', :value => '3', :content => 'Limited') { actual_html }
- end
-
- should "display correct select in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo textarea', :name => 'markup_user[about]', :id => 'markup_user_about', :class => 'user-about'
- assert_have_selector '#demo2 textarea', :name => 'markup_user[about]', :id => 'markup_user_about', :class => 'textarea'
- end
-
- should "display correct select in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo textarea', :name => 'markup_user[about]', :id => 'markup_user_about', :class => 'user-about'
- assert_have_selector '#demo2 textarea', :name => 'markup_user[about]', :id => 'markup_user_about', :class => 'textarea'
- end
-
- should "display correct select in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo textarea', :name => 'markup_user[about]', :id => 'markup_user_about', :class => 'user-about'
- assert_have_selector '#demo2 textarea', :name => 'markup_user[about]', :id => 'markup_user_about', :class => 'textarea'
- end
- end
-
- context 'for #submit method' do
- should "display correct submit button html with no options" do
- actual_html = standard_builder.submit
- assert_has_tag('input[type=submit]', :value => "Submit") { actual_html }
- end
-
- should "display correct submit button html" do
- actual_html = standard_builder.submit("Commit", :class => 'large')
- assert_has_tag('input.large[type=submit]', :value => "Commit") { actual_html }
- end
-
- should "display correct submit button in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo input', :type => 'submit', :id => 'demo-button', :class => 'success'
- assert_have_selector '#demo2 input', :type => 'submit', :class => 'button', :value => "Create"
- end
-
- should "display correct submit button in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo input', :type => 'submit', :id => 'demo-button', :class => 'success'
- assert_have_selector '#demo2 input', :type => 'submit', :class => 'button', :value => "Create"
- end
-
- should "display correct submit button in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo input', :type => 'submit', :id => 'demo-button', :class => 'success'
- assert_have_selector '#demo2 input', :type => 'submit', :class => 'button', :value => "Create"
- end
- end
-
- context 'for #image_submit method' do
- setup do
- @stamp = stop_time_for_test.to_i
- end
-
- should "display correct image submit button html with no options" do
- actual_html = standard_builder.image_submit('buttons/ok.png')
- assert_has_tag('input[type=image]', :src => "/images/buttons/ok.png?#{@stamp}") { actual_html }
- end
-
- should "display correct image submit button html" do
- actual_html = standard_builder.image_submit('/system/ok.png', :class => 'large')
- assert_has_tag('input.large[type=image]', :src => "/system/ok.png") { actual_html }
- end
-
- should "display correct image submit button in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo input', :type => 'image', :id => 'image-button', :src => "/images/buttons/post.png?#{@stamp}"
- assert_have_selector '#demo2 input', :type => 'image', :class => 'image', :src => "/images/buttons/ok.png?#{@stamp}"
- end
-
- should "display correct image submit button in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo input', :type => 'image', :id => 'image-button', :src => "/images/buttons/post.png?#{@stamp}"
- assert_have_selector '#demo2 input', :type => 'image', :class => 'image', :src => "/images/buttons/ok.png?#{@stamp}"
- end
-
- should "display correct image submit button in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo input', :type => 'image', :id => 'image-button', :src => "/images/buttons/post.png?#{@stamp}"
- assert_have_selector '#demo2 input', :type => 'image', :class => 'image', :src => "/images/buttons/ok.png?#{@stamp}"
- end
- end
-
- context 'for #fields_for method' do
- setup do
- @telephone = mock_model("Telephone", :number => "4568769876")
- @user.stubs(:telephone).returns(@telephone)
- @businesses = [ mock_model("Business", :name => "Silver", :new_record? => false, :id => 20) ]
- @businesses << mock_model("Business", :name => "Gold", :new_record? => true)
- @addresses = [ mock_model("Address", :name => "Foo", :new_record? => false, :id => 20, :businesses => @businesses) ]
- @addresses << mock_model("Address", :name => "Bar", :new_record? => true, :businesses => @businesses)
- @user.stubs(:addresses).returns(@addresses)
- end
-
- should "display nested children fields one-to-one within form" do
- actual_html = standard_builder.fields_for :telephone do |child_form|
- child_form.label(:number) +
- child_form.text_field(:number) +
- child_form.check_box('_destroy')
- end
- assert_has_tag('label', :for => 'user_telephone_attributes_number') { actual_html }
- assert_has_tag('input', :type => 'text', :id => 'user_telephone_attributes_number', :name => 'user[telephone_attributes][number]', :value => "4568769876") { actual_html }
- assert_has_tag('input', :type => 'hidden', :name => 'user[telephone_attributes][_destroy]', :value => '0') { actual_html }
- assert_has_tag('input', :type => 'checkbox', :id => 'user_telephone_attributes__destroy', :name => 'user[telephone_attributes][_destroy]', :value => '1') { actual_html }
- end
-
- should "display nested children fields one-to-many within form" do
- actual_html = standard_builder.fields_for(:addresses) do |child_form|
- html = child_form.label(:name)
- html << child_form.check_box('_destroy') unless child_form.object.new_record?
- html << child_form.text_field(:name)
- end
- # Address 1 (Saved)
- assert_has_tag('input', :type => 'hidden', :id => 'user_addresses_attributes_0_id', :name => "user[addresses_attributes][0][id]", :value => '20') { actual_html }
- assert_has_tag('label', :for => 'user_addresses_attributes_0_name', :content => 'Name') { actual_html }
- assert_has_tag('input', :type => 'text', :id => 'user_addresses_attributes_0_name', :name => 'user[addresses_attributes][0][name]') { actual_html }
- assert_has_tag('input', :type => 'checkbox', :id => 'user_addresses_attributes_0__destroy', :name => 'user[addresses_attributes][0][_destroy]') { actual_html }
- # Address 2 (New)
- assert_has_no_tag('input', :type => 'hidden', :id => 'user_addresses_attributes_1_id') { actual_html }
- assert_has_tag('label', :for => 'user_addresses_attributes_1_name', :content => 'Name') { actual_html }
- assert_has_tag('input', :type => 'text', :id => 'user_addresses_attributes_1_name', :name => 'user[addresses_attributes][1][name]') { actual_html }
- assert_has_no_tag('input', :type => 'checkbox', :id => 'user_addresses_attributes_1__destroy') { actual_html }
- end
-
- should "display fields for explicit instance object" do
- address = mock_model("Address", :name => "Page", :new_record? => false, :id => 40)
- actual_html = standard_builder.fields_for(:addresses, address) do |child_form|
- html = child_form.label(:name)
- html << child_form.text_field(:name)
- html << child_form.check_box('_destroy')
- end
- assert_has_tag('input', :type => 'hidden', :id => 'user_addresses_attributes_0_id', :name => "user[addresses_attributes][0][id]", :value => '40') { actual_html }
- assert_has_tag('label', :for => 'user_addresses_attributes_0_name', :content => 'Name') { actual_html }
- assert_has_tag('input', :type => 'text', :id => 'user_addresses_attributes_0_name', :name => 'user[addresses_attributes][0][name]', :value => "Page") { actual_html }
- assert_has_tag('input', :type => 'checkbox', :id => 'user_addresses_attributes_0__destroy', :name => 'user[addresses_attributes][0][_destroy]', :value => '1') { actual_html }
- end
-
- should "display fields for collection object" do
- addresses = @addresses + [mock_model("Address", :name => "Walter", :new_record? => false, :id => 50)]
- actual_html = standard_builder.fields_for(:addresses, addresses) do |child_form|
- child_form.label(:name) +
- child_form.text_field(:name) +
- child_form.check_box('_destroy')
- end
- # Address 1
- assert_has_tag('input', :type => 'hidden', :id => 'user_addresses_attributes_0_id', :name => "user[addresses_attributes][0][id]", :value => '20') { actual_html }
- assert_has_tag('label', :for => 'user_addresses_attributes_0_name', :content => 'Name') { actual_html }
- assert_has_tag('input', :type => 'text', :id => 'user_addresses_attributes_0_name', :name => 'user[addresses_attributes][0][name]', :value => "Foo") { actual_html }
- assert_has_tag('input', :type => 'checkbox', :id => 'user_addresses_attributes_0__destroy', :name => 'user[addresses_attributes][0][_destroy]') { actual_html }
- # Address 3
- assert_has_tag('input', :type => 'hidden', :id => 'user_addresses_attributes_2_id', :value => '50') { actual_html }
- assert_has_tag('label', :for => 'user_addresses_attributes_2_name', :content => 'Name') { actual_html }
- assert_has_tag('input', :type => 'text', :id => 'user_addresses_attributes_2_name', :name => 'user[addresses_attributes][2][name]', :value => "Walter") { actual_html }
- assert_has_tag('input', :type => 'checkbox', :id => 'user_addresses_attributes_2__destroy') { actual_html }
- end
-
- should "display fields for arbitrarily deep nested forms" do
- actual_html = standard_builder.fields_for :addresses do |child_form|
- child_form.fields_for(:businesses) do |second_child_form|
- second_child_form.label(:name) +
- second_child_form.text_field(:name) +
- second_child_form.check_box('_destroy')
- end
- end
- assert_has_tag('label', :for => 'user_addresses_attributes_1_businesses_attributes_0_name', :content => 'Name') { actual_html }
- assert_has_tag('input', :type => 'text', :id => 'user_addresses_attributes_1_businesses_attributes_0_name', :name => 'user[addresses_attributes][1][businesses_attributes][0][name]') { actual_html }
- end
-
- should "display nested children fields in erb" do
- visit '/erb/fields_for'
- # Telephone
- assert_have_selector('label', :for => 'markup_user_telephone_attributes_number')
- assert_have_selector('input', :type => 'text', :id => 'markup_user_telephone_attributes_number', :name => 'markup_user[telephone_attributes][number]', :value => "62634576545")
- # Address 1 (Saved)
- assert_have_selector('input', :type => 'hidden', :id => 'markup_user_addresses_attributes_0_id', :name => "markup_user[addresses_attributes][0][id]", :value => '25')
- assert_have_selector('label', :for => 'markup_user_addresses_attributes_0_name', :content => 'Name')
- assert_have_selector('input', :type => 'text', :id => 'markup_user_addresses_attributes_0_name', :name => 'markup_user[addresses_attributes][0][name]')
- assert_have_selector('input', :type => 'checkbox', :id => 'markup_user_addresses_attributes_0__destroy', :name => 'markup_user[addresses_attributes][0][_destroy]')
- # Address 2 (New)
- assert_have_no_selector('input', :type => 'hidden', :id => 'markup_user_addresses_attributes_1_id')
- assert_have_selector('label', :for => 'markup_user_addresses_attributes_1_name', :content => 'Name')
- assert_have_selector('input', :type => 'text', :id => 'markup_user_addresses_attributes_1_name', :name => 'markup_user[addresses_attributes][1][name]')
- assert_have_no_selector('input', :type => 'checkbox', :id => 'markup_user_addresses_attributes_1__destroy')
- end
-
- should "display nested children fields in haml" do
- visit '/haml/fields_for'
- # Telephone
- assert_have_selector('label', :for => 'markup_user_telephone_attributes_number')
- assert_have_selector('input', :type => 'text', :id => 'markup_user_telephone_attributes_number', :name => 'markup_user[telephone_attributes][number]', :value => "62634576545")
- # Address 1 (Saved)
- assert_have_selector('input', :type => 'hidden', :id => 'markup_user_addresses_attributes_0_id', :name => "markup_user[addresses_attributes][0][id]", :value => '25')
- assert_have_selector('label', :for => 'markup_user_addresses_attributes_0_name', :content => 'Name')
- assert_have_selector('input', :type => 'text', :id => 'markup_user_addresses_attributes_0_name', :name => 'markup_user[addresses_attributes][0][name]')
- assert_have_selector('input', :type => 'checkbox', :id => 'markup_user_addresses_attributes_0__destroy', :name => 'markup_user[addresses_attributes][0][_destroy]')
- # Address 2 (New)
- assert_have_no_selector('input', :type => 'hidden', :id => 'markup_user_addresses_attributes_1_id')
- assert_have_selector('label', :for => 'markup_user_addresses_attributes_1_name', :content => 'Name')
- assert_have_selector('input', :type => 'text', :id => 'markup_user_addresses_attributes_1_name', :name => 'markup_user[addresses_attributes][1][name]')
- assert_have_no_selector('input', :type => 'checkbox', :id => 'markup_user_addresses_attributes_1__destroy')
- end
-
- should "display nested children fields in slim" do
- visit '/slim/fields_for'
- # Telephone
- assert_have_selector('label', :for => 'markup_user_telephone_attributes_number')
- assert_have_selector('input', :type => 'text', :id => 'markup_user_telephone_attributes_number', :name => 'markup_user[telephone_attributes][number]', :value => "62634576545")
- # Address 1 (Saved)
- assert_have_selector('input', :type => 'hidden', :id => 'markup_user_addresses_attributes_0_id', :name => "markup_user[addresses_attributes][0][id]", :value => '25')
- assert_have_selector('label', :for => 'markup_user_addresses_attributes_0_name', :content => 'Name')
- assert_have_selector('input', :type => 'text', :id => 'markup_user_addresses_attributes_0_name', :name => 'markup_user[addresses_attributes][0][name]')
- assert_have_selector('input', :type => 'checkbox', :id => 'markup_user_addresses_attributes_0__destroy', :name => 'markup_user[addresses_attributes][0][_destroy]')
- # Address 2 (New)
- assert_have_no_selector('input', :type => 'hidden', :id => 'markup_user_addresses_attributes_1_id')
- assert_have_selector('label', :for => 'markup_user_addresses_attributes_1_name', :content => 'Name')
- assert_have_selector('input', :type => 'text', :id => 'markup_user_addresses_attributes_1_name', :name => 'markup_user[addresses_attributes][1][name]')
- assert_have_no_selector('input', :type => 'checkbox', :id => 'markup_user_addresses_attributes_1__destroy')
- end
- end
-
- # ===========================
- # StandardFormBuilder
- # ===========================
-
- context 'for #text_field_block method' do
- should "display correct text field block html" do
- actual_html = standard_builder.text_field_block(:first_name, :class => 'large', :caption => "FName")
- assert_has_tag('p label', :for => 'user_first_name', :content => "FName") { actual_html }
- assert_has_tag('p input.large[type=text]', :value => "Joe", :id => 'user_first_name', :name => 'user[first_name]') { actual_html }
- end
-
- should "display correct text field block in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_username', :content => "Nickname: ", :class => 'label'
- assert_have_selector '#demo2 p input', :type => 'text', :name => 'markup_user[username]', :id => 'markup_user_username'
- end
-
- should "display correct text field block in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_username', :content => "Nickname: ", :class => 'label'
- assert_have_selector '#demo2 p input', :type => 'text', :name => 'markup_user[username]', :id => 'markup_user_username'
- end
-
- should "display correct text field block in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_username', :content => "Nickname: ", :class => 'label'
- assert_have_selector '#demo2 p input', :type => 'text', :name => 'markup_user[username]', :id => 'markup_user_username'
- end
- end
-
- context 'for #text_area_block method' do
- should "display correct text area block html" do
- actual_html = standard_builder.text_area_block(:about, :class => 'large', :caption => "About Me")
- assert_has_tag('p label', :for => 'user_about', :content => "About Me") { actual_html }
- assert_has_tag('p textarea', :id => 'user_about', :name => 'user[about]') { actual_html }
- end
-
- should "display correct text area block in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_about', :content => "About: "
- assert_have_selector '#demo2 p textarea', :name => 'markup_user[about]', :id => 'markup_user_about'
- end
-
- should "display correct text area block in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_about', :content => "About: "
- assert_have_selector '#demo2 p textarea', :name => 'markup_user[about]', :id => 'markup_user_about'
- end
-
- should "display correct text area block in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_about', :content => "About: "
- assert_have_selector '#demo2 p textarea', :name => 'markup_user[about]', :id => 'markup_user_about'
- end
- end
-
- context 'for #password_field_block method' do
- should "display correct password field block html" do
- actual_html = standard_builder.password_field_block(:keycode, :class => 'large', :caption => "Code: ")
- assert_has_tag('p label', :for => 'user_keycode', :content => "Code: ") { actual_html }
- assert_has_tag('p input.large[type=password]', :id => 'user_keycode', :name => 'user[keycode]') { actual_html }
- end
-
- should "display correct password field block in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_code', :content => "Code: "
- assert_have_selector '#demo2 p input', :type => 'password', :name => 'markup_user[code]', :id => 'markup_user_code'
- end
-
- should "display correct password field block in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_code', :content => "Code: "
- assert_have_selector '#demo2 p input', :type => 'password', :name => 'markup_user[code]', :id => 'markup_user_code'
- end
-
- should "display correct password field block in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_code', :content => "Code: "
- assert_have_selector '#demo2 p input', :type => 'password', :name => 'markup_user[code]', :id => 'markup_user_code'
- end
- end
-
- context 'for #file_field_block method' do
- should "display correct file field block html" do
- actual_html = standard_builder.file_field_block(:photo, :class => 'large', :caption => "Photo: ")
- assert_has_tag('p label', :for => 'user_photo', :content => "Photo: ") { actual_html }
- assert_has_tag('p input.large[type=file]', :id => 'user_photo', :name => 'user[photo]') { actual_html }
- end
-
- should "display correct file field block in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_photo', :content => "Photo: "
- assert_have_selector '#demo2 p input.upload', :type => 'file', :name => 'markup_user[photo]', :id => 'markup_user_photo'
- end
-
- should "display correct file field block in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_photo', :content => "Photo: "
- assert_have_selector '#demo2 p input.upload', :type => 'file', :name => 'markup_user[photo]', :id => 'markup_user_photo'
- end
-
- should "display correct file field block in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_photo', :content => "Photo: "
- assert_have_selector '#demo2 p input.upload', :type => 'file', :name => 'markup_user[photo]', :id => 'markup_user_photo'
- end
- end
-
- context 'for #check_box_block method' do
- should "display correct check box block html" do
- actual_html = standard_builder.check_box_block(:remember_me, :class => 'large', :caption => "Remember session?")
- assert_has_tag('p label', :for => 'user_remember_me', :content => "Remember session?") { actual_html }
- assert_has_tag('p input.large[type=checkbox]', :id => 'user_remember_me', :name => 'user[remember_me]') { actual_html }
- end
-
- should "display correct check box block in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_remember_me', :content => "Remember me: "
- assert_have_selector '#demo2 p input.checker', :type => 'checkbox', :name => 'markup_user[remember_me]'
- end
-
- should "display correct check box block in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_remember_me', :content => "Remember me: "
- assert_have_selector '#demo2 p input.checker', :type => 'checkbox', :name => 'markup_user[remember_me]'
- end
-
- should "display correct check box block in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_remember_me', :content => "Remember me: "
- assert_have_selector '#demo2 p input.checker', :type => 'checkbox', :name => 'markup_user[remember_me]'
- end
- end
-
- context 'for #select_block method' do
- should "display correct select_block block html" do
- actual_html = standard_builder.select_block(:country, :options => ['USA', 'Canada'], :class => 'large', :caption => "Your country")
- assert_has_tag('p label', :for => 'user_country', :content => "Your country") { actual_html }
- assert_has_tag('p select', :id => 'user_country', :name => 'user[country]') { actual_html }
- assert_has_tag('p select option', :content => 'USA') { actual_html }
- assert_has_tag('p select option', :content => 'Canada') { actual_html }
- end
-
- should "display correct select_block block in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_state', :content => "State: "
- assert_have_selector '#demo2 p select', :name => 'markup_user[state]', :id => 'markup_user_state'
- assert_have_selector '#demo2 p select option', :content => 'California'
- assert_have_selector '#demo2 p select option', :content => 'Texas'
- end
-
- should "display correct select_block block in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_state', :content => "State: "
- assert_have_selector '#demo2 p select', :name => 'markup_user[state]', :id => 'markup_user_state'
- end
-
- should "display correct select_block block in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo2 p label', :for => 'markup_user_state', :content => "State: "
- assert_have_selector '#demo2 p select', :name => 'markup_user[state]', :id => 'markup_user_state'
- end
- end
-
- context 'for #submit_block method' do
- should "display correct submit block html" do
- actual_html = standard_builder.submit_block("Update", :class => 'large')
- assert_has_tag('p input.large[type=submit]', :value => 'Update') { actual_html }
- end
-
- should "display correct submit block in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo2 p input', :type => 'submit', :class => 'button'
- end
-
- should "display correct submit block in erb" do
- visit '/erb/form_for'
- assert_have_selector '#demo2 p input', :type => 'submit', :class => 'button'
- end
-
- should "display correct submit block in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo2 p input', :type => 'submit', :class => 'button'
- end
- end
-
- context 'for #image_submit_block method' do
- setup do
- @stamp = stop_time_for_test.to_i
- end
-
- should "display correct image submit block html" do
- actual_html = standard_builder.image_submit_block("buttons/ok.png", :class => 'large')
- assert_has_tag('p input.large[type=image]', :src => "/images/buttons/ok.png?#{@stamp}") { actual_html }
- end
-
- should "display correct image submit block in haml" do
- visit '/haml/form_for'
- assert_have_selector '#demo2 p input', :type => 'image', :class => 'image', :src => "/images/buttons/ok.png?#{@stamp}"
- end
-
- should "display correct image submit block in slim" do
- visit '/slim/form_for'
- assert_have_selector '#demo2 p input', :type => 'image', :class => 'image', :src => "/images/buttons/ok.png?#{@stamp}"
- end
- end
-end
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_helpers.rb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_helpers.rb
deleted file mode 100644
index 3f181aac..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_helpers.rb
+++ /dev/null
@@ -1,770 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/helper')
-require File.expand_path(File.dirname(__FILE__) + '/fixtures/markup_app/app')
-
-describe "FormHelpers" do
- include Padrino::Helpers::FormHelpers
-
- def app
- MarkupDemo.tap { |app| app.set :environment, :test }
- end
-
- context 'for #form_tag method' do
- should "display correct forms in ruby" do
- actual_html = form_tag('/register', :"accept-charset" => "UTF-8", :class => 'test', :method => "post") { "Demo" }
- assert_has_tag(:form, :"accept-charset" => "UTF-8", :class => "test") { actual_html }
- assert_has_tag('form input', :type => 'hidden', :name => '_method', :count => 0) { actual_html }
- end
-
- should "display correct text inputs within form_tag" do
- actual_html = form_tag('/register', :"accept-charset" => "UTF-8", :class => 'test') { text_field_tag(:username) }
- assert_has_tag('form input', :type => 'text', :name => "username") { actual_html }
- end
-
- should "display correct form with remote" do
- actual_html = form_tag('/update', :"accept-charset" => "UTF-8", :class => 'put-form', :remote => true) { "Demo" }
- assert_has_tag(:form, :class => "put-form", :"accept-charset" => "UTF-8", :"data-remote" => 'true') { actual_html }
- assert_has_no_tag(:form, "data-method" => 'post') { actual_html }
- end
-
- should "display correct form with remote and method is put" do
- actual_html = form_tag('/update', :"accept-charset" => "UTF-8", :method => 'put', :remote => true) { "Demo" }
- assert_has_tag(:form, "data-remote" => 'true', :"accept-charset" => "UTF-8") { actual_html }
- assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'put') { actual_html }
- end
-
- should "display correct form with method :put" do
- actual_html = form_tag('/update', :"accept-charset" => "UTF-8", :class => 'put-form', :method => "put") { "Demo" }
- assert_has_tag(:form, :class => "put-form", :"accept-charset" => "UTF-8", :method => 'post') { actual_html }
- assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'put') { actual_html }
- end
-
- should "display correct form with method :delete and charset" do
- actual_html = form_tag('/remove', :"accept-charset" => "UTF-8", :class => 'delete-form', :method => "delete") { "Demo" }
- assert_has_tag(:form, :class => "delete-form", :"accept-charset" => "UTF-8", :method => 'post') { actual_html }
- assert_has_tag('form input', :type => 'hidden', :name => "_method", :value => 'delete') { actual_html }
- end
-
- should "display correct form with charset" do
- actual_html = form_tag('/charset', :"accept-charset" => "UTF-8", :class => 'charset-form') { "Demo" }
- assert_has_tag(:form, :class => "charset-form", :"accept-charset" => "UTF-8", :method => 'post') { actual_html }
- end
-
- should "display correct form with multipart encoding" do
- actual_html = form_tag('/remove', :"accept-charset" => "UTF-8", :multipart => true) { "Demo" }
- assert_has_tag(:form, :enctype => "multipart/form-data") { actual_html }
- end
-
- should "display correct forms in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form', :action => '/simple'
- assert_have_selector 'form.advanced-form', :action => '/advanced', :id => 'advanced', :method => 'get'
- end
-
- should "display correct forms in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form', :action => '/simple'
- assert_have_selector 'form.advanced-form', :action => '/advanced', :id => 'advanced', :method => 'get'
- end
-
- should "display correct forms in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form', :action => '/simple'
- assert_have_selector 'form.advanced-form', :action => '/advanced', :id => 'advanced', :method => 'get'
- end
- end
-
- context 'for #field_set_tag method' do
- should "display correct field_sets in ruby" do
- actual_html = field_set_tag("Basic", :class => 'basic') { "Demo" }
- assert_has_tag(:fieldset, :class => 'basic') { actual_html }
- assert_has_tag('fieldset legend', :content => "Basic") { actual_html }
- end
-
- should "display correct field_sets in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form fieldset', :count => 1
- assert_have_no_selector 'form.simple-form fieldset legend'
- assert_have_selector 'form.advanced-form fieldset', :count => 1, :class => 'advanced-field-set'
- assert_have_selector 'form.advanced-form fieldset legend', :content => "Advanced"
- end
-
- should "display correct field_sets in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form fieldset', :count => 1
- assert_have_no_selector 'form.simple-form fieldset legend'
- assert_have_selector 'form.advanced-form fieldset', :count => 1, :class => 'advanced-field-set'
- assert_have_selector 'form.advanced-form fieldset legend', :content => "Advanced"
- end
-
- should "display correct field_sets in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form fieldset', :count => 1
- assert_have_no_selector 'form.simple-form fieldset legend'
- assert_have_selector 'form.advanced-form fieldset', :count => 1, :class => 'advanced-field-set'
- assert_have_selector 'form.advanced-form fieldset legend', :content => "Advanced"
- end
- end
-
- context 'for #error_messages_for method' do
- should "display correct error messages list in ruby" do
- user = mock_model("User", :errors => { :a => "1", :b => "2" }, :blank? => false)
- actual_html = error_messages_for(user)
- assert_has_tag('div.field-errors') { actual_html }
- assert_has_tag('div.field-errors h2', :content => "2 errors prohibited this User from being saved") { actual_html }
- assert_has_tag('div.field-errors p', :content => "There were problems with the following fields:") { actual_html }
- assert_has_tag('div.field-errors ul') { actual_html }
- assert_has_tag('div.field-errors ul li', :count => 2) { actual_html }
- end
-
- should "display correct error messages list in erb" do
- visit '/erb/form_tag'
- assert_have_no_selector 'form.simple-form .field-errors'
- assert_have_selector 'form.advanced-form .field-errors'
- assert_have_selector 'form.advanced-form .field-errors h2', :content => "There are problems with saving user!"
- assert_have_selector 'form.advanced-form .field-errors p', :content => "There were problems with the following fields:"
- assert_have_selector 'form.advanced-form .field-errors ul'
- assert_have_selector 'form.advanced-form .field-errors ul li', :count => 4
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be a email"
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Fake must be valid"
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Second must be present"
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Third must be a number"
- end
-
- should "display correct error messages list in haml" do
- visit '/haml/form_tag'
- assert_have_no_selector 'form.simple-form .field-errors'
- assert_have_selector 'form.advanced-form .field-errors'
- assert_have_selector 'form.advanced-form .field-errors h2', :content => "There are problems with saving user!"
- assert_have_selector 'form.advanced-form .field-errors p', :content => "There were problems with the following fields:"
- assert_have_selector 'form.advanced-form .field-errors ul'
- assert_have_selector 'form.advanced-form .field-errors ul li', :count => 4
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be a email"
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Fake must be valid"
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Second must be present"
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Third must be a number"
- end
-
- should "display correct error messages list in slim" do
- visit '/slim/form_tag'
- assert_have_no_selector 'form.simple-form .field-errors'
- assert_have_selector 'form.advanced-form .field-errors'
- assert_have_selector 'form.advanced-form .field-errors h2', :content => "There are problems with saving user!"
- assert_have_selector 'form.advanced-form .field-errors p', :content => "There were problems with the following fields:"
- assert_have_selector 'form.advanced-form .field-errors ul'
- assert_have_selector 'form.advanced-form .field-errors ul li', :count => 4
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Email must be a email"
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Fake must be valid"
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Second must be present"
- assert_have_selector 'form.advanced-form .field-errors ul li', :content => "Third must be a number"
- end
- end
-
- context 'for #error_message_on method' do
- should "display correct error message on specified model name in ruby" do
- @user = mock_model("User", :errors => { :a => "1", :b => "2" }, :blank? => false)
- actual_html = error_message_on(:user, :a, :prepend => "foo", :append => "bar")
- assert_has_tag('span.error', :content => "foo 1 bar") { actual_html }
- end
-
- should "display correct error message on specified object in ruby" do
- @bob = mock_model("User", :errors => { :a => "1", :b => "2" }, :blank? => false)
- actual_html = error_message_on(@bob, :a, :prepend => "foo", :append => "bar")
- assert_has_tag('span.error', :content => "foo 1 bar") { actual_html }
- end
-
- should "display no message when error isn't present" do
- @user = mock_model("User", :errors => { :a => "1", :b => "2" }, :blank? => false)
- actual_html = error_message_on(:user, :fake, :prepend => "foo", :append => "bar")
- assert actual_html.blank?
- end
- end
-
- context 'for #label_tag method' do
- should "display label tag in ruby" do
- actual_html = label_tag(:username, :class => 'long-label', :caption => "Nickname")
- assert_has_tag(:label, :for => 'username', :class => 'long-label', :content => "Nickname") { actual_html }
- end
-
- should "display label tag in ruby with required" do
- actual_html = label_tag(:username, :caption => "Nickname", :required => true)
- assert_has_tag(:label, :for => 'username', :content => 'Nickname') { actual_html }
- assert_has_tag('label[for=username] span.required', :content => "*") { actual_html }
- end
-
- should "display label tag in erb for simple form" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form label', :count => 9
- assert_have_selector 'form.simple-form label', :content => "Username", :for => 'username'
- assert_have_selector 'form.simple-form label', :content => "Password", :for => 'password'
- assert_have_selector 'form.simple-form label', :content => "Gender", :for => 'gender'
- end
- should "display label tag in erb for advanced form" do
- visit '/erb/form_tag'
- assert_have_selector 'form.advanced-form label', :count => 11
- assert_have_selector 'form.advanced-form label.first', :content => "Nickname", :for => 'username'
- assert_have_selector 'form.advanced-form label.first', :content => "Password", :for => 'password'
- assert_have_selector 'form.advanced-form label.about', :content => "About Me", :for => 'about'
- assert_have_selector 'form.advanced-form label.photo', :content => "Photo" , :for => 'photo'
- assert_have_selector 'form.advanced-form label.gender', :content => "Gender" , :for => 'gender'
- end
-
- should "display label tag in haml for simple form" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form label', :count => 9
- assert_have_selector 'form.simple-form label', :content => "Username", :for => 'username'
- assert_have_selector 'form.simple-form label', :content => "Password", :for => 'password'
- assert_have_selector 'form.simple-form label', :content => "Gender", :for => 'gender'
- end
-
- should "display label tag in haml for advanced form" do
- visit '/haml/form_tag'
- assert_have_selector 'form.advanced-form label', :count => 11
- assert_have_selector 'form.advanced-form label.first', :content => "Nickname", :for => 'username'
- assert_have_selector 'form.advanced-form label.first', :content => "Password", :for => 'password'
- assert_have_selector 'form.advanced-form label.about', :content => "About Me", :for => 'about'
- assert_have_selector 'form.advanced-form label.photo', :content => "Photo" , :for => 'photo'
- assert_have_selector 'form.advanced-form label.gender', :content => "Gender" , :for => 'gender'
- end
-
- should "display label tag in slim for simple form" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form label', :count => 9
- assert_have_selector 'form.simple-form label', :content => "Username", :for => 'username'
- assert_have_selector 'form.simple-form label', :content => "Password", :for => 'password'
- assert_have_selector 'form.simple-form label', :content => "Gender", :for => 'gender'
- end
-
- should "display label tag in slim for advanced form" do
- visit '/slim/form_tag'
- assert_have_selector 'form.advanced-form label', :count => 11
- assert_have_selector 'form.advanced-form label.first', :content => "Nickname", :for => 'username'
- assert_have_selector 'form.advanced-form label.first', :content => "Password", :for => 'password'
- assert_have_selector 'form.advanced-form label.about', :content => "About Me", :for => 'about'
- assert_have_selector 'form.advanced-form label.photo', :content => "Photo" , :for => 'photo'
- assert_have_selector 'form.advanced-form label.gender', :content => "Gender" , :for => 'gender'
- end
- end
-
- context 'for #hidden_field_tag method' do
- should "display hidden field in ruby" do
- actual_html = hidden_field_tag(:session_key, :id => 'session_id', :value => '56768')
- assert_has_tag(:input, :type => 'hidden', :id => "session_id", :name => 'session_key', :value => '56768') { actual_html }
- end
-
- should "display hidden field in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
- assert_have_selector 'form.advanced-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
- end
-
- should "display hidden field in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
- assert_have_selector 'form.advanced-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
- end
-
- should "display hidden field in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
- assert_have_selector 'form.advanced-form input[type=hidden]', :count => 1, :name => 'session_id', :value => "__secret__"
- end
- end
-
- context 'for #text_field_tag method' do
- should "display text field in ruby" do
- actual_html = text_field_tag(:username, :class => 'long')
- assert_has_tag(:input, :type => 'text', :class => "long", :name => 'username') { actual_html }
- end
-
- should "display text field in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form input[type=text]', :count => 1, :name => 'username'
- assert_have_selector 'form.advanced-form fieldset input[type=text]', :count => 1, :name => 'username', :id => 'the_username'
- end
-
- should "display text field in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form input[type=text]', :count => 1, :name => 'username'
- assert_have_selector 'form.advanced-form fieldset input[type=text]', :count => 1, :name => 'username', :id => 'the_username'
- end
-
- should "display text field in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form input[type=text]', :count => 1, :name => 'username'
- assert_have_selector 'form.advanced-form fieldset input[type=text]', :count => 1, :name => 'username', :id => 'the_username'
- end
- end
-
- context 'for #number_field_tag method' do
- should "display number field in ruby" do
- actual_html = number_field_tag(:age, :class => 'numeric')
- assert_has_tag(:input, :type => 'number', :class => 'numeric', :name => 'age') { actual_html }
- end
-
- should "display number field in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form input[type=number]', :count => 1, :name => 'age'
- assert_have_selector 'form.advanced-form fieldset input[type=number]', :count => 1, :name => 'age', :class => 'numeric'
- end
-
- should "display number field in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form input[type=number]', :count => 1, :name => 'age'
- assert_have_selector 'form.advanced-form fieldset input[type=number]', :count => 1, :name => 'age', :class => 'numeric'
- end
-
- should "display number field in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form input[type=number]', :count => 1, :name => 'age'
- assert_have_selector 'form.advanced-form fieldset input[type=number]', :count => 1, :name => 'age', :class => 'numeric'
- end
- end
-
- context 'for #telephone_field_tag method' do
- should "display number field in ruby" do
- actual_html = telephone_field_tag(:telephone, :class => 'numeric')
- assert_has_tag(:input, :type => 'tel', :class => 'numeric', :name => 'telephone') { actual_html }
- end
-
- should "display telephone field in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form input[type=tel]', :count => 1, :name => 'telephone'
- assert_have_selector 'form.advanced-form fieldset input[type=tel]', :count => 1, :name => 'telephone', :class => 'numeric'
- end
-
- should "display telephone field in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form input[type=tel]', :count => 1, :name => 'telephone'
- assert_have_selector 'form.advanced-form fieldset input[type=tel]', :count => 1, :name => 'telephone', :class => 'numeric'
- end
-
- should "display telephone field in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form input[type=tel]', :count => 1, :name => 'telephone'
- assert_have_selector 'form.advanced-form fieldset input[type=tel]', :count => 1, :name => 'telephone', :class => 'numeric'
- end
- end
-
- context 'for #search_field_tag method' do
- should "display search field in ruby" do
- actual_html = search_field_tag(:search, :class => 'string')
- assert_has_tag(:input, :type => 'search', :class => 'string', :name => 'search') { actual_html }
- end
-
- should "display search field in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form input[type=search]', :count => 1, :name => 'search'
- assert_have_selector 'form.advanced-form fieldset input[type=search]', :count => 1, :name => 'search', :class => 'string'
- end
-
- should "display search field in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form input[type=search]', :count => 1, :name => 'search'
- assert_have_selector 'form.advanced-form fieldset input[type=search]', :count => 1, :name => 'search', :class => 'string'
- end
-
- should "display search field in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form input[type=search]', :count => 1, :name => 'search'
- assert_have_selector 'form.advanced-form fieldset input[type=search]', :count => 1, :name => 'search', :class => 'string'
- end
- end
-
- context 'for #email_field_tag method' do
- should "display email field in ruby" do
- actual_html = email_field_tag(:email, :class => 'string')
- assert_has_tag(:input, :type => 'email', :class => 'string', :name => 'email') { actual_html }
- end
-
- should "display email field in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form input[type=email]', :count => 1, :name => 'email'
- assert_have_selector 'form.advanced-form fieldset input[type=email]', :count => 1, :name => 'email', :class => 'string'
- end
-
- should "display email field in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form input[type=email]', :count => 1, :name => 'email'
- assert_have_selector 'form.advanced-form fieldset input[type=email]', :count => 1, :name => 'email', :class => 'string'
- end
-
- should "display email field in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form input[type=email]', :count => 1, :name => 'email'
- assert_have_selector 'form.advanced-form fieldset input[type=email]', :count => 1, :name => 'email', :class => 'string'
- end
- end
-
- context 'for #url_field_tag method' do
- should "display url field in ruby" do
- actual_html = url_field_tag(:webpage, :class => 'string')
- assert_has_tag(:input, :type => 'url', :class => 'string', :name => 'webpage') { actual_html }
- end
-
- should "display url field in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form input[type=url]', :count => 1, :name => 'webpage'
- assert_have_selector 'form.advanced-form fieldset input[type=url]', :count => 1, :name => 'webpage', :class => 'string'
- end
-
- should "display url field in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form input[type=url]', :count => 1, :name => 'webpage'
- assert_have_selector 'form.advanced-form fieldset input[type=url]', :count => 1, :name => 'webpage', :class => 'string'
- end
-
- should "display url field in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form input[type=url]', :count => 1, :name => 'webpage'
- assert_have_selector 'form.advanced-form fieldset input[type=url]', :count => 1, :name => 'webpage', :class => 'string'
- end
- end
-
- context 'for #text_area_tag method' do
- should "display text area in ruby" do
- actual_html = text_area_tag(:about, :class => 'long')
- assert_has_tag(:textarea, :class => "long", :name => 'about') { actual_html }
- end
-
- should "display text area in ruby with specified content" do
- actual_html = text_area_tag(:about, :value => "a test", :rows => 5, :cols => 6)
- assert_has_tag(:textarea, :content => "a test", :name => 'about', :rows => "5", :cols => "6") { actual_html }
- end
-
- should "display text area in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.advanced-form textarea', :count => 1, :name => 'about', :class => 'large'
- end
-
- should "display text area in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.advanced-form textarea', :count => 1, :name => 'about', :class => 'large'
- end
-
- should "display text area in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.advanced-form textarea', :count => 1, :name => 'about', :class => 'large'
- end
- end
-
- context 'for #password_field_tag method' do
- should "display password field in ruby" do
- actual_html = password_field_tag(:password, :class => 'long')
- assert_has_tag(:input, :type => 'password', :class => "long", :name => 'password') { actual_html }
- end
-
- should "display password field in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form input[type=password]', :count => 1, :name => 'password'
- assert_have_selector 'form.advanced-form input[type=password]', :count => 1, :name => 'password'
- end
-
- should "display password field in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form input[type=password]', :count => 1, :name => 'password'
- assert_have_selector 'form.advanced-form input[type=password]', :count => 1, :name => 'password'
- end
-
- should "display password field in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form input[type=password]', :count => 1, :name => 'password'
- assert_have_selector 'form.advanced-form input[type=password]', :count => 1, :name => 'password'
- end
- end
-
- context 'for #file_field_tag method' do
- should "display file field in ruby" do
- actual_html = file_field_tag(:photo, :class => 'photo')
- assert_has_tag(:input, :type => 'file', :class => "photo", :name => 'photo') { actual_html }
- end
-
- should "display file field in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.advanced-form input[type=file]', :count => 1, :name => 'photo', :class => 'upload'
- end
-
- should "display file field in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.advanced-form input[type=file]', :count => 1, :name => 'photo', :class => 'upload'
- end
-
- should "display file field in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.advanced-form input[type=file]', :count => 1, :name => 'photo', :class => 'upload'
- end
- end
-
- context "for #check_box_tag method" do
- should "display check_box tag in ruby" do
- actual_html = check_box_tag("clear_session")
- assert_has_tag(:input, :type => 'checkbox', :value => '1', :name => 'clear_session') { actual_html }
- assert_has_no_tag(:input, :type => 'hidden') { actual_html }
- end
-
- should "display check_box tag in ruby with extended attributes" do
- actual_html = check_box_tag("clear_session", :disabled => true, :checked => true)
- assert_has_tag(:input, :type => 'checkbox', :disabled => 'disabled', :checked => 'checked') { actual_html }
- end
-
- should "display check_box tag in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form input[type=checkbox]', :count => 1
- assert_have_selector 'form.advanced-form input[type=checkbox]', :value => "1", :checked => 'checked'
- end
-
- should "display check_box tag in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form input[type=checkbox]', :count => 1
- assert_have_selector 'form.advanced-form input[type=checkbox]', :value => "1", :checked => 'checked'
- end
-
- should "display check_box tag in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form input[type=checkbox]', :count => 1
- assert_have_selector 'form.advanced-form input[type=checkbox]', :value => "1", :checked => 'checked'
- end
- end
-
- context "for #radio_button_tag method" do
- should "display radio_button tag in ruby" do
- actual_html = radio_button_tag("gender", :value => 'male')
- assert_has_tag(:input, :type => 'radio', :value => 'male', :name => 'gender') { actual_html }
- end
-
- should "display radio_button tag in ruby with extended attributes" do
- actual_html = radio_button_tag("gender", :disabled => true, :checked => true)
- assert_has_tag(:input, :type => 'radio', :disabled => 'disabled', :checked => 'checked') { actual_html }
- end
-
- should "display radio_button tag in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'male'
- assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'female'
- assert_have_selector 'form.advanced-form input[type=radio]', :value => "male", :checked => 'checked'
- assert_have_selector 'form.advanced-form input[type=radio]', :value => "female"
- end
-
- should "display radio_button tag in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'male'
- assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'female'
- assert_have_selector 'form.advanced-form input[type=radio]', :value => "male", :checked => 'checked'
- assert_have_selector 'form.advanced-form input[type=radio]', :value => "female"
- end
-
- should "display radio_button tag in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'male'
- assert_have_selector 'form.simple-form input[type=radio]', :count => 1, :value => 'female'
- assert_have_selector 'form.advanced-form input[type=radio]', :value => "male", :checked => 'checked'
- assert_have_selector 'form.advanced-form input[type=radio]', :value => "female"
- end
- end
-
- context "for #select_tag method" do
- should "display select tag in ruby" do
- actual_html = select_tag(:favorite_color, :options => ['green', 'blue', 'black'], :include_blank => true)
- assert_has_tag(:select, :name => 'favorite_color') { actual_html }
- assert_has_tag('select option:first-child', :content => '') { actual_html }
- assert_has_tag('select option', :content => 'green', :value => 'green') { actual_html }
- assert_has_tag('select option', :content => 'blue', :value => 'blue') { actual_html }
- assert_has_tag('select option', :content => 'black', :value => 'black') { actual_html }
- end
-
- should "display select tag in ruby with extended attributes" do
- actual_html = select_tag(:favorite_color, :disabled => true, :options => ['only', 'option'])
- assert_has_tag(:select, :disabled => 'disabled') { actual_html }
- end
-
- should "take a range as a collection for options" do
- actual_html = select_tag(:favorite_color, :options => (1..3))
- assert_has_tag(:select) { actual_html }
- assert_has_tag('select option', :value => '1') { actual_html }
- assert_has_tag('select option', :value => '2') { actual_html }
- assert_has_tag('select option', :value => '3') { actual_html }
- end
-
- should "include blank for grouped options" do
- opts = { "Red" => ["Rose","Fire"], "Blue" => ["Sky","Sea"] }
- actual_html = select_tag( 'color', :grouped_options => opts, :include_blank => true )
- assert_has_tag('select option:first-child', :value => "", :content => "") { actual_html }
- end
-
- should "return a select tag with grouped options for an nested array" do
- opts = [
- ["Friends",["Yoda",["Obiwan",2]]],
- ["Enemies", ["Palpatine",['Darth Vader',3]]]
- ]
- actual_html = select_tag( 'name', :grouped_options => opts )
- assert_has_tag(:select, :name => "name") { actual_html }
- assert_has_tag(:optgroup, :label => "Friends") { actual_html }
- assert_has_tag(:option, :value => "Yoda", :content => "Yoda") { actual_html }
- assert_has_tag(:option, :value => "2", :content => "Obiwan") { actual_html }
- assert_has_tag(:optgroup, :label => "Enemies") { actual_html }
- assert_has_tag(:option, :value => "Palpatine", :content => "Palpatine") { actual_html }
- assert_has_tag(:option, :value => "3", :content => "Darth Vader") { actual_html }
- end
-
- should "return a select tag with grouped options for a hash" do
- opts = {
- "Friends" => ["Yoda",["Obiwan",2]],
- "Enemies" => ["Palpatine",['Darth Vader',3]]
- }
- actual_html = select_tag( 'name', :grouped_options => opts )
- assert_has_tag(:select, :name => "name") { actual_html }
- assert_has_tag(:optgroup, :label => "Friends") { actual_html }
- assert_has_tag(:option, :value => "Yoda", :content => "Yoda") { actual_html }
- assert_has_tag(:option, :value => "2", :content => "Obiwan") { actual_html }
- assert_has_tag(:optgroup, :label => "Enemies") { actual_html }
- assert_has_tag(:option, :value => "Palpatine", :content => "Palpatine") { actual_html }
- assert_has_tag(:option, :value => "3", :content => "Darth Vader") { actual_html }
- end
-
- should "display select tag in ruby with multiple attribute" do
- actual_html = select_tag(:favorite_color, :multiple => true, :options => ['only', 'option'])
- assert_has_tag(:select, :multiple => 'multiple', :name => 'favorite_color[]') { actual_html }
- end
-
- should "display options with values and single selected" do
- options = [['Green', 'green1'], ['Blue', 'blue1'], ['Black', "black1"]]
- actual_html = select_tag(:favorite_color, :options => options, :selected => 'green1')
- assert_has_tag(:select, :name => 'favorite_color') { actual_html }
- assert_has_tag('select option', :selected => 'selected', :count => 1) { actual_html }
- assert_has_tag('select option', :content => 'Green', :value => 'green1', :selected => 'selected') { actual_html }
- assert_has_tag('select option', :content => 'Blue', :value => 'blue1') { actual_html }
- assert_has_tag('select option', :content => 'Black', :value => 'black1') { actual_html }
- end
-
- should "display option with values and multiple selected" do
- options = [['Green', 'green1'], ['Blue', 'blue1'], ['Black', "black1"]]
- actual_html = select_tag(:favorite_color, :options => options, :selected => ['green1', 'Black'])
- assert_has_tag(:select, :name => 'favorite_color') { actual_html }
- assert_has_tag('select option', :selected => 'selected', :count => 2) { actual_html }
- assert_has_tag('select option', :content => 'Green', :value => 'green1', :selected => 'selected') { actual_html }
- assert_has_tag('select option', :content => 'Blue', :value => 'blue1') { actual_html }
- assert_has_tag('select option', :content => 'Black', :value => 'black1', :selected => 'selected') { actual_html }
- end
-
- should "display options selected only for exact match" do
- options = [['One', '1'], ['1', '10'], ['Two', "-1"]]
- actual_html = select_tag(:range, :options => options, :selected => '-1')
- assert_has_tag(:select, :name => 'range') { actual_html }
- assert_has_tag('select option', :selected => 'selected', :count => 1) { actual_html }
- assert_has_tag('select option', :content => 'Two', :value => '-1', :selected => 'selected') { actual_html }
- end
-
- should "display select tag in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form select', :count => 1, :name => 'color'
- assert_have_selector('select option', :content => 'green', :value => 'green')
- assert_have_selector('select option', :content => 'orange', :value => 'orange')
- assert_have_selector('select option', :content => 'purple', :value => 'purple')
- assert_have_selector 'form.advanced-form select', :name => 'fav_color'
- assert_have_selector('select option', :content => 'green', :value => '1')
- assert_have_selector('select option', :content => 'orange', :value => '2', :selected => 'selected')
- assert_have_selector('select option', :content => 'purple', :value => '3')
- end
-
- should "display select tag in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form select', :count => 1, :name => 'color'
- assert_have_selector('select option', :content => 'green', :value => 'green')
- assert_have_selector('select option', :content => 'orange', :value => 'orange')
- assert_have_selector('select option', :content => 'purple', :value => 'purple')
- assert_have_selector 'form.advanced-form select', :name => 'fav_color'
- assert_have_selector('select option', :content => 'green', :value => '1')
- assert_have_selector('select option', :content => 'orange', :value => '2', :selected => 'selected')
- assert_have_selector('select option', :content => 'purple', :value => '3')
- end
-
- should "display select tag in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form select', :count => 1, :name => 'color'
- assert_have_selector('select option', :content => 'green', :value => 'green')
- assert_have_selector('select option', :content => 'orange', :value => 'orange')
- assert_have_selector('select option', :content => 'purple', :value => 'purple')
- assert_have_selector 'form.advanced-form select', :name => 'fav_color'
- assert_have_selector('select option', :content => 'green', :value => '1')
- assert_have_selector('select option', :content => 'orange', :value => '2', :selected => 'selected')
- assert_have_selector('select option', :content => 'purple', :value => '3')
- end
- end
-
- context 'for #submit_tag method' do
- should "display submit tag in ruby" do
- actual_html = submit_tag("Update", :class => 'success')
- assert_has_tag(:input, :type => 'submit', :class => "success", :value => 'Update') { actual_html }
- end
-
- should "display submit tag in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.simple-form input[type=submit]', :count => 1, :value => "Submit"
- assert_have_selector 'form.advanced-form input[type=submit]', :count => 1, :value => "Login"
- end
-
- should "display submit tag in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.simple-form input[type=submit]', :count => 1, :value => "Submit"
- assert_have_selector 'form.advanced-form input[type=submit]', :count => 1, :value => "Login"
- end
-
- should "display submit tag in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.simple-form input[type=submit]', :count => 1, :value => "Submit"
- assert_have_selector 'form.advanced-form input[type=submit]', :count => 1, :value => "Login"
- end
- end
-
- context 'for #button_tag method' do
- should "display submit tag in ruby" do
- actual_html = button_tag("Cancel", :class => 'clear')
- assert_has_tag(:input, :type => 'button', :class => "clear", :value => 'Cancel') { actual_html }
- end
-
- should "display submit tag in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.advanced-form input[type=button]', :count => 1, :value => "Cancel"
- end
-
- should "display submit tag in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.advanced-form input[type=button]', :count => 1, :value => "Cancel"
- end
-
- should "display submit tag in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.advanced-form input[type=button]', :count => 1, :value => "Cancel"
- end
- end
-
- context 'for #image_submit_tag method' do
- setup do
- @stamp = stop_time_for_test.to_i
- end
-
- should "display image submit tag in ruby with relative path" do
- actual_html = image_submit_tag('buttons/ok.png', :class => 'success')
- assert_has_tag(:input, :type => 'image', :class => "success", :src => "/images/buttons/ok.png?#{@stamp}") { actual_html }
- end
-
- should "display image submit tag in ruby with absolute path" do
- actual_html = image_submit_tag('/system/ok.png', :class => 'success')
- assert_has_tag(:input, :type => 'image', :class => "success", :src => "/system/ok.png") { actual_html }
- end
-
- should "display image submit tag in erb" do
- visit '/erb/form_tag'
- assert_have_selector 'form.advanced-form input[type=image]', :count => 1, :src => "/images/buttons/submit.png?#{@stamp}"
- end
-
- should "display image submit tag in haml" do
- visit '/haml/form_tag'
- assert_have_selector 'form.advanced-form input[type=image]', :count => 1, :src => "/images/buttons/submit.png?#{@stamp}"
- end
-
- should "display image submit tag in slim" do
- visit '/slim/form_tag'
- assert_have_selector 'form.advanced-form input[type=image]', :count => 1, :src => "/images/buttons/submit.png?#{@stamp}"
- end
- end
-end
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_format_helpers.rb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_format_helpers.rb
deleted file mode 100644
index 19e9c5ed..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_format_helpers.rb
+++ /dev/null
@@ -1,227 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/helper')
-require File.expand_path(File.dirname(__FILE__) + '/fixtures/markup_app/app')
-
-describe "FormatHelpers" do
- def app
- MarkupDemo.tap { |app| app.set :environment, :test }
- end
-
- def setup
- Time.stubs(:now).returns(Time.utc(1983, 11, 9, 5))
- end
-
- include Padrino::Helpers::FormatHelpers
-
- context 'for #simple_format method' do
- should "format simple text into html format" do
- actual_text = simple_format("Here is some basic text...\n...with a line break.")
- assert_equal "Here is some basic text...\n
...with a line break.
", actual_text
- end
-
- should "format more text into html format" do
- actual_text = simple_format("We want to put a paragraph...\n\n...right there.")
- assert_equal "We want to put a paragraph...
\n\n...right there.
", actual_text
- end
-
- should "support defining a class for the paragraphs" do
- actual_text = simple_format("Look me! A class!", :class => 'description')
- assert_equal "Look me! A class!
", actual_text
- end
-
- context 'wrapped in a custom tag' do
- should "format simple text into html format" do
- actual_text = simple_format("Here is some basic text...\n...with a line break.", :tag => :div)
- assert_equal "Here is some basic text...\n
...with a line break.
", actual_text
- end
-
- should "format more text into html format" do
- actual_text = simple_format("We want to put a paragraph...\n\n...right there.", :tag => :div)
- assert_equal "We want to put a paragraph...
\n\n...right there.
", actual_text
- end
-
- should "support defining a class for the paragraphs" do
- actual_text = simple_format("Look me! A class!", :class => 'description', :tag => :div)
- assert_equal "Look me! A class!
", actual_text
- end
- end
- end
-
- context 'for #pluralize method' do
- should "return singular count for 1 item collections" do
- actual_text = pluralize(1, 'person')
- assert_equal '1 person', actual_text
- end
- should "return plural count for empty collections" do
- actual_text = pluralize(0, 'person')
- assert_equal '0 people', actual_text
- end
- should "return plural count for many collections" do
- actual_text = pluralize(2, 'person')
- assert_equal '2 people', actual_text
- end
- should "return pluralized word specified as argument" do
- actual_text = pluralize(3, 'person', 'users')
- assert_equal '3 users', actual_text
- end
- end
-
- context 'for #word_wrap method' do
- should "return proper formatting for 8 max width" do
- actual_text = word_wrap('Once upon a time', :line_width => 8)
- assert_equal "Once\nupon a\ntime", actual_text
- end
- should "return proper formatting for 1 max width" do
- actual_text = word_wrap('Once upon a time', :line_width => 1)
- assert_equal "Once\nupon\na\ntime", actual_text
- end
- should "return proper formatting for default width" do
- actual_text = word_wrap((1..50).to_a.join(" "))
- assert_equal (1..30).to_a.join(" ") + "\n" + (31..50).to_a.join(" "), actual_text
- actual_text = word_wrap((1..50).to_a.join(" "), 80)
- assert_equal (1..30).to_a.join(" ") + "\n" + (31..50).to_a.join(" "), actual_text
- end
- end
-
- context 'for #highlight method' do
- should 'highligth with defaults' do
- actual_text = highlight('Lorem ipsum dolor sit amet', 'dolor')
- assert_equal 'Lorem ipsum dolor sit amet', actual_text
- end
-
- should 'highlight with highlighter' do
- actual_text = highlight('Lorem ipsum dolor sit amet', 'dolor', :highlighter => '\1')
- assert_equal 'Lorem ipsum dolor sit amet', actual_text
- end
- end
-
- context 'for #truncate method' do
- should "support default truncation" do
- actual_text = truncate("Once upon a time in a world far far away")
- assert_equal "Once upon a time in a world...", actual_text
- end
- should "support specifying length" do
- actual_text = truncate("Once upon a time in a world far far away", :length => 14)
- assert_equal "Once upon a...", actual_text
- end
- should "support specifying omission text" do
- actual_text = truncate("And they found that many people were sleeping better.", :length => 25, :omission => "(clipped)")
- assert_equal "And they found t(clipped)", actual_text
- end
- end
-
- context 'for #truncate_words method' do
- should "support default truncation" do
- actual_text = truncate_words("Long before books were made, people told stories. They told them to one another and to the children as they sat before the fire. Many of these stories were about interesting people, but most of them were about the ways of fairies and giants.")
- assert_equal "Long before books were made, people told stories. They told them to one another and to the children as they sat before the fire. Many of these stories were about...", actual_text
- end
- should "support specifying length" do
- actual_text = truncate_words("Once upon a time in a world far far away", :length => 8)
- assert_equal "Once upon a time in a world far...", actual_text
- end
- should "support specifying omission text" do
- actual_text = truncate_words("And they found that many people were sleeping better.", :length => 4, :omission => "(clipped)")
- assert_equal "And they found that(clipped)", actual_text
- end
- end
-
- context 'for #h and #h! method' do
- should "escape the simple html" do
- assert_equal '<h1>hello</h1>', h('hello
')
- assert_equal '<h1>hello</h1>', escape_html('hello
')
- end
- should "escape all brackets, quotes and ampersands" do
- assert_equal '<h1><>"&demo&"<></h1>', h('<>"&demo&"<>
')
- end
- should "return default text if text is empty" do
- assert_equal 'default', h!("", "default")
- assert_equal ' ', h!("")
- end
- should "return text escaped if not empty" do
- assert_equal '<h1>hello</h1>', h!('hello
')
- end
- end
-
- context 'for #time_ago_in_words method' do
- should "less than 5 seconds" do
- assert_equal 'less than 5 seconds', time_ago_in_words(Time.now, true)
- end
- should "less than 10 seconds" do
- assert_equal 'less than 10 seconds', time_ago_in_words(Time.now-5, true)
- end
- should "less than 20 seconds" do
- assert_equal 'less than 20 seconds', time_ago_in_words(Time.now-10, true)
- end
- should "less than a minute" do
- assert_equal 'less than a minute', time_ago_in_words(Time.now-40, true)
- end
- should "2 minutes" do
- assert_equal '2 minutes', time_ago_in_words(Time.now-120, true)
- end
- should "display today" do
- assert_equal 'less than a minute', time_ago_in_words(Time.now)
- end
- should "display yesterday" do
- assert_equal '1 day', time_ago_in_words(1.day.ago)
- end
- should "display tomorrow" do
- assert_equal '1 day', time_ago_in_words(1.day.from_now)
- end
- should "return future number of days" do
- assert_equal '4 days', time_ago_in_words(4.days.from_now)
- end
- should "return past days ago" do
- assert_equal '4 days', time_ago_in_words(4.days.ago)
- end
- should "return formatted archived date" do
- assert_equal '3 months', time_ago_in_words(100.days.ago)
- end
- should "return formatted archived year date" do
- assert_equal 'over 1 year', time_ago_in_words(500.days.ago)
- end
- should 'display now as a minute ago' do
- assert_equal '1 minute', time_ago_in_words(1.minute.ago)
- end
- should "display a few minutes ago" do
- assert_equal '4 minutes', time_ago_in_words(4.minute.ago)
- end
- should "display an hour ago" do
- assert_equal 'about 1 hour', time_ago_in_words(1.hour.ago + 5.minutes.ago.sec)
- end
- should "display a few hours ago" do
- assert_equal 'about 3 hours', time_ago_in_words(3.hour.ago + 5.minutes.ago.sec)
- end
- should "display a day ago" do
- assert_equal '1 day', time_ago_in_words(1.day.ago)
- end
- should "display a few days ago" do
- assert_equal '5 days', time_ago_in_words(5.days.ago - 5.minutes.ago.sec)
- end
- should "display a month ago" do
- assert_equal 'about 1 month', time_ago_in_words(32.days.ago + 5.minutes.ago.sec)
- end
- should "display a few months ago" do
- assert_equal '6 months', time_ago_in_words(180.days.ago - 5.minutes.ago.sec)
- end
- should "display a year ago" do
- assert_equal 'about 1 year', time_ago_in_words(365.days.ago - 5.minutes.ago.sec)
- end
- should "display a few years ago" do
- assert_equal 'over 7 years', time_ago_in_words(2800.days.ago - 5.minutes.ago.sec)
- end
- end
-
- context 'for #js_escape_html method' do
- should "escape double quotes" do
- assert_equal "\\\"hello\\\"", js_escape_html('"hello"')
- end
- should "escape single quotes" do
- assert_equal "\\'hello\\'", js_escape_html("'hello'")
- end
- should "escape html tags and breaks" do
- assert_equal "\\n\\nhello<\\/p>\\n", js_escape_html("\n\r
hello
\r\n")
- end
- should "escape data-confirm attribute" do
- assert_equal "", js_escape_html("")
- end
- end
-end
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_locale.rb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_locale.rb
deleted file mode 100644
index 06b8b501..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_locale.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/helper')
-
-describe "Locale Helpers" do
- Dir[File.expand_path("../../lib/padrino-helpers/locale/*.yml", __FILE__)].each do |file|
- base_original = YAML.load_file(file)
- name = File.basename(file, '.yml')
- should "should have correct locale for #{name}" do
- base = base_original[name]['number']['format']
- assert !base['separator'].nil?
- assert !base['delimiter'].nil?
- assert !base['precision'].nil?
- base = base_original[name]['number']['currency']['format']
- assert !base['format'].nil?
- assert !base['unit'].nil?
- assert !base['separator'].nil?
- assert !base['delimiter'].nil?
- assert !base['precision'].nil?
- end
- end
-end
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_number_helpers.rb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_number_helpers.rb
deleted file mode 100644
index 96b40b43..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_number_helpers.rb
+++ /dev/null
@@ -1,139 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/helper')
-require File.expand_path(File.dirname(__FILE__) + '/fixtures/markup_app/app')
-
-describe "NumberHelpers" do
- include Padrino::Helpers::NumberHelpers
-
- def kilobytes(number)
- number * 1024
- end
-
- def megabytes(number)
- kilobytes(number) * 1024
- end
-
- def gigabytes(number)
- megabytes(number) * 1024
- end
-
- def terabytes(number)
- gigabytes(number) * 1024
- end
-
- context 'for number helpers functionality' do
-
- should 'display number_to_currency' do
- assert_equal "$1,234,567,890.50", number_to_currency(1234567890.50)
- assert_equal "$1,234,567,890.51", number_to_currency(1234567890.506)
- assert_equal "$1,234,567,892", number_to_currency(1234567891.50, {:precision => 0})
- assert_equal "$1,234,567,890.5", number_to_currency(1234567890.50, {:precision => 1})
- assert_equal "£1234567890,50", number_to_currency(1234567890.50, {:unit => "£", :separator => ",", :delimiter => ""})
- assert_equal "$1,234,567,890.50", number_to_currency("1234567890.50")
- assert_equal "1,234,567,890.50 Kč", number_to_currency("1234567890.50", {:unit => "Kč", :format => "%n %u"})
- assert_equal "$x", number_to_currency("x")
-
- assert_nil number_to_currency(nil)
- end
-
- should 'display number_to_percentage' do
- assert_equal "100.000%", number_to_percentage(100)
- assert_equal "100%", number_to_percentage(100, {:precision => 0})
- assert_equal "302.06%", number_to_percentage(302.0574, {:precision => 2})
- assert_equal "100.000%", number_to_percentage("100")
- assert_equal "1000.000%", number_to_percentage("1000")
- assert_equal "x%", number_to_percentage("x")
- assert_equal "1.000,000%", number_to_percentage(1000, :delimiter => '.', :separator => ',')
-
- assert_nil number_to_percentage(nil)
- end
-
- should 'display number_with_delimiter' do
- assert_equal "12,345,678", number_with_delimiter(12345678)
- assert_equal "0", number_with_delimiter(0)
- assert_equal "123", number_with_delimiter(123)
- assert_equal "123,456", number_with_delimiter(123456)
- assert_equal "123,456.78", number_with_delimiter(123456.78)
- assert_equal "123,456.789", number_with_delimiter(123456.789)
- assert_equal "123,456.78901", number_with_delimiter(123456.78901)
- assert_equal "123,456,789.78901", number_with_delimiter(123456789.78901)
- assert_equal "0.78901", number_with_delimiter(0.78901)
- assert_equal "123,456.78", number_with_delimiter("123456.78")
- assert_equal "x", number_with_delimiter("x")
-
- assert_nil number_with_delimiter(nil)
- end
-
- should 'display number_with_delimiter with options' do
- assert_equal '12 345 678', number_with_delimiter(12345678, :delimiter => ' ')
- assert_equal '12,345,678-05', number_with_delimiter(12345678.05, :separator => '-')
- assert_equal '12.345.678,05', number_with_delimiter(12345678.05, :separator => ',', :delimiter => '.')
- assert_equal '12.345.678,05', number_with_delimiter(12345678.05, :delimiter => '.', :separator => ',')
- end
-
- should 'display number_with_precision' do
- assert_equal "111.235", number_with_precision(111.2346)
- assert_equal "31.83", number_with_precision(31.825, :precision => 2)
- assert_equal "111.23", number_with_precision(111.2346, :precision => 2)
- assert_equal "111.00", number_with_precision(111, :precision => 2)
- assert_equal "111.235", number_with_precision("111.2346")
- assert_equal "31.83", number_with_precision("31.825", :precision => 2)
- assert_equal "3268", number_with_precision((32.6751 * 100.00), :precision => 0)
- assert_equal "112", number_with_precision(111.50, :precision => 0)
- assert_equal "1234567892", number_with_precision(1234567891.50, :precision => 0)
-
- # Return non-numeric params unchanged.
- assert_equal "x", number_with_precision("x")
- assert_nil number_with_precision(nil)
- end
-
- should 'display number_with_precision with custom delimiter and separator' do
- assert_equal '31,83', number_with_precision(31.825, :precision => 2, :separator => ',')
- assert_equal '1.231,83', number_with_precision(1231.825, :precision => 2, :separator => ',', :delimiter => '.')
- end
-
- should 'display number_to_human_size' do
- assert_equal '0 Bytes', number_to_human_size(0)
- assert_equal '1 Byte', number_to_human_size(1)
- assert_equal '3 Bytes', number_to_human_size(3.14159265)
- assert_equal '123 Bytes', number_to_human_size(123.0)
- assert_equal '123 Bytes', number_to_human_size(123)
- assert_equal '1.2 KB', number_to_human_size(1234)
- assert_equal '12.1 KB', number_to_human_size(12345)
- assert_equal '1.2 MB', number_to_human_size(1234567)
- assert_equal '1.1 GB', number_to_human_size(1234567890)
- assert_equal '1.1 TB', number_to_human_size(1234567890123)
- assert_equal '1025 TB', number_to_human_size(terabytes(1025))
- assert_equal '444 KB', number_to_human_size(kilobytes(444))
- assert_equal '1023 MB', number_to_human_size(megabytes(1023))
- assert_equal '3 TB', number_to_human_size(terabytes(3))
- assert_equal '1.18 MB', number_to_human_size(1234567, :precision => 2)
- assert_equal '3 Bytes', number_to_human_size(3.14159265, :precision => 4)
- assert_equal '123 Bytes', number_to_human_size("123")
- assert_equal '1.01 KB', number_to_human_size(kilobytes(1.0123), :precision => 2)
- assert_equal '1.01 KB', number_to_human_size(kilobytes(1.0100), :precision => 4)
- assert_equal '10 KB', number_to_human_size(kilobytes(10.000), :precision => 4)
- assert_equal '1 Byte', number_to_human_size(1.1)
- assert_equal '10 Bytes', number_to_human_size(10)
-
- assert_nil number_to_human_size(nil)
- end
-
- should 'display number_to_human_size with options' do
- assert_equal '1.18 MB', number_to_human_size(1234567, :precision => 2)
- assert_equal '3 Bytes', number_to_human_size(3.14159265, :precision => 4)
- assert_equal '1.01 KB', number_to_human_size(kilobytes(1.0123), :precision => 2)
- assert_equal '1.01 KB', number_to_human_size(kilobytes(1.0100), :precision => 4)
- assert_equal '10 KB', number_to_human_size(kilobytes(10.000), :precision => 4)
- assert_equal '1 TB', number_to_human_size(1234567890123, :precision => 0)
- assert_equal '500 MB', number_to_human_size(524288000, :precision => 0)
- assert_equal '40 KB', number_to_human_size(41010, :precision => 0)
- assert_equal '40 KB', number_to_human_size(41100, :precision => 0)
- end
-
- should 'display number_to_human_size with custom delimiter and separator' do
- assert_equal '1,01 KB', number_to_human_size(kilobytes(1.0123), :precision => 2, :separator => ',')
- assert_equal '1,01 KB', number_to_human_size(kilobytes(1.0100), :precision => 4, :separator => ',')
- assert_equal '1.000,1 TB', number_to_human_size(terabytes(1000.1), :delimiter => '.', :separator => ',')
- end
- end
-end
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_output_helpers.rb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_output_helpers.rb
deleted file mode 100644
index 54f20857..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_output_helpers.rb
+++ /dev/null
@@ -1,153 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/helper')
-require File.expand_path(File.dirname(__FILE__) + '/fixtures/markup_app/app')
-
-describe "OutputHelpers" do
- def app
- MarkupDemo.tap { |app| app.set :environment, :test }
- end
-
- context 'for #content_for method' do
- should 'work for erb templates' do
- visit '/erb/content_for'
- assert_have_selector '.demo h1', :content => "This is content yielded from a content_for"
- assert_have_selector '.demo2 h1', :content => "This is content yielded with name Johnny Smith"
- end
-
- should "work for haml templates" do
- visit '/haml/content_for'
- assert_have_selector '.demo h1', :content => "This is content yielded from a content_for"
- assert_have_selector '.demo2 h1', :content => "This is content yielded with name Johnny Smith"
- end
-
- should "work for slim templates" do
- visit '/slim/content_for'
- assert_have_selector '.demo h1', :content => "This is content yielded from a content_for"
- assert_have_selector '.demo2 h1', :content => "This is content yielded with name Johnny Smith"
- end
- end # content_for
-
- context "for #content_for? method" do
- should 'work for erb templates' do
- visit '/erb/content_for'
- assert_have_selector '.demo_has_content', :content => "true"
- assert_have_selector '.fake_has_content', :content => "false"
- end
-
- should "work for haml templates" do
- visit '/haml/content_for'
- assert_have_selector '.demo_has_content', :content => "true"
- assert_have_selector '.fake_has_content', :content => "false"
- end
-
- should "work for slim templates" do
- visit '/slim/content_for'
- assert_have_selector '.demo_has_content', :content => "true"
- assert_have_selector '.fake_has_content', :content => "false"
- end
- end # content_for?
-
- context 'for #capture_html method' do
- should "work for erb templates" do
- visit '/erb/capture_concat'
- assert_have_selector 'p span', :content => "Captured Line 1"
- assert_have_selector 'p span', :content => "Captured Line 2"
- end
-
- should "work for haml templates" do
- visit '/haml/capture_concat'
- assert_have_selector 'p span', :content => "Captured Line 1"
- assert_have_selector 'p span', :content => "Captured Line 2"
- end
-
- should "work for slim templates" do
- visit '/slim/capture_concat'
- assert_have_selector 'p span', :content => "Captured Line 1"
- assert_have_selector 'p span', :content => "Captured Line 2"
- end
- end
-
- context 'for #concat_content method' do
- should "work for erb templates" do
- visit '/erb/capture_concat'
- assert_have_selector 'p', :content => "Concat Line 3", :count => 1
- end
-
- should "work for haml templates" do
- visit '/haml/capture_concat'
- assert_have_selector 'p', :content => "Concat Line 3", :count => 1
- end
-
- should "work for slim templates" do
- visit '/slim/capture_concat'
- assert_have_selector 'p', :content => "Concat Line 3", :count => 1
- end
- end
-
- context 'for #block_is_template?' do
- should "work for erb templates" do
- visit '/erb/capture_concat'
- assert_have_selector 'p', :content => "The erb block passed in is a template", :class => 'is_template'
- # TODO Get ERB template detection working (fix block_is_erb? method)
- # assert_have_no_selector 'p', :content => "The ruby block passed in is a template", :class => 'is_template'
- end
-
- should "work for haml templates" do
- visit '/haml/capture_concat'
- assert_have_selector 'p', :content => "The haml block passed in is a template", :class => 'is_template'
- assert_have_no_selector 'p', :content => "The ruby block passed in is a template", :class => 'is_template'
- end
-
- should_eventually "work for slim templates" do
- visit '/slim/capture_concat'
- assert_have_selector 'p', :content => "The slim block passed in is a template", :class => 'is_template'
- # TODO Get SLIM template detection working (fix block_is_erb? method)
- # assert_have_no_selector 'p', :content => "The ruby block passed in is a template", :class => 'is_template'
- end
- end
-
- context 'for #current_engine method' do
- should 'detect correctly current engine for erb' do
- visit '/erb/current_engine'
- assert_have_selector 'p.start', :content => "erb"
- assert_have_selector 'p.haml', :content => "haml"
- assert_have_selector 'p.erb', :content => "erb"
- assert_have_selector 'p.slim', :content => "slim"
- assert_have_selector 'p.end', :content => "erb"
- end
-
- should 'detect correctly current engine for haml' do
- visit '/haml/current_engine'
- assert_have_selector 'p.start', :content => "haml"
- assert_have_selector 'p.haml', :content => "haml"
- assert_have_selector 'p.erb', :content => "erb"
- assert_have_selector 'p.slim', :content => "slim"
- assert_have_selector 'p.end', :content => "haml"
- end
-
- should 'detect correctly current engine for slim' do
- visit '/slim/current_engine'
- assert_have_selector 'p.start', :content => "slim"
- assert_have_selector 'p.haml', :content => "haml"
- assert_have_selector 'p.erb', :content => "erb"
- assert_have_selector 'p.slim', :content => "slim"
- assert_have_selector 'p.end', :content => "slim"
- end
- end
-
- context 'for #partial method in simple sinatra application' do
- should 'properly output in erb' do
- visit '/erb/simple_partial'
- assert_have_selector 'p.erb', :content => "erb"
- end
-
- should 'properly output in haml' do
- visit '/haml/simple_partial'
- assert_have_selector 'p.haml', :content => "haml"
- end
-
- should 'properly output in slim' do
- visit '/slim/simple_partial'
- assert_have_selector 'p.slim', :content => "slim"
- end
- end
-end
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_render_helpers.rb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_render_helpers.rb
deleted file mode 100644
index 68bc6538..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_render_helpers.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/helper')
-require File.expand_path(File.dirname(__FILE__) + '/fixtures/render_app/app')
-
-describe "RenderHelpers" do
- def app
- RenderDemo.tap { |app| app.set :environment, :test }
- end
-
- context 'for #partial method and object' do
- setup { visit '/partial/object' }
- should "render partial html with object" do
- assert_have_selector "h1", :content => "User name is John"
- end
- should "have no counter index for single item" do
- assert_have_no_selector "p", :content => "My counter is 1", :count => 1
- end
- should "include extra locals information" do
- assert_have_selector 'p', :content => "Extra is bar"
- end
- end
-
- context 'for #partial method and collection' do
- setup { visit '/partial/collection' }
- should "render partial html with collection" do
- assert_have_selector "h1", :content => "User name is John"
- assert_have_selector "h1", :content => "User name is Billy"
- end
- should "include counter which contains item index" do
- assert_have_selector "p", :content => "My counter is 1"
- assert_have_selector "p", :content => "My counter is 2"
- end
- should "include extra locals information" do
- assert_have_selector 'p', :content => "Extra is bar"
- end
- end
-
- context 'for #partial method and locals' do
- setup { visit '/partial/locals' }
- should "render partial html with locals" do
- assert_have_selector "h1", :content => "User name is John"
- end
- should "have no counter index for single item" do
- assert_have_no_selector "p", :content => "My counter is 1", :count => 1
- end
- should "include extra locals information" do
- assert_have_selector 'p', :content => "Extra is bar"
- end
- end
-
- context 'for #partial method taking a path starting with forward slash' do
- setup { visit '/partial/foward_slash' }
- should "render partial without throwing an error" do
- assert_have_selector "h1", :content => "User name is John"
- end
- end
-
- context 'for #current_engine method' do
- should 'detect correctly current engine for a padrino application' do
- visit '/current_engine'
- assert_have_selector 'p.start', :content => "haml"
- assert_have_selector 'p.haml span', :content => "haml"
- assert_have_selector 'p.erb span', :content => "erb"
- assert_have_selector 'p.slim span', :content => "slim"
- assert_have_selector 'p.end', :content => "haml"
- end
-
- should "detect correctly current engine for explicit engine on partials" do
- visit '/explicit_engine'
- assert_have_selector 'p.start', :content => "haml"
- assert_have_selector 'p.haml span', :content => "haml"
- assert_have_selector 'p.erb span', :content => "erb"
- assert_have_selector 'p.slim span', :content => "slim"
- assert_have_selector 'p.end', :content => "haml"
- end
- end
-end
diff --git a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_tag_helpers.rb b/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_tag_helpers.rb
deleted file mode 100644
index 494d9d30..00000000
--- a/middleman-core/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_tag_helpers.rb
+++ /dev/null
@@ -1,106 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + '/helper')
-require File.expand_path(File.dirname(__FILE__) + '/fixtures/markup_app/app')
-
-describe "TagHelpers" do
- def app
- MarkupDemo.tap { |app| app.set :environment, :test }
- end
-
- context 'for #tag method' do
- should("support tags with no content no attributes") do
- assert_has_tag(:br) { tag(:br) }
- end
-
- should("support tags with no content with attributes") do
- actual_html = tag(:br, :style => 'clear:both', :class => 'yellow')
- assert_has_tag(:br, :class => 'yellow', :style=>'clear:both') { actual_html }
- end
-
- should "support selected attribute by using 'selected' if true" do
- actual_html = tag(:option, :selected => true)
- assert_has_tag('option', :selected => 'selected') { actual_html }
- end
-
- should "support data attributes" do
- actual_html = tag(:a, :data => { :remote => true, :method => 'post'})
- assert_has_tag(:a, 'data-remote' => 'true', 'data-method' => 'post') { actual_html }
- end
-
- should "support nested attributes" do
- actual_html = tag(:div, :data => {:dojo => {:type => 'dijit.form.TextBox', :props => 'readOnly: true'}})
- assert_has_tag(:div, 'data-dojo-type' => 'dijit.form.TextBox', 'data-dojo-props' => 'readOnly: true') { actual_html }
- end
-
- should "support open tags" do
- actual_html = tag(:p, { :class => 'demo' }, true)
- assert_equal "", actual_html
- end
-
- should "escape html" do
- actual_html = tag(:br, :class => 'Example "bar"')
- assert_equal "
", actual_html
- end
- end
-
- context 'for #content_tag method' do
- should "support tags with content as parameter" do
- actual_html = content_tag(:p, "Demo", :class => 'large', :id => 'thing')
- assert_has_tag('p.large#thing', :content => "Demo") { actual_html }
- end
-
- should "support tags with content as block" do
- actual_html = content_tag(:p, :class => 'large', :id => 'star') { "Demo" }
- assert_has_tag('p.large#star', :content => "Demo") { actual_html }
- end
-
- should "support tags with erb" do
- visit '/erb/content_tag'
- assert_have_selector :p, :content => "Test 1", :class => 'test', :id => 'test1'
- assert_have_selector :p, :content => "Test 2"
- assert_have_selector :p, :content => "Test 3"
- assert_have_selector :p, :content => "Test 4"
- end
-
- should "support tags with haml" do
- visit '/haml/content_tag'
- assert_have_selector :p, :content => "Test 1", :class => 'test', :id => 'test1'
- assert_have_selector :p, :content => "Test 2"
- assert_have_selector :p, :content => "Test 3", :class => 'test', :id => 'test3'
- assert_have_selector :p, :content => "Test 4"
- end
-
- should "support tags with slim" do
- visit '/slim/content_tag'
- assert_have_selector :p, :content => "Test 1", :class => 'test', :id => 'test1'
- assert_have_selector :p, :content => "Test 2"
- assert_have_selector :p, :content => "Test 3", :class => 'test', :id => 'test3'
- assert_have_selector :p, :content => "Test 4"
- end
- end
-
- context 'for #input_tag method' do
- should "support field with type" do
- assert_has_tag('input[type=text]') { input_tag(:text) }
- end
-
- should "support field with type and options" do
- actual_html = input_tag(:text, :class => "first", :id => 'texter')
- assert_has_tag('input.first#texter[type=text]') { actual_html }
- end
-
- should "support checked attribute by using 'checked' if true" do
- actual_html = input_tag(:checkbox, :checked => true)
- assert_has_tag('input[type=checkbox]', :checked => 'checked') { actual_html }
- end
-
- should "remove checked attribute if false" do
- actual_html = input_tag(:checkbox, :checked => false)
- assert_has_no_tag('input[type=checkbox][checked=false]') { actual_html }
- end
-
- should "support disabled attribute by using 'disabled' if true" do
- actual_html = input_tag(:checkbox, :disabled => true)
- assert_has_tag('input[type=checkbox]', :disabled => 'disabled') { actual_html }
- end
- end
-end
diff --git a/middleman-core/middleman-core.gemspec b/middleman-core/middleman-core.gemspec
index 88bd62fb..ea73840d 100644
--- a/middleman-core/middleman-core.gemspec
+++ b/middleman-core/middleman-core.gemspec
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
# Helpers
s.add_dependency("activesupport", ["~> 3.2.0"])
+ s.add_dependency("padrino-helpers", ["~> 0.10.6"])
# Watcher
s.add_dependency("listen", ["~> 0.4.1"])