forked from bernat/best_in_place
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a failing spec to show the double initialization bug
- Loading branch information
Roger Campos
committed
Oct 24, 2011
1 parent
8841d94
commit 6a0ebdb
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# encoding: utf-8 | ||
require "spec_helper" | ||
|
||
describe "Double initialization bug", :js => true do | ||
before do | ||
@user = User.new :name => "Lucia", | ||
:last_name => "Napoli", | ||
:email => "lucianapoli@gmail.com", | ||
:address => "Via Roma 99", | ||
:zip => "25123", | ||
:country => "2", | ||
:receive_email => false, | ||
:description => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus a lectus et lacus ultrices auctor. Morbi aliquet convallis tincidunt. Praesent enim libero, iaculis at commodo nec, fermentum a dolor. Quisque eget eros id felis lacinia faucibus feugiat et ante. Aenean justo nisi, aliquam vel egestas vel, porta in ligula. Etiam molestie, lacus eget tincidunt accumsan, elit justo rhoncus urna, nec pretium neque mi et lorem. Aliquam posuere, dolor quis pulvinar luctus, felis dolor tincidunt leo, eget pretium orci purus ac nibh. Ut enim sem, suscipit ac elementum vitae, sodales vel sem." | ||
end | ||
|
||
it "should be able to change a boolean value" do | ||
@user.save! | ||
visit double_init_user_path(@user) | ||
|
||
within("#receive_email") do | ||
page.should have_content("No thanks") | ||
end | ||
|
||
bip_bool :user, :receive_email | ||
|
||
visit double_init_user_path(@user) | ||
within("#receive_email") do | ||
page.should have_content("Yes of course") | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<p>This is a page that initializes best in place two times with testing purposes</p> | ||
<div id="user_account"> | ||
<h1>User details</h1> | ||
<%= link_to "Go back to USERS", users_path %> | ||
<p style="margin-left:48em">Click to edit</p> | ||
<table> | ||
<tr> | ||
<td>Name <a id="editme" href="#">(edit me)</a></td> | ||
<td id="name"> | ||
<%= best_in_place @user, :name, :type => :input, :activator => "#editme" %> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Last Name</td> | ||
<td id="last_name"> | ||
<%= best_in_place @user, :last_name, :nil => "Nothing to show", :path => test_respond_with_user_path(@user) %> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Email</td> | ||
<td id="email"> | ||
<%= best_in_place @user, :email %> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Address</td> | ||
<td id="address"> | ||
<%= best_in_place @user, :address %> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>ZIP</td> | ||
<td id="zip"> | ||
<%= best_in_place @user, :zip %> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Country</td> | ||
<td id="country"> | ||
<%= best_in_place @user, :country, :type => :select, :collection => @countries %> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Receive newsletter?</td> | ||
<td id="receive_email"> | ||
<%= best_in_place @user, :receive_email, :type => :checkbox, :collection => ["No thanks", "Yes of course"] %> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>User description</td> | ||
<td id="description"> | ||
<%= best_in_place @user, :description, :type => :textarea, :sanitize => false %> | ||
</td> | ||
</table> | ||
<br /> | ||
<hr /> | ||
|
||
</div> | ||
|
||
<%= javascript_tag do %> | ||
$(document).ready(function() { | ||
/* Activating Best In Place */ | ||
jQuery(".best_in_place").best_in_place(); | ||
}); | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
resources :users do | ||
member do | ||
put :test_respond_with | ||
get :double_init | ||
end | ||
end | ||
|
||
|