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.
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/admin_assistant.gemspec +2 -171
- metadata +4 -173
- data/rails_3_0/Gemfile +0 -12
- data/rails_3_0/Gemfile.lock +0 -100
- data/rails_3_0/README +0 -256
- data/rails_3_0/Rakefile +0 -7
- data/rails_3_0/app/controllers/admin/appointments2_controller.rb +0 -15
- data/rails_3_0/app/controllers/admin/appointments_controller.rb +0 -11
- data/rails_3_0/app/controllers/admin/blog_posts2_controller.rb +0 -138
- data/rails_3_0/app/controllers/admin/blog_posts3_controller.rb +0 -76
- data/rails_3_0/app/controllers/admin/blog_posts4_controller.rb +0 -21
- data/rails_3_0/app/controllers/admin/blog_posts5_controller.rb +0 -27
- data/rails_3_0/app/controllers/admin/blog_posts6_controller.rb +0 -10
- data/rails_3_0/app/controllers/admin/blog_posts_controller.rb +0 -9
- data/rails_3_0/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb +0 -15
- data/rails_3_0/app/controllers/admin/blog_posts_read_only_controller.rb +0 -19
- data/rails_3_0/app/controllers/admin/bookmarks_controller.rb +0 -11
- data/rails_3_0/app/controllers/admin/comments2_controller.rb +0 -14
- data/rails_3_0/app/controllers/admin/comments_controller.rb +0 -12
- data/rails_3_0/app/controllers/admin/images2_controller.rb +0 -11
- data/rails_3_0/app/controllers/admin/images_controller.rb +0 -6
- data/rails_3_0/app/controllers/admin/misconfigured1_controller.rb +0 -7
- data/rails_3_0/app/controllers/admin/not_migrated_yets_controller.rb +0 -9
- data/rails_3_0/app/controllers/admin/product_categories2_controller.rb +0 -7
- data/rails_3_0/app/controllers/admin/product_categories_controller.rb +0 -5
- data/rails_3_0/app/controllers/admin/television_airings_controller.rb +0 -5
- data/rails_3_0/app/controllers/admin/television_time_slots_controller.rb +0 -5
- data/rails_3_0/app/controllers/admin/users2_controller.rb +0 -10
- data/rails_3_0/app/controllers/admin/users_controller.rb +0 -48
- data/rails_3_0/app/controllers/application_controller.rb +0 -7
- data/rails_3_0/app/controllers/blog_posts_controller.rb +0 -5
- data/rails_3_0/app/helpers/admin/appointments_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/blog_posts2_helper.rb +0 -27
- data/rails_3_0/app/helpers/admin/blog_posts3_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/blog_posts4_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/blog_posts6_helper.rb +0 -13
- data/rails_3_0/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb +0 -29
- data/rails_3_0/app/helpers/admin/blog_posts_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/blog_posts_read_only_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/bookmarks_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/comments2_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/comments_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/images2_helper.rb +0 -8
- data/rails_3_0/app/helpers/admin/images_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/misconfigured1_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/not_migrated_yets_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/product_categories2_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/product_categories_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/television_airings_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/television_time_slots_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/users2_helper.rb +0 -2
- data/rails_3_0/app/helpers/admin/users_helper.rb +0 -13
- data/rails_3_0/app/helpers/application_helper.rb +0 -2
- data/rails_3_0/app/models/appointment.rb +0 -5
- data/rails_3_0/app/models/blog_post.rb +0 -14
- data/rails_3_0/app/models/blog_post_tag.rb +0 -6
- data/rails_3_0/app/models/bookmark.rb +0 -6
- data/rails_3_0/app/models/comment.rb +0 -4
- data/rails_3_0/app/models/image.rb +0 -3
- data/rails_3_0/app/models/not_migrated_yet.rb +0 -2
- data/rails_3_0/app/models/product.rb +0 -5
- data/rails_3_0/app/models/product_category.rb +0 -9
- data/rails_3_0/app/models/tag.rb +0 -4
- data/rails_3_0/app/models/television_airing.rb +0 -3
- data/rails_3_0/app/models/television_time_slot.rb +0 -11
- data/rails_3_0/app/models/user.rb +0 -11
- data/rails_3_0/app/views/admin/appointments/_subject_input.html.erb +0 -2
- data/rails_3_0/app/views/admin/appointments2/_time_input.html.erb +0 -31
- data/rails_3_0/app/views/admin/blog_posts2/_after_form.html.erb +0 -5
- data/rails_3_0/app/views/admin/blog_posts2/_after_index.html.erb +0 -1
- data/rails_3_0/app/views/admin/blog_posts2/_after_tags_input.html.erb +0 -16
- data/rails_3_0/app/views/admin/blog_posts2/_before_index.html.erb +0 -2
- data/rails_3_0/app/views/admin/blog_posts5/_after_index_header.html.erb +0 -8
- data/rails_3_0/app/views/admin/blog_posts_read_only/_body_for_show.html.erb +0 -1
- data/rails_3_0/app/views/layouts/admin.html.erb +0 -32
- data/rails_3_0/app/views/layouts/application.html.erb +0 -14
- data/rails_3_0/config.ru +0 -4
- data/rails_3_0/config/application.rb +0 -42
- data/rails_3_0/config/boot.rb +0 -6
- data/rails_3_0/config/database.yml +0 -22
- data/rails_3_0/config/environment.rb +0 -5
- data/rails_3_0/config/environments/development.rb +0 -25
- data/rails_3_0/config/environments/production.rb +0 -49
- data/rails_3_0/config/environments/test.rb +0 -35
- data/rails_3_0/config/initializers/backtrace_silencers.rb +0 -7
- data/rails_3_0/config/initializers/inflections.rb +0 -10
- data/rails_3_0/config/initializers/mime_types.rb +0 -5
- data/rails_3_0/config/initializers/secret_token.rb +0 -7
- data/rails_3_0/config/initializers/session_store.rb +0 -8
- data/rails_3_0/config/locales/en.yml +0 -5
- data/rails_3_0/config/routes.rb +0 -8
- data/rails_3_0/db/migrate/20090213215514_create_blog_posts.rb +0 -12
- data/rails_3_0/db/migrate/20090217225542_add_body_to_blog_posts.rb +0 -9
- data/rails_3_0/db/migrate/20090221220917_create_tags.rb +0 -13
- data/rails_3_0/db/migrate/20090221220947_create_blog_post_tags.rb +0 -14
- data/rails_3_0/db/migrate/20090222162204_add_textile_to_blog_posts.rb +0 -9
- data/rails_3_0/db/migrate/20090222163231_add_published_at_to_blog_posts.rb +0 -9
- data/rails_3_0/db/migrate/20090301191722_create_images.rb +0 -16
- data/rails_3_0/db/migrate/20090305165345_create_accounts.rb +0 -14
- data/rails_3_0/db/migrate/20090307225027_rename_accounts_to_users.rb +0 -9
- data/rails_3_0/db/migrate/20090307225750_add_user_id_to_blog_posts.rb +0 -9
- data/rails_3_0/db/migrate/20090309185114_change_blog_posts_textile.rb +0 -9
- data/rails_3_0/db/migrate/20090309193635_create_products.rb +0 -14
- data/rails_3_0/db/migrate/20090309203056_create_comments.rb +0 -15
- data/rails_3_0/db/migrate/20090323005947_create_file_column_images.rb +0 -12
- data/rails_3_0/db/migrate/20090326160049_add_birthday_to_users.rb +0 -9
- data/rails_3_0/db/migrate/20090326223606_add_state_to_users.rb +0 -9
- data/rails_3_0/db/migrate/20090503134004_add_file_column_image_to_products.rb +0 -9
- data/rails_3_0/db/migrate/20090617173651_create_bookmarks.rb +0 -15
- data/rails_3_0/db/migrate/20090624165355_add_tags_string_to_blog_post.rb +0 -9
- data/rails_3_0/db/migrate/20090625144313_add_avatar_fields_to_user.rb +0 -11
- data/rails_3_0/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb +0 -9
- data/rails_3_0/db/migrate/20090701171857_add_force_textile_to_users.rb +0 -9
- data/rails_3_0/db/migrate/20090704163647_add_deleted_at_to_products.rb +0 -9
- data/rails_3_0/db/migrate/20090704173800_add_sale_fields_to_products.rb +0 -13
- data/rails_3_0/db/migrate/20090714024501_create_product_categories.rb +0 -15
- data/rails_3_0/db/migrate/20090819162835_add_admin_level_to_users.rb +0 -9
- data/rails_3_0/db/migrate/20091115134559_add_first_and_last_names_to_users.rb +0 -11
- data/rails_3_0/db/migrate/20091221011256_add_position_to_product_categories.rb +0 -9
- data/rails_3_0/db/migrate/20091222160814_create_appointments.rb +0 -14
- data/rails_3_0/db/migrate/20091227224547_add_user_id_to_appointments.rb +0 -9
- data/rails_3_0/db/migrate/20100214213359_create_television_time_slots.rb +0 -13
- data/rails_3_0/db/migrate/20100214213451_create_television_airings.rb +0 -15
- data/rails_3_0/db/migrate/20110426215702_remove_avatar_fields_from_users.rb +0 -11
- data/rails_3_0/db/seeds.rb +0 -7
- data/rails_3_0/doc/README_FOR_APP +0 -2
- data/rails_3_0/public/404.html +0 -26
- data/rails_3_0/public/422.html +0 -26
- data/rails_3_0/public/500.html +0 -26
- data/rails_3_0/public/favicon.ico +0 -0
- data/rails_3_0/public/images/rails.png +0 -0
- data/rails_3_0/public/index.html +0 -239
- data/rails_3_0/public/javascripts/application.js +0 -2
- data/rails_3_0/public/javascripts/jquery-1.4.4.min.js +0 -167
- data/rails_3_0/public/javascripts/rails.js +0 -191
- data/rails_3_0/public/robots.txt +0 -5
- data/rails_3_0/public/stylesheets/admin.css +0 -3
- data/rails_3_0/public/stylesheets/scaffold.css +0 -54
- data/rails_3_0/script/rails +0 -6
- data/rails_3_0/test/data/ruby_throated.jpg +0 -0
- data/rails_3_0/test/data/tweenbot.jpg +0 -0
- data/rails_3_0/test/fixtures/placeholder.txt +0 -0
- data/rails_3_0/test/integration/admin/appointments2_integration_test.rb +0 -79
- data/rails_3_0/test/integration/admin/appointments_integration_test.rb +0 -367
- data/rails_3_0/test/integration/admin/blog_posts2_integration_test.rb +0 -789
- data/rails_3_0/test/integration/admin/blog_posts3_integration_test.rb +0 -418
- data/rails_3_0/test/integration/admin/blog_posts4_integration_test.rb +0 -189
- data/rails_3_0/test/integration/admin/blog_posts5_integration_test.rb +0 -75
- data/rails_3_0/test/integration/admin/blog_posts6_integration_test.rb +0 -39
- data/rails_3_0/test/integration/admin/blog_posts_custom_new_and_edit_integration_test.rb +0 -89
- data/rails_3_0/test/integration/admin/blog_posts_integration_test.rb +0 -776
- data/rails_3_0/test/integration/admin/blog_posts_read_only_integration_test.rb +0 -69
- data/rails_3_0/test/integration/admin/bookmarks_integration_test.rb +0 -445
- data/rails_3_0/test/integration/admin/comments2_integration_test.rb +0 -52
- data/rails_3_0/test/integration/admin/comments_integration_test.rb +0 -50
- data/rails_3_0/test/integration/admin/images2_integration_test.rb +0 -33
- data/rails_3_0/test/integration/admin/images_integration_test.rb +0 -79
- data/rails_3_0/test/integration/admin/misconfigured1_integration_test.rb +0 -21
- data/rails_3_0/test/integration/admin/product_categories2_integration_test.rb +0 -179
- data/rails_3_0/test/integration/admin/product_categories_integration_test.rb +0 -12
- data/rails_3_0/test/integration/admin/television_airings_integration_test.rb +0 -25
- data/rails_3_0/test/integration/admin/users2_integration_test.rb +0 -48
- data/rails_3_0/test/integration/admin/users_integration_test.rb +0 -182
- data/rails_3_0/test/integration/blog_posts_integration_test.rb +0 -10
- data/rails_3_0/test/performance/browsing_test.rb +0 -9
- data/rails_3_0/test/test_helper.rb +0 -138
- data/rails_3_1/Gemfile +0 -12
- data/rails_3_1/Gemfile.lock +0 -116
- data/rails_3_1/README +0 -256
- data/rails_3_1/Rakefile +0 -7
- data/rails_3_1/config.ru +0 -4
@@ -1,52 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
|
2
|
-
|
3
|
-
class Admin::Comments2IntegrationTest < ActionController::IntegrationTest
|
4
|
-
def setup
|
5
|
-
@user = User.find_or_create_by_username 'soren'
|
6
|
-
@published_blog_post = BlogPost.create!(
|
7
|
-
:title => 'published', :user => @user, :published_at => Time.now.utc
|
8
|
-
)
|
9
|
-
@unpublished_blog_post = BlogPost.create!(
|
10
|
-
:title => 'unpublished', :user => @user, :published_at => nil
|
11
|
-
)
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_edit
|
15
|
-
@comment = Comment.create!(
|
16
|
-
:comment => "you're funny but I'm funnier",
|
17
|
-
:blog_post => @published_blog_post
|
18
|
-
)
|
19
|
-
get "/admin/comments2/#{@comment.id}/edit"
|
20
|
-
|
21
|
-
# should not have a textarea for Comment#comment
|
22
|
-
assert_select("textarea[name=?]", "comment[comment]", false)
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_index
|
26
|
-
Comment.destroy_all
|
27
|
-
@comment_on_published = Comment.create!(
|
28
|
-
:comment => "this is published",
|
29
|
-
:blog_post => @published_blog_post
|
30
|
-
)
|
31
|
-
@comment_on_unpublished = Comment.create!(
|
32
|
-
:comment => "this was published but no more",
|
33
|
-
:blog_post => @unpublished_blog_post
|
34
|
-
)
|
35
|
-
get "/admin/comments2"
|
36
|
-
|
37
|
-
# should show a comment on a published blog post
|
38
|
-
assert_select('td', :text => 'this is published')
|
39
|
-
|
40
|
-
# should not show a comment on an unpublished blog post
|
41
|
-
assert_no_match(
|
42
|
-
%r|<td[^>]*>this was published but no more</td>|, response.body
|
43
|
-
)
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_new
|
47
|
-
get "/admin/comments2/new"
|
48
|
-
|
49
|
-
# should have a textarea for Comment#comment
|
50
|
-
assert_select("textarea[name=?]", "comment[comment]")
|
51
|
-
end
|
52
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
|
2
|
-
|
3
|
-
class Admin::CommentsIntegrationTest < ActionController::IntegrationTest
|
4
|
-
def test_edit
|
5
|
-
@comment = Comment.create! :comment => "you think you're so smart"
|
6
|
-
get "/admin/comments/#{@comment.id}/edit"
|
7
|
-
|
8
|
-
# should not allow the comments to be editable
|
9
|
-
assert_match(/you think you're so smart/, response.body)
|
10
|
-
assert_select('textarea', false)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_index_with_a_comment_without_the_word_smart
|
14
|
-
Comment.create! :comment => "something else"
|
15
|
-
get "/admin/comments"
|
16
|
-
|
17
|
-
# should not include the index
|
18
|
-
assert_no_match(/something else/, response.body)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_index_when_searching_by_comment
|
22
|
-
@comment = Comment.create! :comment => "you think you're so smart"
|
23
|
-
get "/admin/comments", :search => 'you'
|
24
|
-
|
25
|
-
# should find the comment
|
26
|
-
assert_match(/you think you're so smart/, response.body)
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_index_when_searching_by_ID
|
30
|
-
@comment = Comment.create! :comment => "you think you're so smart"
|
31
|
-
get "/admin/comments", :search => @comment.id.to_s
|
32
|
-
|
33
|
-
# should find the comment
|
34
|
-
assert_match(/you think you're so smart/, response.body)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_new_with_at_least_16_blog_posts_and_16_users
|
38
|
-
user = User.find_or_create_by_username 'soren'
|
39
|
-
BlogPost.count.upto(16) do
|
40
|
-
BlogPost.create! :title => random_word, :user => user
|
41
|
-
end
|
42
|
-
User.count.upto(16) do
|
43
|
-
User.create! :username => random_word
|
44
|
-
end
|
45
|
-
get "/admin/comments/new"
|
46
|
-
|
47
|
-
# should be a success
|
48
|
-
assert_response :success
|
49
|
-
end
|
50
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
|
2
|
-
|
3
|
-
class Admin::Images2IntegrationTest < ActionController::IntegrationTest
|
4
|
-
def test_index
|
5
|
-
Image.destroy_all
|
6
|
-
@image = Image.create!(
|
7
|
-
:image_file_name => '123.jpg', :image_content_type => 'image/jpeg',
|
8
|
-
:image_file_size => '456'
|
9
|
-
)
|
10
|
-
@path = "/images/#{@image.id}/original/123.jpg"
|
11
|
-
get "/admin/images2"
|
12
|
-
assert_response :success
|
13
|
-
|
14
|
-
# should show the image in-line as an <img> tag
|
15
|
-
assert_select("img[src=?]", @path)
|
16
|
-
|
17
|
-
# should not show the image path on its own as a value
|
18
|
-
assert_no_match(%r|<td[^>]*>#{@path}</td>|, response.body)
|
19
|
-
|
20
|
-
# should show path text field
|
21
|
-
assert_select('input[value=?]', "http://www.example.com#{@path}")
|
22
|
-
|
23
|
-
# should not show an edit link since we can only create or index
|
24
|
-
assert_select(
|
25
|
-
'a[href=?]', "/admin/images2/edit/#{@image.id}", false
|
26
|
-
)
|
27
|
-
|
28
|
-
# should have a new link
|
29
|
-
assert_select(
|
30
|
-
"a[href=/admin/images2/new]", 'New image'
|
31
|
-
)
|
32
|
-
end
|
33
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
|
2
|
-
|
3
|
-
class Admin::ImagesIntegrationTest < ActionController::IntegrationTest
|
4
|
-
def test_index
|
5
|
-
@image = Image.create!(
|
6
|
-
:image_file_name => '123.jpg', :image_content_type => 'image/jpeg',
|
7
|
-
:image_file_size => '456'
|
8
|
-
)
|
9
|
-
get "/admin/images"
|
10
|
-
assert_response :success
|
11
|
-
|
12
|
-
# should show the image in-line as an <img> tag
|
13
|
-
assert_select("img[src=/images/#{@image.id}/original/123.jpg]")
|
14
|
-
|
15
|
-
# should not show paperclip-fields
|
16
|
-
assert_no_match(/image_file_name/, response.body)
|
17
|
-
assert_no_match(/image_content_type/, response.body)
|
18
|
-
assert_no_match(/image_file_size/, response.body)
|
19
|
-
assert_no_match(/image_updated_at/, response.body)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_create
|
23
|
-
file = File.new './test/data/ruby_throated.jpg'
|
24
|
-
post(
|
25
|
-
"/admin/images",
|
26
|
-
:image => {
|
27
|
-
:image => fixture_file_upload('../../test/data/ruby_throated.jpg')
|
28
|
-
},
|
29
|
-
:html => {:multipart => true}
|
30
|
-
)
|
31
|
-
@image = Image.find_by_image_file_name 'ruby_throated.jpg'
|
32
|
-
|
33
|
-
# should save an image record
|
34
|
-
assert_not_nil @image
|
35
|
-
|
36
|
-
# should save the image locally
|
37
|
-
assert(
|
38
|
-
File.exist?("./public/images/#{@image.id}/original/ruby_throated.jpg")
|
39
|
-
)
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_new
|
43
|
-
get "/admin/images/new"
|
44
|
-
assert_response :success
|
45
|
-
|
46
|
-
# should have a multipart form
|
47
|
-
assert_select('form[enctype=multipart/form-data]')
|
48
|
-
|
49
|
-
# should have a file input for image
|
50
|
-
assert_match(
|
51
|
-
%r|<input[^>]*name="image\[image\]"[^>]*type="file"|,
|
52
|
-
response.body
|
53
|
-
)
|
54
|
-
|
55
|
-
# should not show paperclip-fields
|
56
|
-
assert_no_match(/image_file_name/, response.body)
|
57
|
-
assert_no_match(/image_content_type/, response.body)
|
58
|
-
assert_no_match(/image_file_size/, response.body)
|
59
|
-
assert_no_match(/image_updated_at/, response.body)
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_show
|
63
|
-
@image = Image.create!(
|
64
|
-
:image_file_name => '123.jpg', :image_content_type => 'image/jpeg',
|
65
|
-
:image_file_size => '456'
|
66
|
-
)
|
67
|
-
get "/admin/images/#{@image.id}"
|
68
|
-
assert_response :success
|
69
|
-
|
70
|
-
# should show the image in-line as an <img> tag
|
71
|
-
assert_select("img[src=/images/#{@image.id}/original/123.jpg]")
|
72
|
-
|
73
|
-
# should not show paperclip-fields
|
74
|
-
assert_no_match(/image_file_name/, response.body)
|
75
|
-
assert_no_match(/image_content_type/, response.body)
|
76
|
-
assert_no_match(/image_file_size/, response.body)
|
77
|
-
assert_no_match(/image_updated_at/, response.body)
|
78
|
-
end
|
79
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
|
2
|
-
|
3
|
-
class Admin::Misconfigured1IntegrationTest < ActionController::IntegrationTest
|
4
|
-
def setup
|
5
|
-
User.destroy_all
|
6
|
-
@user = User.create! :username => 'soren', :password => 'password'
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_index
|
10
|
-
# should raise an explanatory error
|
11
|
-
begin
|
12
|
-
get "/admin/misconfigured1"
|
13
|
-
fail "raise expected"
|
14
|
-
rescue ActionView::Template::Error
|
15
|
-
assert_match(
|
16
|
-
/Virtual search column :has_something needs a conditions block/,
|
17
|
-
$!.message
|
18
|
-
)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,179 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
|
2
|
-
|
3
|
-
class Admin::ProductCategories2IntegrationTest <
|
4
|
-
ActionController::IntegrationTest
|
5
|
-
def test_create_with_3_new_valid_product_categories_and_7_blanks
|
6
|
-
ProductCategory.destroy_all
|
7
|
-
post(
|
8
|
-
"/admin/product_categories2",
|
9
|
-
:product_category => {
|
10
|
-
'a' => {'category_name' => 'shiny', 'position' => 1},
|
11
|
-
'b' => {'category_name' => 'bouncy', 'position' => 2},
|
12
|
-
'c' => {'category_name' => 'sparkly', 'position' => 3},
|
13
|
-
'd' => {'category_name' => ''},
|
14
|
-
'e' => {'category_name' => ''},
|
15
|
-
'f' => {'category_name' => ''},
|
16
|
-
'g' => {'category_name' => ''},
|
17
|
-
'h' => {'category_name' => ''},
|
18
|
-
'i' => {'category_name' => ''},
|
19
|
-
'j' => {'category_name' => ''},
|
20
|
-
}
|
21
|
-
)
|
22
|
-
|
23
|
-
# should create 3 product categories
|
24
|
-
assert_equal(3, ProductCategory.count)
|
25
|
-
%w(shiny bouncy sparkly).each do |name|
|
26
|
-
assert_not_nil(
|
27
|
-
ProductCategory.first(:conditions => {:category_name => name})
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
|
-
# should redirect to index
|
32
|
-
assert_redirected_to(:action => 'index')
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_create_with_2_new_valid_product_categories_1_invalid_product_category_and_7_blanks
|
36
|
-
ProductCategory.destroy_all
|
37
|
-
ProductCategory.create! :category_name => 'shiny', :position => 1
|
38
|
-
@orig_pc_count = ProductCategory.count
|
39
|
-
post(
|
40
|
-
"/admin/product_categories2",
|
41
|
-
:product_category => {
|
42
|
-
'a' => {'category_name' => ''},
|
43
|
-
'b' => {'category_name' => ''},
|
44
|
-
'c' => {'category_name' => 'shiny', :position => 2},
|
45
|
-
'd' => {'category_name' => ''},
|
46
|
-
'e' => {'category_name' => 'bouncy', :position => 3},
|
47
|
-
'f' => {'category_name' => ''},
|
48
|
-
'g' => {'category_name' => 'sparkly', :position => 4},
|
49
|
-
'h' => {'category_name' => ''},
|
50
|
-
'i' => {'category_name' => ''},
|
51
|
-
'j' => {'category_name' => ''},
|
52
|
-
}
|
53
|
-
)
|
54
|
-
assert_response :success
|
55
|
-
|
56
|
-
# should not create any product categories
|
57
|
-
assert_equal(@orig_pc_count, ProductCategory.count)
|
58
|
-
|
59
|
-
# should render the error for the invalid product category
|
60
|
-
assert_match(/has already been taken/, response.body)
|
61
|
-
|
62
|
-
# should move non-empty records to the top of the rendered form
|
63
|
-
assert_select("form") do
|
64
|
-
assert_select(
|
65
|
-
'input[name=?][value=?]', "product_category[a][category_name]",
|
66
|
-
'shiny'
|
67
|
-
)
|
68
|
-
assert_select(
|
69
|
-
'input[name=?][value=?]', "product_category[b][category_name]",
|
70
|
-
'bouncy'
|
71
|
-
)
|
72
|
-
assert_select(
|
73
|
-
'input[name=?][value=?]', "product_category[c][category_name]",
|
74
|
-
'sparkly'
|
75
|
-
)
|
76
|
-
end
|
77
|
-
|
78
|
-
# should render the error directly above the row with the error in it
|
79
|
-
assert_select('form') do
|
80
|
-
assert_select('table') do
|
81
|
-
assert_select('tr') do
|
82
|
-
assert_select('td', :text => /^\s*$/)
|
83
|
-
assert_select(
|
84
|
-
'td.errorExplanation:not([colspan])',
|
85
|
-
:text => /Category name has already been taken/
|
86
|
-
)
|
87
|
-
end
|
88
|
-
assert_select('td.field_with_errors') do
|
89
|
-
assert_select(
|
90
|
-
'input[name=?][value=?]', "product_category[a][category_name]",
|
91
|
-
'shiny'
|
92
|
-
)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# should have 7 blank slots at the bottom
|
98
|
-
'd'.upto('j') do |prefix|
|
99
|
-
assert_select(
|
100
|
-
'input[name=?]', "product_category[#{prefix}][category_name]"
|
101
|
-
)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_create_with_nothing_entered
|
106
|
-
post(
|
107
|
-
"/admin/product_categories2",
|
108
|
-
:product_category => {
|
109
|
-
'a' => {'category_name' => ''},
|
110
|
-
'b' => {'category_name' => ''},
|
111
|
-
'c' => {'category_name' => ''},
|
112
|
-
'd' => {'category_name' => ''},
|
113
|
-
'e' => {'category_name' => ''},
|
114
|
-
'f' => {'category_name' => ''},
|
115
|
-
'g' => {'category_name' => ''},
|
116
|
-
'h' => {'category_name' => ''},
|
117
|
-
'i' => {'category_name' => ''},
|
118
|
-
'j' => {'category_name' => ''},
|
119
|
-
}
|
120
|
-
)
|
121
|
-
|
122
|
-
# should redirect to index
|
123
|
-
assert_redirected_to(:action => 'index')
|
124
|
-
end
|
125
|
-
|
126
|
-
def test_edit
|
127
|
-
ProductCategory.destroy_all
|
128
|
-
@pc = ProductCategory.create!(
|
129
|
-
:category_name => 'shiny', :position => 1
|
130
|
-
)
|
131
|
-
get "/admin/product_categories2/#{@pc.id}/edit"
|
132
|
-
|
133
|
-
# should show the form for one record at a time, like normal
|
134
|
-
assert_select(
|
135
|
-
'form[action=?]', "/admin/product_categories2/#{@pc.id}"
|
136
|
-
) do
|
137
|
-
assert_select(
|
138
|
-
"input[name=?][value=?]", 'product_category[category_name]',
|
139
|
-
@pc.category_name
|
140
|
-
)
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
def test_index
|
145
|
-
get "/admin/product_categories2"
|
146
|
-
|
147
|
-
# should use different text for the new link because we're doing multiple creates
|
148
|
-
assert_select(
|
149
|
-
"a[href=/admin/product_categories2/new]", 'New product categories'
|
150
|
-
)
|
151
|
-
end
|
152
|
-
|
153
|
-
def test_new
|
154
|
-
get "/admin/product_categories2/new"
|
155
|
-
|
156
|
-
# should show a form for 10 product categories at once
|
157
|
-
assert_select('form') do
|
158
|
-
'a'.upto('j') do |i|
|
159
|
-
assert_select 'input[name=?]', "product_category[#{i}][category_name]"
|
160
|
-
end
|
161
|
-
assert_select 'input[type=submit]'
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
def test_update
|
166
|
-
ProductCategory.destroy_all
|
167
|
-
@pc = ProductCategory.create!(
|
168
|
-
:category_name => 'shiny', :position => 1
|
169
|
-
)
|
170
|
-
put(
|
171
|
-
"/admin/product_categories2/#{@pc.id}",
|
172
|
-
:product_category => {:category_name => 'SHINY'}
|
173
|
-
)
|
174
|
-
|
175
|
-
# should update one record at a time
|
176
|
-
@pc.reload
|
177
|
-
assert_equal('SHINY', @pc.category_name)
|
178
|
-
end
|
179
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
|
2
|
-
|
3
|
-
class Admin::ProductCategoriesIntegrationTest <
|
4
|
-
ActionController::IntegrationTest
|
5
|
-
def test_index_with_no_records
|
6
|
-
ProductCategory.destroy_all
|
7
|
-
get "/admin/product_categories"
|
8
|
-
|
9
|
-
# should say 'No product categories found'
|
10
|
-
assert_match(/No product categories found/, response.body)
|
11
|
-
end
|
12
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
|
2
|
-
|
3
|
-
class Admin::TelevisionAiringsIntegrationTest <
|
4
|
-
ActionController::IntegrationTest
|
5
|
-
def test_new
|
6
|
-
TelevisionTimeSlot.destroy_all
|
7
|
-
@tv_time_slot1 = TelevisionTimeSlot.create!(
|
8
|
-
:time => Time.utc(2010, 2, 14, 9)
|
9
|
-
)
|
10
|
-
@tv_time_slot2 = TelevisionTimeSlot.create!(
|
11
|
-
:time => Time.utc(2010, 2, 14, 14)
|
12
|
-
)
|
13
|
-
get "/admin/television_airings/new"
|
14
|
-
assert_response :success
|
15
|
-
|
16
|
-
# should sort television time slots by time, not by the time string
|
17
|
-
assert_select(
|
18
|
-
'select[name=?]', 'television_airing[television_time_slot_id]'
|
19
|
-
) do
|
20
|
-
assert_select 'option:first-child[value=""]'
|
21
|
-
assert_select 'option:nth-child(2)[value=?]', @tv_time_slot1.id
|
22
|
-
assert_select 'option:nth-child(3)[value=?]', @tv_time_slot2.id
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|