admin_assistant 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. data/Rakefile +2 -2
  2. data/VERSION +1 -1
  3. data/admin_assistant.gemspec +2 -171
  4. metadata +4 -173
  5. data/rails_3_0/Gemfile +0 -12
  6. data/rails_3_0/Gemfile.lock +0 -100
  7. data/rails_3_0/README +0 -256
  8. data/rails_3_0/Rakefile +0 -7
  9. data/rails_3_0/app/controllers/admin/appointments2_controller.rb +0 -15
  10. data/rails_3_0/app/controllers/admin/appointments_controller.rb +0 -11
  11. data/rails_3_0/app/controllers/admin/blog_posts2_controller.rb +0 -138
  12. data/rails_3_0/app/controllers/admin/blog_posts3_controller.rb +0 -76
  13. data/rails_3_0/app/controllers/admin/blog_posts4_controller.rb +0 -21
  14. data/rails_3_0/app/controllers/admin/blog_posts5_controller.rb +0 -27
  15. data/rails_3_0/app/controllers/admin/blog_posts6_controller.rb +0 -10
  16. data/rails_3_0/app/controllers/admin/blog_posts_controller.rb +0 -9
  17. data/rails_3_0/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb +0 -15
  18. data/rails_3_0/app/controllers/admin/blog_posts_read_only_controller.rb +0 -19
  19. data/rails_3_0/app/controllers/admin/bookmarks_controller.rb +0 -11
  20. data/rails_3_0/app/controllers/admin/comments2_controller.rb +0 -14
  21. data/rails_3_0/app/controllers/admin/comments_controller.rb +0 -12
  22. data/rails_3_0/app/controllers/admin/images2_controller.rb +0 -11
  23. data/rails_3_0/app/controllers/admin/images_controller.rb +0 -6
  24. data/rails_3_0/app/controllers/admin/misconfigured1_controller.rb +0 -7
  25. data/rails_3_0/app/controllers/admin/not_migrated_yets_controller.rb +0 -9
  26. data/rails_3_0/app/controllers/admin/product_categories2_controller.rb +0 -7
  27. data/rails_3_0/app/controllers/admin/product_categories_controller.rb +0 -5
  28. data/rails_3_0/app/controllers/admin/television_airings_controller.rb +0 -5
  29. data/rails_3_0/app/controllers/admin/television_time_slots_controller.rb +0 -5
  30. data/rails_3_0/app/controllers/admin/users2_controller.rb +0 -10
  31. data/rails_3_0/app/controllers/admin/users_controller.rb +0 -48
  32. data/rails_3_0/app/controllers/application_controller.rb +0 -7
  33. data/rails_3_0/app/controllers/blog_posts_controller.rb +0 -5
  34. data/rails_3_0/app/helpers/admin/appointments_helper.rb +0 -2
  35. data/rails_3_0/app/helpers/admin/blog_posts2_helper.rb +0 -27
  36. data/rails_3_0/app/helpers/admin/blog_posts3_helper.rb +0 -2
  37. data/rails_3_0/app/helpers/admin/blog_posts4_helper.rb +0 -2
  38. data/rails_3_0/app/helpers/admin/blog_posts6_helper.rb +0 -13
  39. data/rails_3_0/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb +0 -29
  40. data/rails_3_0/app/helpers/admin/blog_posts_helper.rb +0 -2
  41. data/rails_3_0/app/helpers/admin/blog_posts_read_only_helper.rb +0 -2
  42. data/rails_3_0/app/helpers/admin/bookmarks_helper.rb +0 -2
  43. data/rails_3_0/app/helpers/admin/comments2_helper.rb +0 -2
  44. data/rails_3_0/app/helpers/admin/comments_helper.rb +0 -2
  45. data/rails_3_0/app/helpers/admin/images2_helper.rb +0 -8
  46. data/rails_3_0/app/helpers/admin/images_helper.rb +0 -2
  47. data/rails_3_0/app/helpers/admin/misconfigured1_helper.rb +0 -2
  48. data/rails_3_0/app/helpers/admin/not_migrated_yets_helper.rb +0 -2
  49. data/rails_3_0/app/helpers/admin/product_categories2_helper.rb +0 -2
  50. data/rails_3_0/app/helpers/admin/product_categories_helper.rb +0 -2
  51. data/rails_3_0/app/helpers/admin/television_airings_helper.rb +0 -2
  52. data/rails_3_0/app/helpers/admin/television_time_slots_helper.rb +0 -2
  53. data/rails_3_0/app/helpers/admin/users2_helper.rb +0 -2
  54. data/rails_3_0/app/helpers/admin/users_helper.rb +0 -13
  55. data/rails_3_0/app/helpers/application_helper.rb +0 -2
  56. data/rails_3_0/app/models/appointment.rb +0 -5
  57. data/rails_3_0/app/models/blog_post.rb +0 -14
  58. data/rails_3_0/app/models/blog_post_tag.rb +0 -6
  59. data/rails_3_0/app/models/bookmark.rb +0 -6
  60. data/rails_3_0/app/models/comment.rb +0 -4
  61. data/rails_3_0/app/models/image.rb +0 -3
  62. data/rails_3_0/app/models/not_migrated_yet.rb +0 -2
  63. data/rails_3_0/app/models/product.rb +0 -5
  64. data/rails_3_0/app/models/product_category.rb +0 -9
  65. data/rails_3_0/app/models/tag.rb +0 -4
  66. data/rails_3_0/app/models/television_airing.rb +0 -3
  67. data/rails_3_0/app/models/television_time_slot.rb +0 -11
  68. data/rails_3_0/app/models/user.rb +0 -11
  69. data/rails_3_0/app/views/admin/appointments/_subject_input.html.erb +0 -2
  70. data/rails_3_0/app/views/admin/appointments2/_time_input.html.erb +0 -31
  71. data/rails_3_0/app/views/admin/blog_posts2/_after_form.html.erb +0 -5
  72. data/rails_3_0/app/views/admin/blog_posts2/_after_index.html.erb +0 -1
  73. data/rails_3_0/app/views/admin/blog_posts2/_after_tags_input.html.erb +0 -16
  74. data/rails_3_0/app/views/admin/blog_posts2/_before_index.html.erb +0 -2
  75. data/rails_3_0/app/views/admin/blog_posts5/_after_index_header.html.erb +0 -8
  76. data/rails_3_0/app/views/admin/blog_posts_read_only/_body_for_show.html.erb +0 -1
  77. data/rails_3_0/app/views/layouts/admin.html.erb +0 -32
  78. data/rails_3_0/app/views/layouts/application.html.erb +0 -14
  79. data/rails_3_0/config.ru +0 -4
  80. data/rails_3_0/config/application.rb +0 -42
  81. data/rails_3_0/config/boot.rb +0 -6
  82. data/rails_3_0/config/database.yml +0 -22
  83. data/rails_3_0/config/environment.rb +0 -5
  84. data/rails_3_0/config/environments/development.rb +0 -25
  85. data/rails_3_0/config/environments/production.rb +0 -49
  86. data/rails_3_0/config/environments/test.rb +0 -35
  87. data/rails_3_0/config/initializers/backtrace_silencers.rb +0 -7
  88. data/rails_3_0/config/initializers/inflections.rb +0 -10
  89. data/rails_3_0/config/initializers/mime_types.rb +0 -5
  90. data/rails_3_0/config/initializers/secret_token.rb +0 -7
  91. data/rails_3_0/config/initializers/session_store.rb +0 -8
  92. data/rails_3_0/config/locales/en.yml +0 -5
  93. data/rails_3_0/config/routes.rb +0 -8
  94. data/rails_3_0/db/migrate/20090213215514_create_blog_posts.rb +0 -12
  95. data/rails_3_0/db/migrate/20090217225542_add_body_to_blog_posts.rb +0 -9
  96. data/rails_3_0/db/migrate/20090221220917_create_tags.rb +0 -13
  97. data/rails_3_0/db/migrate/20090221220947_create_blog_post_tags.rb +0 -14
  98. data/rails_3_0/db/migrate/20090222162204_add_textile_to_blog_posts.rb +0 -9
  99. data/rails_3_0/db/migrate/20090222163231_add_published_at_to_blog_posts.rb +0 -9
  100. data/rails_3_0/db/migrate/20090301191722_create_images.rb +0 -16
  101. data/rails_3_0/db/migrate/20090305165345_create_accounts.rb +0 -14
  102. data/rails_3_0/db/migrate/20090307225027_rename_accounts_to_users.rb +0 -9
  103. data/rails_3_0/db/migrate/20090307225750_add_user_id_to_blog_posts.rb +0 -9
  104. data/rails_3_0/db/migrate/20090309185114_change_blog_posts_textile.rb +0 -9
  105. data/rails_3_0/db/migrate/20090309193635_create_products.rb +0 -14
  106. data/rails_3_0/db/migrate/20090309203056_create_comments.rb +0 -15
  107. data/rails_3_0/db/migrate/20090323005947_create_file_column_images.rb +0 -12
  108. data/rails_3_0/db/migrate/20090326160049_add_birthday_to_users.rb +0 -9
  109. data/rails_3_0/db/migrate/20090326223606_add_state_to_users.rb +0 -9
  110. data/rails_3_0/db/migrate/20090503134004_add_file_column_image_to_products.rb +0 -9
  111. data/rails_3_0/db/migrate/20090617173651_create_bookmarks.rb +0 -15
  112. data/rails_3_0/db/migrate/20090624165355_add_tags_string_to_blog_post.rb +0 -9
  113. data/rails_3_0/db/migrate/20090625144313_add_avatar_fields_to_user.rb +0 -11
  114. data/rails_3_0/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb +0 -9
  115. data/rails_3_0/db/migrate/20090701171857_add_force_textile_to_users.rb +0 -9
  116. data/rails_3_0/db/migrate/20090704163647_add_deleted_at_to_products.rb +0 -9
  117. data/rails_3_0/db/migrate/20090704173800_add_sale_fields_to_products.rb +0 -13
  118. data/rails_3_0/db/migrate/20090714024501_create_product_categories.rb +0 -15
  119. data/rails_3_0/db/migrate/20090819162835_add_admin_level_to_users.rb +0 -9
  120. data/rails_3_0/db/migrate/20091115134559_add_first_and_last_names_to_users.rb +0 -11
  121. data/rails_3_0/db/migrate/20091221011256_add_position_to_product_categories.rb +0 -9
  122. data/rails_3_0/db/migrate/20091222160814_create_appointments.rb +0 -14
  123. data/rails_3_0/db/migrate/20091227224547_add_user_id_to_appointments.rb +0 -9
  124. data/rails_3_0/db/migrate/20100214213359_create_television_time_slots.rb +0 -13
  125. data/rails_3_0/db/migrate/20100214213451_create_television_airings.rb +0 -15
  126. data/rails_3_0/db/migrate/20110426215702_remove_avatar_fields_from_users.rb +0 -11
  127. data/rails_3_0/db/seeds.rb +0 -7
  128. data/rails_3_0/doc/README_FOR_APP +0 -2
  129. data/rails_3_0/public/404.html +0 -26
  130. data/rails_3_0/public/422.html +0 -26
  131. data/rails_3_0/public/500.html +0 -26
  132. data/rails_3_0/public/favicon.ico +0 -0
  133. data/rails_3_0/public/images/rails.png +0 -0
  134. data/rails_3_0/public/index.html +0 -239
  135. data/rails_3_0/public/javascripts/application.js +0 -2
  136. data/rails_3_0/public/javascripts/jquery-1.4.4.min.js +0 -167
  137. data/rails_3_0/public/javascripts/rails.js +0 -191
  138. data/rails_3_0/public/robots.txt +0 -5
  139. data/rails_3_0/public/stylesheets/admin.css +0 -3
  140. data/rails_3_0/public/stylesheets/scaffold.css +0 -54
  141. data/rails_3_0/script/rails +0 -6
  142. data/rails_3_0/test/data/ruby_throated.jpg +0 -0
  143. data/rails_3_0/test/data/tweenbot.jpg +0 -0
  144. data/rails_3_0/test/fixtures/placeholder.txt +0 -0
  145. data/rails_3_0/test/integration/admin/appointments2_integration_test.rb +0 -79
  146. data/rails_3_0/test/integration/admin/appointments_integration_test.rb +0 -367
  147. data/rails_3_0/test/integration/admin/blog_posts2_integration_test.rb +0 -789
  148. data/rails_3_0/test/integration/admin/blog_posts3_integration_test.rb +0 -418
  149. data/rails_3_0/test/integration/admin/blog_posts4_integration_test.rb +0 -189
  150. data/rails_3_0/test/integration/admin/blog_posts5_integration_test.rb +0 -75
  151. data/rails_3_0/test/integration/admin/blog_posts6_integration_test.rb +0 -39
  152. data/rails_3_0/test/integration/admin/blog_posts_custom_new_and_edit_integration_test.rb +0 -89
  153. data/rails_3_0/test/integration/admin/blog_posts_integration_test.rb +0 -776
  154. data/rails_3_0/test/integration/admin/blog_posts_read_only_integration_test.rb +0 -69
  155. data/rails_3_0/test/integration/admin/bookmarks_integration_test.rb +0 -445
  156. data/rails_3_0/test/integration/admin/comments2_integration_test.rb +0 -52
  157. data/rails_3_0/test/integration/admin/comments_integration_test.rb +0 -50
  158. data/rails_3_0/test/integration/admin/images2_integration_test.rb +0 -33
  159. data/rails_3_0/test/integration/admin/images_integration_test.rb +0 -79
  160. data/rails_3_0/test/integration/admin/misconfigured1_integration_test.rb +0 -21
  161. data/rails_3_0/test/integration/admin/product_categories2_integration_test.rb +0 -179
  162. data/rails_3_0/test/integration/admin/product_categories_integration_test.rb +0 -12
  163. data/rails_3_0/test/integration/admin/television_airings_integration_test.rb +0 -25
  164. data/rails_3_0/test/integration/admin/users2_integration_test.rb +0 -48
  165. data/rails_3_0/test/integration/admin/users_integration_test.rb +0 -182
  166. data/rails_3_0/test/integration/blog_posts_integration_test.rb +0 -10
  167. data/rails_3_0/test/performance/browsing_test.rb +0 -9
  168. data/rails_3_0/test/test_helper.rb +0 -138
  169. data/rails_3_1/Gemfile +0 -12
  170. data/rails_3_1/Gemfile.lock +0 -116
  171. data/rails_3_1/README +0 -256
  172. data/rails_3_1/Rakefile +0 -7
  173. data/rails_3_1/config.ru +0 -4
@@ -1,48 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
2
-
3
- class Admin::Users2IntegrationTest < ActionController::IntegrationTest
4
- def test_index
5
- User.create!(:username => random_word) if User.count == 0
6
- get "/admin/users2"
7
-
8
- # should show the empty search form
9
- assert_select('form#search_form') do
10
- assert_select('input[name=?]', 'search[blog_posts]')
11
- end
12
- end
13
-
14
- def test_index_when_searching_by_blog_post
15
- User.destroy_all
16
- @soren = User.create! :username => 'soren'
17
- @jean_paul = User.create! :username => 'jean_paul'
18
- BlogPost.create!(
19
- :user => @jean_paul, :title => 'No Foobar',
20
- :body => 'Hell is other foobars'
21
- )
22
- @friedrich = User.create! :username => 'friedrich'
23
- BlogPost.create!(
24
- :user => @friedrich, :title => 'Thus Spake Zarafoobar',
25
- :body => 'Man is something that shall be overfoobared.'
26
- )
27
- BlogPost.create!(
28
- :user => @friedrich, :title => 'Beyond Good and Foobar',
29
- :body =>
30
- 'And when you gaze long into a foobar the foobar also gazes into you.'
31
- )
32
- get "/admin/users2", :search => {:blog_posts => 'foobar'}
33
-
34
- # should prefill the search form fields
35
- assert_select('form#search_form') do
36
- assert_select('input[name=?][value=?]', 'search[blog_posts]', 'foobar')
37
- end
38
-
39
- # should not match a user without any matching blog posts
40
- assert_no_match(%r|<td[^>]*>#{@soren.username}</td>|, response.body)
41
-
42
- # should match a user with one matching blog post
43
- assert_select('td', :text => @jean_paul.username)
44
-
45
- # should match a user with two matching blog posts, only presenting that user once
46
- assert_select('td', :text => @friedrich.username, :count => 1)
47
- end
48
- end
@@ -1,182 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
2
-
3
- class Admin::UsersIntegrationTest < ActionController::IntegrationTest
4
- def setup
5
- @user = User.find_or_create_by_username 'betty'
6
- @user.update_attribute :password, 'crocker'
7
- end
8
-
9
- def test_create
10
- post("/admin/users", :user => { :username => 'bill', :password => '' })
11
-
12
- # should assign a new random password
13
- user = User.find_by_username 'bill'
14
- assert_not_nil(user)
15
- assert_not_equal(user.password, '')
16
- end
17
-
18
- def test_create_with_the_same_username
19
- @user_count = User.count
20
- post("/admin/users", :user => {:username => 'betty', :password => ''})
21
-
22
- # should not save a new user
23
- assert_equal(User.count, @user_count)
24
-
25
- # should not call after_save
26
- assert_response :success
27
- end
28
-
29
- def test_destroy
30
- delete "/admin/users/#{@user.id}"
31
-
32
- # should destroy the user
33
- assert_nil(User.find_by_id(@user.id))
34
- end
35
-
36
- def test_edit
37
- @user.update_attributes(:force_blog_posts_to_textile => true)
38
- get "/admin/users/#{@user.id}/edit"
39
-
40
- # should show the default text input for password
41
- assert_match(%r|<input[^>]*name="user\[password\]"|, response.body)
42
-
43
- # should show a reset password checkbox
44
- assert_select("input[type=checkbox][name=reset_password]")
45
-
46
- # should show a drop-down for force_blog_posts_to_textile
47
- assert_select('select[name=?]', 'user[force_blog_posts_to_textile]') do
48
- assert_select "option:not([selected])[value='']"
49
- assert_select "option:not([selected])[value=0]", :text => 'false'
50
- assert_select "option[selected=selected][value=1]", :text => 'true'
51
- end
52
- end
53
-
54
- def test_index
55
- get "/admin/users"
56
-
57
- # should show a Delete link and a link to the profile page
58
- assert_select('td') do
59
- assert_select(
60
- "a.destroy[href=?][data-method=?]",
61
- "/admin/users/#{@user.id}", 'delete',
62
- :text => 'Delete'
63
- )
64
- assert_select(
65
- "a[href=?]",
66
- "/admin/blog_posts/new?blog_post[user_id]=#{@user.id}",
67
- :text => "New blog post"
68
- )
69
- end
70
- end
71
-
72
- def test_index_search
73
- User.destroy_all
74
- @john_doe = User.create! :username => 'johndoe'
75
- @jane_doe = User.create! :username => 'janedoe', :password => "ihatejohn"
76
- get "/admin/users", :search => "john"
77
- assert_response :success
78
-
79
- # should match username
80
- assert_select('td', :text => 'johndoe')
81
-
82
- # should not match password
83
- assert_no_match(%r|<td[^>]*>janedoe</td>|, response.body)
84
- end
85
-
86
- def test_index_search_across_first_name_and_last_name
87
- User.destroy_all
88
- @john_doe = User.create!(
89
- :username => 'johndoe', :first_name => 'john', :last_name => 'doe'
90
- )
91
- get "/admin/users", :search => "john doe"
92
-
93
- # should match
94
- assert_select('td', :text => 'johndoe')
95
- end
96
-
97
- def test_new
98
- get "/admin/users/new"
99
-
100
- # should not show an input for password
101
- assert_match(/autogenerated/, response.body)
102
- assert_no_match(%r|<input[^>]*name="user\[password\]"|, response.body)
103
-
104
- # should not show a reset password checkbox
105
- assert_select("input[type=checkbox][name=reset_password]", false)
106
-
107
- # should use date dropdowns with nil defaults for birthday
108
- nums_and_dt_fields = {1 => :year, 2 => :month, 3 => :day}
109
- nums_and_dt_fields.each do |num, dt_field|
110
- name = "user[birthday(#{num}i)]"
111
- assert_select('select[name=?]', name) do
112
- assert_select "option[value='']"
113
- assert_select(
114
- "option:not([selected])[value=?]", Time.now.send(dt_field).to_s
115
- )
116
- end
117
- end
118
-
119
- # should not try to set an hour or minute for birthday
120
- nums_and_dt_fields = {4 => :hour, 5 => :min}
121
- nums_and_dt_fields.each do |num, dt_field|
122
- name = "blog_post[published_at(#{num}i)]"
123
- assert_select('select[name=?]', name, false)
124
- end
125
-
126
- # should respect start_year and end_year parameters
127
- assert_select("select[name='user[birthday(1i)]']") do
128
- (Time.now.year-100).upto(Time.now.year) do |year|
129
- assert_select "option[value='#{year}']"
130
- end
131
- end
132
-
133
- # should show a drop-down for US states
134
- assert_select('select[name=?]', 'user[state]') do
135
- assert_select "option[value='']"
136
- assert_select "option:not([selected])[value=AK]", :text => 'Alaska'
137
- assert_select "option:not([selected])[value=NY]", :text => 'New York'
138
- # blank option, 50 states, DC, Puerto Rico == 53 options
139
- assert_select "option", :count => 53
140
- end
141
-
142
- # should show a drop-down for force_blog_posts_to_textile
143
- assert_select('select[name=?]', 'user[force_blog_posts_to_textile]') do
144
- assert_select "option[value='']"
145
- assert_select "option:not([selected])[value=0]", :text => 'false'
146
- assert_select "option:not([selected])[value=1]", :text => 'true'
147
- end
148
-
149
- # should show a select for admin_level
150
- assert_select("select[name=?]", "user[admin_level]") do
151
- assert_select("option[value='']", false)
152
- assert_select "option[value=normal][selected=selected]"
153
- assert_select "option[value=admin]"
154
- assert_select "option[value=superuser]"
155
- end
156
- end
157
-
158
- def test_update
159
- put(
160
- "/admin/users/#{@user.id}",
161
- :user => {:username => 'bettie', :force_blog_posts_to_textile => ''}
162
- )
163
- @user.reload
164
-
165
- # should not assign a new random password
166
- assert_equal(@user.password, 'crocker')
167
-
168
- # should know the difference between nil and false for force_blog_posts_to_textile
169
- assert_nil(@user.force_blog_posts_to_textile)
170
- end
171
-
172
- def test_update_while_resetting_password
173
- put(
174
- "/admin/users/#{@user.id}",
175
- :user => {:username => 'bettie'}, :reset_password => '1'
176
- )
177
-
178
- # should assign a new random password
179
- @user.reload
180
- assert_not_equal(@user.password, 'crocker')
181
- end
182
- end
@@ -1,10 +0,0 @@
1
- $: << 'test'
2
- require 'test_helper'
3
-
4
- class BlogPostsIntegrationTest < ActionController::IntegrationTest
5
- def test_create_should_not_be_defined_by_admin_assistant
6
- assert_raise(AbstractController::ActionNotFound) do
7
- post "/blog_posts/"
8
- end
9
- end
10
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
- require 'rails/performance_test_help'
3
-
4
- # Profiling results for each test method are written to tmp/performance.
5
- class BrowsingTest < ActionDispatch::PerformanceTest
6
- def test_homepage
7
- get '/'
8
- end
9
- end
@@ -1,138 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path('../../config/environment', __FILE__)
3
- require 'rails/test_help'
4
-
5
- class ActiveSupport::TestCase
6
- def assert_a_tag_with_get_args(
7
- content, href_base, href_get_args, response_body
8
- )
9
- regex = %r|<a href="#{ href_base }\?([^"]*)"[^>]*>#{ content }</a>|
10
- assert(
11
- response_body =~ regex,
12
- "#{response_body.inspect} expected to match #{regex.inspect}"
13
- )
14
- assert_get_args_equal( href_get_args, $1.gsub( /&amp;/, '&' ) )
15
- end
16
-
17
- def assert_get_args_equal( expected_hash, get_args_string )
18
- response_h = HashWithIndifferentAccess.new
19
- CGI::parse( get_args_string ).each do |key, values|
20
- response_h[key] = values.first
21
- end
22
- assert_equal(
23
- expected_hash.size, response_h.size,
24
- "<#{ expected_hash.inspect }> expected but was\n<#{ response_h.inspect }>."
25
- )
26
- expected_hash.each do |key, value|
27
- assert_equal( value, response_h[key] )
28
- end
29
- end
30
-
31
- def assert_no_a_tag_with_get_args(
32
- content, href_base, href_get_args, response_body
33
- )
34
- regex = %r|<a href="#{ href_base }\?([^"]*)"[^>]*>#{ content }</a>|
35
- if response_body =~ regex
36
- get_args_string = $1.gsub( /&amp;/, '&' )
37
- response_h = HashWithIndifferentAccess.new
38
- CGI::parse( get_args_string ).each do |key, values|
39
- response_h[key] = values.first
40
- end
41
- if href_get_args.size == response_h.size
42
- raise if href_get_args.all? { |key, value|
43
- response_h[key] == value
44
- }
45
- end
46
- end
47
- end
48
-
49
- def random_word( length = 25 )
50
- letters = 'abcdefghijklmnopqrstuvwxyz_'.split //
51
- ( 1..length ).to_a.map { letters[rand(letters.size)] }.join( '' )
52
- end
53
- end
54
-
55
- class CacheStoreStub
56
- def initialize
57
- flush
58
- end
59
-
60
- def expires_in(key)
61
- @expirations[key.to_s]
62
- end
63
-
64
- def flush
65
- @cache = {}
66
- @expirations = {}
67
- @raise_on_write = false
68
- end
69
-
70
- def raise_on_write
71
- @raise_on_write = true
72
- end
73
-
74
- def read(key, options = nil)
75
- @cache[key.to_s]
76
- end
77
-
78
- def write(key, value, options = nil)
79
- raise if @raise_on_write
80
- @cache[key.to_s] = value
81
- @expirations[key.to_s] = options[:expires_in]
82
- end
83
- end
84
-
85
- $cache = CacheStoreStub.new
86
-
87
- module Rails
88
- mattr_accessor :cache
89
- self.cache = $cache
90
- end
91
-
92
- include Webrat::Methods
93
- include Webrat::Matchers
94
-
95
- Webrat.configure do |config|
96
- config.mode = :rails
97
- end
98
-
99
- class ActionController::IntegrationTest
100
-
101
- # Rails 3.0 renders link hrefs like:
102
- # /admin/comments/new?comment[blog_post_id]=1
103
- # Rails 3.1 renders link hrefs like:
104
- # /admin/comments/new?comment%5Bblog_post_id%5D=1
105
-
106
- unless method_defined?(
107
- :assert_select_with_preprocessed_hrefs_across_rails_versions
108
- )
109
- def assert_select_with_preprocessed_hrefs_across_rails_versions(*args)
110
- old_args = args
111
- args = []
112
- args.unshift(old_args.shift)
113
- until old_args.empty?
114
- next_arg = old_args.shift
115
- if next_arg.is_a?(String) && Rails.version =~ /^3.1/
116
- next_arg.gsub!(/(\?\w+)\[/, '\1%5B')
117
- next_arg.gsub!(/(\?\w+%5B\w+)\]/, '\1%5D')
118
- end
119
- args.push next_arg
120
- end
121
- assert_select_without_preprocessed_hrefs_across_rails_versions(*args)
122
- end
123
-
124
- alias_method_chain :assert_select,
125
- :preprocessed_hrefs_across_rails_versions
126
- end
127
-
128
- def assert_will_paginate_link(base, page, content = nil)
129
- select = []
130
- if Rails.version =~ /^3.1/
131
- select << "a[href=#{base}?escape=false&amp;page=#{page}]"
132
- else
133
- select << "a[href=#{base}?page=#{page}]"
134
- end
135
- select << content if content
136
- assert_select(select)
137
- end
138
- end
data/rails_3_1/Gemfile DELETED
@@ -1,12 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'rails', '3.1.0.rc5'
4
-
5
- gem 'admin_assistant', :path => "../../admin_assistant"
6
- gem 'paperclip', '2.3.11'
7
- gem 'sqlite3'
8
-
9
- group :development, :test do
10
- gem 'json'
11
- gem 'webrat', '>=0.7.2.pre', :git => 'http://github.com/kalv/webrat.git'
12
- end
@@ -1,116 +0,0 @@
1
- GIT
2
- remote: http://github.com/kalv/webrat.git
3
- revision: 66130e4b9e903e07cfa86286655bde439c7b376e
4
- specs:
5
- webrat (0.7.2.pre)
6
- nokogiri (>= 1.2.0)
7
- rack (>= 1.0)
8
- rack-test (>= 0.5.3)
9
-
10
- PATH
11
- remote: ../../admin_assistant
12
- specs:
13
- admin_assistant (2.0.1)
14
- dynamic_form
15
- will_paginate (= 3.0.pre2)
16
-
17
- GEM
18
- remote: http://rubygems.org/
19
- specs:
20
- actionmailer (3.1.0.rc5)
21
- actionpack (= 3.1.0.rc5)
22
- mail (~> 2.3.0)
23
- actionpack (3.1.0.rc5)
24
- activemodel (= 3.1.0.rc5)
25
- activesupport (= 3.1.0.rc5)
26
- builder (~> 3.0.0)
27
- erubis (~> 2.7.0)
28
- i18n (~> 0.6)
29
- rack (~> 1.3.1)
30
- rack-cache (~> 1.0.2)
31
- rack-mount (~> 0.8.1)
32
- rack-test (~> 0.6.0)
33
- sprockets (~> 2.0.0.beta.12)
34
- activemodel (3.1.0.rc5)
35
- activesupport (= 3.1.0.rc5)
36
- bcrypt-ruby (~> 2.1.4)
37
- builder (~> 3.0.0)
38
- i18n (~> 0.6)
39
- activerecord (3.1.0.rc5)
40
- activemodel (= 3.1.0.rc5)
41
- activesupport (= 3.1.0.rc5)
42
- arel (~> 2.1.4)
43
- tzinfo (~> 0.3.29)
44
- activeresource (3.1.0.rc5)
45
- activemodel (= 3.1.0.rc5)
46
- activesupport (= 3.1.0.rc5)
47
- activesupport (3.1.0.rc5)
48
- multi_json (~> 1.0)
49
- arel (2.1.4)
50
- bcrypt-ruby (2.1.4)
51
- builder (3.0.0)
52
- dynamic_form (1.1.4)
53
- erubis (2.7.0)
54
- hike (1.2.0)
55
- i18n (0.6.0)
56
- json (1.5.3)
57
- mail (2.3.0)
58
- i18n (>= 0.4.0)
59
- mime-types (~> 1.16)
60
- treetop (~> 1.4.8)
61
- mime-types (1.16)
62
- multi_json (1.0.3)
63
- nokogiri (1.5.0)
64
- paperclip (2.3.11)
65
- activerecord (>= 2.3.0)
66
- activesupport (>= 2.3.2)
67
- polyglot (0.3.2)
68
- rack (1.3.2)
69
- rack-cache (1.0.2)
70
- rack (>= 0.4)
71
- rack-mount (0.8.1)
72
- rack (>= 1.0.0)
73
- rack-ssl (1.3.2)
74
- rack
75
- rack-test (0.6.1)
76
- rack (>= 1.0)
77
- rails (3.1.0.rc5)
78
- actionmailer (= 3.1.0.rc5)
79
- actionpack (= 3.1.0.rc5)
80
- activerecord (= 3.1.0.rc5)
81
- activeresource (= 3.1.0.rc5)
82
- activesupport (= 3.1.0.rc5)
83
- bundler (~> 1.0)
84
- railties (= 3.1.0.rc5)
85
- railties (3.1.0.rc5)
86
- actionpack (= 3.1.0.rc5)
87
- activesupport (= 3.1.0.rc5)
88
- rack-ssl (~> 1.3.2)
89
- rake (>= 0.8.7)
90
- rdoc (~> 3.4)
91
- thor (~> 0.14.6)
92
- rake (0.9.2)
93
- rdoc (3.9)
94
- sprockets (2.0.0.beta.12)
95
- hike (~> 1.2)
96
- rack (~> 1.0)
97
- tilt (!= 1.3.0, ~> 1.1)
98
- sqlite3 (1.3.4)
99
- thor (0.14.6)
100
- tilt (1.3.2)
101
- treetop (1.4.10)
102
- polyglot
103
- polyglot (>= 0.3.1)
104
- tzinfo (0.3.29)
105
- will_paginate (3.0.pre2)
106
-
107
- PLATFORMS
108
- ruby
109
-
110
- DEPENDENCIES
111
- admin_assistant!
112
- json
113
- paperclip (= 2.3.11)
114
- rails (= 3.1.0.rc5)
115
- sqlite3
116
- webrat (>= 0.7.2.pre)!