typus 3.0.11 → 3.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +4 -1
- data/app/helpers/admin/relationships_helper.rb +2 -2
- data/app/views/admin/dashboard/_applications.html.erb +1 -1
- data/app/views/admin/helpers/resources/_errors.html.erb +1 -1
- data/app/views/admin/helpers/sidebar/_sidebar.html.erb +1 -1
- data/app/views/admin/resources/index.html.erb +2 -2
- data/app/views/admin/templates/_has_n.html.erb +1 -1
- data/app/views/admin/templates/_has_one.html.erb +1 -1
- data/config/locales/typus.ca.yml +1 -1
- data/config/locales/typus.de.models.yml +6 -5
- data/config/locales/typus.de.yml +39 -36
- data/config/locales/typus.el.yml +1 -1
- data/config/locales/typus.es.yml +1 -1
- data/config/locales/typus.fr.yml +1 -1
- data/config/locales/typus.hu.yml +1 -1
- data/config/locales/typus.locale.yml.template +1 -1
- data/config/locales/typus.pt-BR.yml +1 -1
- data/config/locales/typus.pt-PT.yml +1 -1
- data/config/locales/typus.ru.yml +1 -1
- data/config/locales/typus.zh-CN.yml +1 -1
- data/lib/typus/version.rb +1 -1
- data/typus.gemspec +7 -4
- metadata +16 -164
- data/test/app/controllers/admin/account_controller_test.rb +0 -106
- data/test/app/controllers/admin/assets_controller_test.rb +0 -156
- data/test/app/controllers/admin/base_controller_test.rb +0 -41
- data/test/app/controllers/admin/birds_controller_test.rb +0 -42
- data/test/app/controllers/admin/cases_controller_test.rb +0 -21
- data/test/app/controllers/admin/categories_controller_test.rb +0 -134
- data/test/app/controllers/admin/comments_controller_test.rb +0 -79
- data/test/app/controllers/admin/dashboard_controller_test.rb +0 -162
- data/test/app/controllers/admin/image_holders_controller_test.rb +0 -75
- data/test/app/controllers/admin/invoices_controller_test.rb +0 -78
- data/test/app/controllers/admin/orders_controller_test.rb +0 -18
- data/test/app/controllers/admin/pages_controller_test.rb +0 -37
- data/test/app/controllers/admin/posts_controller_test.rb +0 -770
- data/test/app/controllers/admin/projects_controller_test.rb +0 -52
- data/test/app/controllers/admin/session_controller_test.rb +0 -92
- data/test/app/controllers/admin/status_controller_test.rb +0 -54
- data/test/app/controllers/admin/typus_users_controller_test.rb +0 -156
- data/test/app/controllers/admin/users_controller_test.rb +0 -106
- data/test/app/controllers/admin/views_controller_test.rb +0 -36
- data/test/app/helpers/admin/base_helper_test.rb +0 -83
- data/test/app/helpers/admin/dashboard_helper_test.rb +0 -32
- data/test/app/helpers/admin/file_preview_helper_test.rb +0 -90
- data/test/app/helpers/admin/filters_helper_test.rb +0 -166
- data/test/app/helpers/admin/form_helper_test.rb +0 -126
- data/test/app/helpers/admin/list_helper_test.rb +0 -76
- data/test/app/helpers/admin/relationships_helper_test.rb +0 -19
- data/test/app/helpers/admin/resources_helper_test.rb +0 -46
- data/test/app/helpers/admin/search_helper_test.rb +0 -60
- data/test/app/helpers/admin/sidebar_helper_test.rb +0 -34
- data/test/app/helpers/admin/table_helper_test.rb +0 -241
- data/test/app/mailers/admin/mailer_test.rb +0 -32
- data/test/app/models/admin_user_test.rb +0 -5
- data/test/app/models/typus_user_roles_test.rb +0 -125
- data/test/app/models/typus_user_test.rb +0 -228
- data/test/config/routes_test.rb +0 -29
- data/test/factories.rb +0 -122
- data/test/fixtures/config/broken/application.yml +0 -68
- data/test/fixtures/config/broken/application_roles.yml +0 -20
- data/test/fixtures/config/broken/empty.yml +0 -0
- data/test/fixtures/config/broken/empty_roles.yml +0 -0
- data/test/fixtures/config/broken/undefined.yml +0 -3
- data/test/fixtures/config/broken/undefined_roles.yml +0 -6
- data/test/fixtures/config/default/typus.yml +0 -13
- data/test/fixtures/config/default/typus_roles.yml +0 -2
- data/test/fixtures/config/empty/empty_01.yml +0 -0
- data/test/fixtures/config/empty/empty_01_roles.yml +0 -0
- data/test/fixtures/config/empty/empty_02.yml +0 -0
- data/test/fixtures/config/empty/empty_02_roles.yml +0 -0
- data/test/fixtures/config/locales/es.yml +0 -10
- data/test/fixtures/config/namespaced/application.yml +0 -5
- data/test/fixtures/config/namespaced/application_roles.yml +0 -2
- data/test/fixtures/config/ordered/001_roles.yml +0 -2
- data/test/fixtures/config/ordered/002_roles.yml +0 -2
- data/test/fixtures/config/unordered/app_one_roles.yml +0 -2
- data/test/fixtures/config/unordered/app_two_roles.yml +0 -2
- data/test/lib/support/active_record_test.rb +0 -174
- data/test/lib/support/fake_user_test.rb +0 -63
- data/test/lib/support/hash_test.rb +0 -29
- data/test/lib/support/object_test.rb +0 -17
- data/test/lib/support/string_test.rb +0 -98
- data/test/lib/typus/configuration_test.rb +0 -46
- data/test/lib/typus/controller/actions_test.rb +0 -141
- data/test/lib/typus/controller/associations_test.rb +0 -7
- data/test/lib/typus/controller/autocomplete_test.rb +0 -7
- data/test/lib/typus/controller/filters_test.rb +0 -73
- data/test/lib/typus/controller/format_test.rb +0 -7
- data/test/lib/typus/i18n_test.rb +0 -9
- data/test/lib/typus/orm/active_record/class_methods_test.rb +0 -390
- data/test/lib/typus/orm/active_record/search_test.rb +0 -330
- data/test/lib/typus/regex_test.rb +0 -53
- data/test/lib/typus/resources_test.rb +0 -41
- data/test/lib/typus_test.rb +0 -142
- data/test/test_helper.rb +0 -15
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
|
|
3
|
-
=begin
|
|
4
|
-
|
|
5
|
-
What's being tested here?
|
|
6
|
-
|
|
7
|
-
- Unrelate "Comment" from "Post" (Post#comments)
|
|
8
|
-
- Search by "Posts.title" (Post#comments)
|
|
9
|
-
|
|
10
|
-
=end
|
|
11
|
-
|
|
12
|
-
class Admin::CommentsControllerTest < ActionController::TestCase
|
|
13
|
-
|
|
14
|
-
setup do
|
|
15
|
-
@request.session[:typus_user_id] = Factory(:typus_user).id
|
|
16
|
-
@request.env['HTTP_REFERER'] = '/admin/categories'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
context "Unrelate" do
|
|
20
|
-
|
|
21
|
-
##
|
|
22
|
-
# We are in:
|
|
23
|
-
#
|
|
24
|
-
# /admin/posts/edit/1
|
|
25
|
-
#
|
|
26
|
-
# And we see a list of comments under it:
|
|
27
|
-
#
|
|
28
|
-
# /admin/comments/unrelate/1?resource=Post&resource_id=1
|
|
29
|
-
# /admin/comments/unrelate/2?resource=Post&resource_id=1
|
|
30
|
-
#
|
|
31
|
-
# Notice that unrelating an item doesn't remove it from database unless
|
|
32
|
-
# defined on the model.
|
|
33
|
-
#
|
|
34
|
-
##
|
|
35
|
-
|
|
36
|
-
should "unrelate comment from post" do
|
|
37
|
-
comment = Factory(:comment)
|
|
38
|
-
@post = comment.post
|
|
39
|
-
|
|
40
|
-
assert_difference('@post.comments.count', -1) do
|
|
41
|
-
post :unrelate, :id => comment.id, :resource => 'Post', :resource_id => @post.id
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
assert comment.reload.post.nil?
|
|
45
|
-
|
|
46
|
-
assert_response :redirect
|
|
47
|
-
assert_redirected_to @request.env['HTTP_REFERER']
|
|
48
|
-
assert_equal "Post successfully updated.", flash[:notice]
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
context "Search" do
|
|
54
|
-
|
|
55
|
-
##
|
|
56
|
-
# We are in:
|
|
57
|
-
#
|
|
58
|
-
# /admin/posts
|
|
59
|
-
#
|
|
60
|
-
# And we can search by "posts.title" because "Comment" is belongs_to :post
|
|
61
|
-
#
|
|
62
|
-
#
|
|
63
|
-
##
|
|
64
|
-
|
|
65
|
-
should "search in Posts.title from Comments list" do
|
|
66
|
-
post_1 = Factory(:post, :title => "A title with_keyword")
|
|
67
|
-
comment_1 = Factory(:comment, :post => post_1)
|
|
68
|
-
|
|
69
|
-
post_2 = Factory(:post, :title => "A title without_keyword")
|
|
70
|
-
comment_2 = Factory(:comment, :post => post_2)
|
|
71
|
-
|
|
72
|
-
post :index, {:search => "with_keyword" }
|
|
73
|
-
assert_equal [comment_1], assigns(:items)
|
|
74
|
-
assert_not_equal [comment_2], assigns(:items)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
end
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
|
|
3
|
-
class Admin::DashboardControllerTest < ActionController::TestCase
|
|
4
|
-
|
|
5
|
-
context "When authentication is http_basic" do
|
|
6
|
-
|
|
7
|
-
setup do
|
|
8
|
-
Admin::DashboardController.send :include, Typus::Authentication::HttpBasic
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
should "return a 401 message when no credentials sent" do
|
|
12
|
-
get :show
|
|
13
|
-
assert_response :unauthorized
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
should "authenticate user with valid password" do
|
|
17
|
-
@request.env['HTTP_AUTHORIZATION'] = 'Basic ' + Base64::encode64("admin:columbia")
|
|
18
|
-
get :show
|
|
19
|
-
assert_response :success
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
should "not authenticate user with invalid password" do
|
|
23
|
-
@request.env['HTTP_AUTHORIZATION'] = 'Basic ' + Base64::encode64("admin:admin")
|
|
24
|
-
get :show
|
|
25
|
-
assert_response :unauthorized
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
context "When authentication is none" do
|
|
31
|
-
|
|
32
|
-
setup do
|
|
33
|
-
Admin::DashboardController.send :include, Typus::Authentication::None
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
should "render dashboard" do
|
|
37
|
-
get :show
|
|
38
|
-
assert_response :success
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
context "Not logged" do
|
|
44
|
-
|
|
45
|
-
setup do
|
|
46
|
-
@request.session[:typus_user_id] = nil
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
should "redirect to sign in when not signed in" do
|
|
50
|
-
get :show
|
|
51
|
-
assert_response :redirect
|
|
52
|
-
assert_redirected_to new_admin_session_path
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
should "verify_a_removed_role_cannot_sign_in" do
|
|
58
|
-
typus_user = Factory(:typus_user, :role => "removed")
|
|
59
|
-
@request.session[:typus_user_id] = typus_user.id
|
|
60
|
-
|
|
61
|
-
get :show
|
|
62
|
-
|
|
63
|
-
assert_response :redirect
|
|
64
|
-
assert_redirected_to new_admin_session_path
|
|
65
|
-
assert_nil @request.session[:typus_user_id]
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
context "Admin is logged and gets dashboard" do
|
|
69
|
-
|
|
70
|
-
setup do
|
|
71
|
-
@typus_user = Factory(:typus_user)
|
|
72
|
-
@request.session[:typus_user_id] = @typus_user.id
|
|
73
|
-
get :show
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
teardown do
|
|
77
|
-
TypusUser.delete_all
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
should "render dashboard" do
|
|
81
|
-
assert_response :success
|
|
82
|
-
assert_template "show"
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
should "render admin layout" do
|
|
86
|
-
assert_template "layouts/admin/base"
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
should "verify title" do
|
|
90
|
-
assert_select "title", "Typus — Dashboard"
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
should "verify link to session sign out" do
|
|
94
|
-
link = %(href="/admin/session")
|
|
95
|
-
assert_match link, @response.body
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
should "verify link to edit user" do
|
|
99
|
-
link = %(href="/admin/typus_users/edit/#{@request.session[:typus_user_id]})
|
|
100
|
-
assert_match link, @response.body
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
should "verify we can set our own partials" do
|
|
104
|
-
partials = %w( _sidebar.html.erb )
|
|
105
|
-
partials.each { |p| assert_match p, @response.body }
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
context "Security" do
|
|
111
|
-
|
|
112
|
-
setup do
|
|
113
|
-
@typus_user = Factory(:typus_user)
|
|
114
|
-
@request.session[:typus_user_id] = @typus_user.id
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
teardown do
|
|
118
|
-
TypusUser.delete_all
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
should "block users_on_the_fly" do
|
|
122
|
-
@typus_user.status = false
|
|
123
|
-
@typus_user.save
|
|
124
|
-
|
|
125
|
-
get :show
|
|
126
|
-
|
|
127
|
-
assert_response :redirect
|
|
128
|
-
assert_redirected_to new_admin_session_path
|
|
129
|
-
assert_nil @request.session[:typus_user_id]
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
should "sign out user when role does not longer exist" do
|
|
133
|
-
@typus_user.role = 'unexisting'
|
|
134
|
-
@typus_user.save
|
|
135
|
-
|
|
136
|
-
get :show
|
|
137
|
-
|
|
138
|
-
assert_response :redirect
|
|
139
|
-
assert_redirected_to new_admin_session_path
|
|
140
|
-
assert_nil @request.session[:typus_user_id]
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
context "When designer is logged in" do
|
|
146
|
-
|
|
147
|
-
setup do
|
|
148
|
-
@request.session[:typus_user_id] = Factory(:typus_user, :role => "designer").id
|
|
149
|
-
get :show
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
should "not have links to new posts" do
|
|
153
|
-
assert_no_match /\/admin\/posts\/new/, @response.body
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
should "not have links to new typus_users" do
|
|
157
|
-
assert_no_match /\/admin\/typus_users\/new/, @response.body
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
end
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
|
|
3
|
-
=begin
|
|
4
|
-
|
|
5
|
-
What's being tested here?
|
|
6
|
-
|
|
7
|
-
- Polymorphic associations.
|
|
8
|
-
|
|
9
|
-
=end
|
|
10
|
-
|
|
11
|
-
class Admin::ImageHoldersControllerTest < ActionController::TestCase
|
|
12
|
-
|
|
13
|
-
setup do
|
|
14
|
-
@typus_user = Factory(:typus_user)
|
|
15
|
-
@request.session[:typus_user_id] = @typus_user.id
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "create polymorphic association" do
|
|
19
|
-
|
|
20
|
-
setup do
|
|
21
|
-
@bird = Factory(:bird)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
should "contain a message" do
|
|
25
|
-
get :new, { :resource => @bird.class.name, :resource_id => @bird.id }
|
|
26
|
-
assert_select 'body div#flash', "Cancel adding a new image holder?"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
should "work" do
|
|
30
|
-
assert_difference('@bird.image_holders.count') do
|
|
31
|
-
post :create, { :image_holder => { :name => "ImageHolder" },
|
|
32
|
-
:resource => "Bird", :resource_id => @bird.id }
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
assert_response :redirect
|
|
36
|
-
assert_redirected_to "http://test.host/admin/birds/edit/#{@bird.id}"
|
|
37
|
-
assert_equal "Bird successfully updated.", flash[:notice]
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
##
|
|
43
|
-
# TODO: Eventually this code should be run in the Original model, so ideally
|
|
44
|
-
# a Bird unrelates ImageHolder and not ImageHolder unrelates Bird.
|
|
45
|
-
#
|
|
46
|
-
context "unrelate" do
|
|
47
|
-
|
|
48
|
-
##
|
|
49
|
-
# We are in:
|
|
50
|
-
#
|
|
51
|
-
# /admin/birds/edit/1
|
|
52
|
-
#
|
|
53
|
-
# And we see a list of comments under it:
|
|
54
|
-
#
|
|
55
|
-
# /admin/image_holders/unrelate/1?resource=Bird&resource_id=1
|
|
56
|
-
# /admin/image_holders/unrelate/2?resource=Bird&resource_id=1
|
|
57
|
-
# ...
|
|
58
|
-
##
|
|
59
|
-
|
|
60
|
-
setup do
|
|
61
|
-
@image_holder = Factory(:image_holder)
|
|
62
|
-
@bird = Factory(:bird)
|
|
63
|
-
@bird.image_holders << @image_holder
|
|
64
|
-
@request.env['HTTP_REFERER'] = "/admin/birds/edit/#{@bird.id}"
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
should "work" do
|
|
68
|
-
assert_difference('@bird.image_holders.count', -1) do
|
|
69
|
-
post :unrelate, :id => @image_holder.id, :resource => "Bird", :resource_id => @bird.id
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
end
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
|
|
3
|
-
=begin
|
|
4
|
-
|
|
5
|
-
What's being tested here?
|
|
6
|
-
|
|
7
|
-
- Invoice belongs_to Order
|
|
8
|
-
|
|
9
|
-
=end
|
|
10
|
-
|
|
11
|
-
class Admin::InvoicesControllerTest < ActionController::TestCase
|
|
12
|
-
|
|
13
|
-
setup do
|
|
14
|
-
@typus_user = Factory(:typus_user)
|
|
15
|
-
@request.session[:typus_user_id] = @typus_user.id
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
##
|
|
19
|
-
# Here we are using the create_with_back_to method.
|
|
20
|
-
#
|
|
21
|
-
# /admin/invoices/new?back_to=&order_id=4&resource=Order&resource_id=4
|
|
22
|
-
#
|
|
23
|
-
context "Create an invoice from an Order" do
|
|
24
|
-
|
|
25
|
-
setup do
|
|
26
|
-
@order = Factory(:order)
|
|
27
|
-
@invoice = { :number => "Invoice#0000001" }
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
should "initialize the object with the params passed on the url" do
|
|
31
|
-
get :new, { :resource => "Order", :resource => "Order", :order_id => @order.id }
|
|
32
|
-
assert assigns(:item)
|
|
33
|
-
assert_equal @order.id, assigns(:item).order_id
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# TODO: Take a look at this to refactor the create method.
|
|
37
|
-
should "create new invoice assign it to order and redirect to order" do
|
|
38
|
-
@invoice = { :number => "Invoice#0000001", :order_id => @order.id }
|
|
39
|
-
|
|
40
|
-
assert_difference('Invoice.count') do
|
|
41
|
-
post :create, { :invoice => @invoice, :resource => "Order", :order_id => @order.id }
|
|
42
|
-
end
|
|
43
|
-
assert_response :redirect
|
|
44
|
-
assert_redirected_to "/admin/orders/edit/#{@order.id}"
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
should_eventually "raise an error if we try to add an invoice to an order which already has an invoice" do
|
|
48
|
-
@invoice = Factory(:invoice)
|
|
49
|
-
get :new, { :resource => "Order", :resource_id => @invoice.order.id, :order_id => @invoice.order.id }
|
|
50
|
-
assert_response :unprocessable_entity
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
should_eventually "raise an error if we try to create an invoice to an order which already has an invoice" do
|
|
54
|
-
@invoice = Factory(:invoice)
|
|
55
|
-
post :create, { :invoice => { :number => "Invoice#0000001" },
|
|
56
|
-
:resource => "Order", :resource_id => @invoice.order.id, :order_id => @invoice.order.id }
|
|
57
|
-
assert_response :unprocessable_entity
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
context "Unrelate" do
|
|
63
|
-
|
|
64
|
-
setup do
|
|
65
|
-
@invoice = Factory(:invoice)
|
|
66
|
-
@order = @invoice.order
|
|
67
|
-
@request.env['HTTP_REFERER'] = "/admin/orders/edit/#{@order.id}"
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
should "work for unrelate Invoice from Order" do
|
|
71
|
-
post :unrelate, :id => @invoice.id, :resource => 'Order', :resource_id => @order.id
|
|
72
|
-
assert @order.reload.invoice.nil?
|
|
73
|
-
assert_equal "Order successfully updated.", flash[:notice]
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
|
|
3
|
-
=begin
|
|
4
|
-
|
|
5
|
-
What's being tested here?
|
|
6
|
-
|
|
7
|
-
- Order has_one Invoice
|
|
8
|
-
|
|
9
|
-
=end
|
|
10
|
-
|
|
11
|
-
class Admin::OrdersControllerTest < ActionController::TestCase
|
|
12
|
-
|
|
13
|
-
setup do
|
|
14
|
-
@typus_user = Factory(:typus_user)
|
|
15
|
-
@request.session[:typus_user_id] = @typus_user.id
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
|
|
3
|
-
=begin
|
|
4
|
-
|
|
5
|
-
What's being tested here?
|
|
6
|
-
|
|
7
|
-
- Scopes
|
|
8
|
-
|
|
9
|
-
=end
|
|
10
|
-
|
|
11
|
-
class Admin::PagesControllerTest < ActionController::TestCase
|
|
12
|
-
|
|
13
|
-
setup do
|
|
14
|
-
@typus_user = Factory(:typus_user)
|
|
15
|
-
@request.session[:typus_user_id] = @typus_user.id
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
teardown do
|
|
19
|
-
Page.delete_all
|
|
20
|
-
TypusUser.delete_all
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
context "index" do
|
|
24
|
-
|
|
25
|
-
setup do
|
|
26
|
-
Factory(:page)
|
|
27
|
-
Factory(:page, :status => false)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
should "return scoped results" do
|
|
31
|
-
assert Page.count.eql?(1)
|
|
32
|
-
get :index
|
|
33
|
-
assert assigns(:items).size.eql?(1)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
end
|