best_in_placeish 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,32 +1,32 @@
1
- # encoding: utf-8
2
- require "spec_helper"
3
-
4
- describe "Double initialization bug", :js => true do
5
- before do
6
- @user = User.new :name => "Lucia",
7
- :last_name => "Napoli",
8
- :email => "lucianapoli@gmail.com",
9
- :address => "Via Roma 99",
10
- :zip => "25123",
11
- :country => "2",
12
- :receive_email => false,
13
- :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."
14
- end
15
-
16
- it "should be able to change a boolean value" do
17
- @user.save!
18
- visit double_init_user_path(@user)
19
-
20
- within("#receive_email") do
21
- page.should have_content("No thanks")
22
- end
23
-
24
- bip_bool @user, :receive_email
25
-
26
- visit double_init_user_path(@user)
27
- within("#receive_email") do
28
- page.should have_content("Yes of course")
29
- end
30
-
31
- end
32
- end
1
+ # encoding: utf-8
2
+ require "spec_helper"
3
+
4
+ describe "Double initialization bug", :js => true do
5
+ before do
6
+ @user = User.new :name => "Lucia",
7
+ :last_name => "Napoli",
8
+ :email => "lucianapoli@gmail.com",
9
+ :address => "Via Roma 99",
10
+ :zip => "25123",
11
+ :country => "2",
12
+ :receive_email => false,
13
+ :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."
14
+ end
15
+
16
+ it "should be able to change a boolean value" do
17
+ @user.save!
18
+ visit double_init_user_path(@user)
19
+
20
+ within("#receive_email") do
21
+ page.should have_content("No thanks")
22
+ end
23
+
24
+ bip_bool @user, :receive_email
25
+
26
+ visit double_init_user_path(@user)
27
+ within("#receive_email") do
28
+ page.should have_content("Yes of course")
29
+ end
30
+
31
+ end
32
+ end
@@ -1,165 +1,165 @@
1
- # encoding: utf-8
2
- require "spec_helper"
3
-
4
- describe "JS behaviour", :js => true do
5
- before do
6
- @user = User.new :name => "Lucia",
7
- :last_name => "Napoli",
8
- :email => "lucianapoli@gmail.com",
9
- :address => "Via Roma 99",
10
- :zip => "25123",
11
- :country => "2",
12
- :receive_email => false,
13
- :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."
14
- end
15
-
16
- describe "nil option" do
17
- it "should render the default '-' string when the field is empty" do
18
- @user.name = ""
19
- @user.save :validate => false
20
- visit user_path(@user)
21
-
22
- within("#name") do
23
- page.should have_content("-")
24
- end
25
- end
26
-
27
- it "should render the passed nil value if the field is empty" do
28
- @user.last_name = ""
29
- @user.save :validate => false
30
- visit user_path(@user)
31
-
32
- within("#last_name") do
33
- page.should have_content("Nothing to show")
34
- end
35
- end
36
- end
37
-
38
- it "should be able to use bip_text to update a text field" do
39
- @user.save!
40
- visit user_path(@user)
41
- within("#email") do
42
- page.should have_content("lucianapoli@gmail.com")
43
- end
44
-
45
- bip_text @user, :email, "new@email.com"
46
-
47
- visit user_path(@user)
48
- within("#email") do
49
- page.should have_content("new@email.com")
50
- end
51
- end
52
-
53
- it "should be able to update a field two consecutive times" do
54
- @user.save!
55
- visit user_path(@user)
56
-
57
- bip_text @user, :email, "new@email.com"
58
-
59
- within("#email") do
60
- page.should have_content("new@email.com")
61
- end
62
-
63
- bip_text @user, :email, "new_two@email.com"
64
-
65
- within("#email") do
66
- page.should have_content("new_two@email.com")
67
- end
68
-
69
- visit user_path(@user)
70
- within("#email") do
71
- page.should have_content("new_two@email.com")
72
- end
73
- end
74
-
75
- it "should be able to update a field after an error" do
76
- @user.save!
77
- visit user_path(@user)
78
-
79
- bip_text @user, :email, "wrong format"
80
- page.should have_content("Email has wrong email format")
81
-
82
- bip_text @user, :email, "another@email.com"
83
- within("#email") do
84
- page.should have_content("another@email.com")
85
- end
86
-
87
- visit user_path(@user)
88
- within("#email") do
89
- page.should have_content("another@email.com")
90
- end
91
- end
92
-
93
- it "should be able to use bil_select to change a select field" do
94
- @user.save!
95
- visit user_path(@user)
96
- within("#country") do
97
- page.should have_content("Italy")
98
- end
99
-
100
- bip_select @user, :country, "France"
101
-
102
- visit user_path(@user)
103
- within("#country") do
104
- page.should have_content("France")
105
- end
106
- end
107
-
108
- it "should be able to use bip_bool to change a boolean value" do
109
- @user.save!
110
- visit user_path(@user)
111
-
112
- within("#receive_email") do
113
- page.should have_content("No thanks")
114
- end
115
-
116
- bip_bool @user, :receive_email
117
-
118
- visit user_path(@user)
119
- within("#receive_email") do
120
- page.should have_content("Yes of course")
121
- end
122
- end
123
-
124
- it "should show validation errors" do
125
- @user.save!
126
- visit user_path(@user)
127
-
128
- bip_text @user, :address, ""
129
- page.should have_content("Address can't be blank")
130
- within("#address") do
131
- page.should have_content("Via Roma 99")
132
- end
133
- end
134
-
135
- it "should show validation errors using respond_with in the controller" do
136
- @user.save!
137
- visit user_path(@user)
138
-
139
- bip_text @user, :last_name, "a"
140
- page.should have_content("last_name has invalid length")
141
- end
142
-
143
- it "should be able to update a field after an error using respond_with in the controller" do
144
- @user.save!
145
- visit user_path(@user)
146
-
147
- bip_text @user, :last_name, "a"
148
-
149
- within("#last_name") do
150
- page.should have_content("Napoli")
151
- end
152
-
153
- bip_text @user, :last_name, "Another"
154
-
155
- within("#last_name") do
156
- page.should have_content("Another")
157
- end
158
-
159
- visit user_path(@user)
160
- within("#last_name") do
161
- page.should have_content("Another")
162
- end
163
- end
164
- end
165
-
1
+ # encoding: utf-8
2
+ require "spec_helper"
3
+
4
+ describe "JS behaviour", :js => true do
5
+ before do
6
+ @user = User.new :name => "Lucia",
7
+ :last_name => "Napoli",
8
+ :email => "lucianapoli@gmail.com",
9
+ :address => "Via Roma 99",
10
+ :zip => "25123",
11
+ :country => "2",
12
+ :receive_email => false,
13
+ :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."
14
+ end
15
+
16
+ describe "nil option" do
17
+ it "should render the default '-' string when the field is empty" do
18
+ @user.name = ""
19
+ @user.save :validate => false
20
+ visit user_path(@user)
21
+
22
+ within("#name") do
23
+ page.should have_content("-")
24
+ end
25
+ end
26
+
27
+ it "should render the passed nil value if the field is empty" do
28
+ @user.last_name = ""
29
+ @user.save :validate => false
30
+ visit user_path(@user)
31
+
32
+ within("#last_name") do
33
+ page.should have_content("Nothing to show")
34
+ end
35
+ end
36
+ end
37
+
38
+ it "should be able to use bip_text to update a text field" do
39
+ @user.save!
40
+ visit user_path(@user)
41
+ within("#email") do
42
+ page.should have_content("lucianapoli@gmail.com")
43
+ end
44
+
45
+ bip_text @user, :email, "new@email.com"
46
+
47
+ visit user_path(@user)
48
+ within("#email") do
49
+ page.should have_content("new@email.com")
50
+ end
51
+ end
52
+
53
+ it "should be able to update a field two consecutive times" do
54
+ @user.save!
55
+ visit user_path(@user)
56
+
57
+ bip_text @user, :email, "new@email.com"
58
+
59
+ within("#email") do
60
+ page.should have_content("new@email.com")
61
+ end
62
+
63
+ bip_text @user, :email, "new_two@email.com"
64
+
65
+ within("#email") do
66
+ page.should have_content("new_two@email.com")
67
+ end
68
+
69
+ visit user_path(@user)
70
+ within("#email") do
71
+ page.should have_content("new_two@email.com")
72
+ end
73
+ end
74
+
75
+ it "should be able to update a field after an error" do
76
+ @user.save!
77
+ visit user_path(@user)
78
+
79
+ bip_text @user, :email, "wrong format"
80
+ page.should have_content("Email has wrong email format")
81
+
82
+ bip_text @user, :email, "another@email.com"
83
+ within("#email") do
84
+ page.should have_content("another@email.com")
85
+ end
86
+
87
+ visit user_path(@user)
88
+ within("#email") do
89
+ page.should have_content("another@email.com")
90
+ end
91
+ end
92
+
93
+ it "should be able to use bil_select to change a select field" do
94
+ @user.save!
95
+ visit user_path(@user)
96
+ within("#country") do
97
+ page.should have_content("Italy")
98
+ end
99
+
100
+ bip_select @user, :country, "France"
101
+
102
+ visit user_path(@user)
103
+ within("#country") do
104
+ page.should have_content("France")
105
+ end
106
+ end
107
+
108
+ it "should be able to use bip_bool to change a boolean value" do
109
+ @user.save!
110
+ visit user_path(@user)
111
+
112
+ within("#receive_email") do
113
+ page.should have_content("No thanks")
114
+ end
115
+
116
+ bip_bool @user, :receive_email
117
+
118
+ visit user_path(@user)
119
+ within("#receive_email") do
120
+ page.should have_content("Yes of course")
121
+ end
122
+ end
123
+
124
+ it "should show validation errors" do
125
+ @user.save!
126
+ visit user_path(@user)
127
+
128
+ bip_text @user, :address, ""
129
+ page.should have_content("Address can't be blank")
130
+ within("#address") do
131
+ page.should have_content("Via Roma 99")
132
+ end
133
+ end
134
+
135
+ it "should show validation errors using respond_with in the controller" do
136
+ @user.save!
137
+ visit user_path(@user)
138
+
139
+ bip_text @user, :last_name, "a"
140
+ page.should have_content("last_name has invalid length")
141
+ end
142
+
143
+ it "should be able to update a field after an error using respond_with in the controller" do
144
+ @user.save!
145
+ visit user_path(@user)
146
+
147
+ bip_text @user, :last_name, "a"
148
+
149
+ within("#last_name") do
150
+ page.should have_content("Napoli")
151
+ end
152
+
153
+ bip_text @user, :last_name, "Another"
154
+
155
+ within("#last_name") do
156
+ page.should have_content("Another")
157
+ end
158
+
159
+ visit user_path(@user)
160
+ within("#last_name") do
161
+ page.should have_content("Another")
162
+ end
163
+ end
164
+ end
165
+
@@ -1,30 +1,30 @@
1
- # encoding: utf-8
2
- require "spec_helper"
3
-
4
- describe "JS behaviour", :js => true do
5
- before do
6
- @user = User.new :name => "Lucia",
7
- :last_name => "Napoli",
8
- :email => "lucianapoli@gmail.com",
9
- :address => "Via Roma 99",
10
- :zip => "25123",
11
- :country => "2",
12
- :receive_email => false,
13
- :description => "User description"
14
- end
15
-
16
- it "should be able to use bip_text to update a text area" do
17
- @user.save!
18
- visit user_path(@user)
19
- within("#description") do
20
- page.should have_content("User description")
21
- end
22
-
23
- bip_area @user, :description, "A new description"
24
-
25
- visit user_path(@user)
26
- within("#description") do
27
- page.should have_content("A new description")
28
- end
29
- end
30
- end
1
+ # encoding: utf-8
2
+ require "spec_helper"
3
+
4
+ describe "JS behaviour", :js => true do
5
+ before do
6
+ @user = User.new :name => "Lucia",
7
+ :last_name => "Napoli",
8
+ :email => "lucianapoli@gmail.com",
9
+ :address => "Via Roma 99",
10
+ :zip => "25123",
11
+ :country => "2",
12
+ :receive_email => false,
13
+ :description => "User description"
14
+ end
15
+
16
+ it "should be able to use bip_text to update a text area" do
17
+ @user.save!
18
+ visit user_path(@user)
19
+ within("#description") do
20
+ page.should have_content("User description")
21
+ end
22
+
23
+ bip_area @user, :description, "A new description"
24
+
25
+ visit user_path(@user)
26
+ within("#description") do
27
+ page.should have_content("A new description")
28
+ end
29
+ end
30
+ end