|
19 | 19 | context "when the user is not an admin" do
|
20 | 20 | it "not returns attributes with customer_id" do
|
21 | 21 | dashboard = OrderDashboard.new
|
| 22 | + dashboard.context = ctx_with_non_admin_user |
22 | 23 | expect(
|
23 |
| - dashboard.permitted_attributes("new", ctx_with_non_admin_user) |
| 24 | + dashboard.permitted_attributes("new") |
24 | 25 | ).not_to include("customer_id")
|
25 | 26 | expect(
|
26 |
| - dashboard.permitted_attributes("create", ctx_with_non_admin_user) |
| 27 | + dashboard.permitted_attributes("create") |
27 | 28 | ).not_to include("customer_id")
|
28 | 29 | end
|
29 | 30 | end
|
30 | 31 |
|
31 | 32 | context "when the user is an admin" do
|
32 | 33 | it "returns attributes with customer_id" do
|
33 | 34 | dashboard = OrderDashboard.new
|
| 35 | + dashboard.context = ctx_with_admin_user |
34 | 36 | expect(
|
35 |
| - dashboard.permitted_attributes("new", ctx_with_admin_user) |
| 37 | + dashboard.permitted_attributes("new") |
36 | 38 | ).to include("customer_id")
|
37 | 39 | expect(
|
38 |
| - dashboard.permitted_attributes("create", ctx_with_admin_user) |
| 40 | + dashboard.permitted_attributes("create") |
39 | 41 | ).to include("customer_id")
|
40 | 42 | end
|
41 | 43 | end
|
|
52 | 54 | context "when the user is not an admin" do
|
53 | 55 | it "not returns attributes with customer_id" do
|
54 | 56 | dashboard = OrderDashboard.new
|
| 57 | + dashboard.context = ctx_with_non_admin_user |
55 | 58 | expect(
|
56 |
| - dashboard.permitted_attributes("edit", ctx_with_non_admin_user) |
| 59 | + dashboard.permitted_attributes("edit") |
57 | 60 | ).not_to include("customer_id")
|
58 | 61 | expect(
|
59 |
| - dashboard.permitted_attributes("update", ctx_with_non_admin_user) |
| 62 | + dashboard.permitted_attributes("update") |
60 | 63 | ).not_to include("customer_id")
|
61 | 64 | end
|
62 | 65 | end
|
63 | 66 |
|
64 | 67 | context "when the user is an admin" do
|
65 | 68 | it "also no returns attributes with customer_id" do
|
66 | 69 | dashboard = OrderDashboard.new
|
| 70 | + dashboard.context = ctx_with_admin_user |
67 | 71 | expect(
|
68 |
| - dashboard.permitted_attributes("edit", ctx_with_admin_user) |
| 72 | + dashboard.permitted_attributes("edit") |
69 | 73 | ).not_to include("customer_id")
|
70 | 74 | expect(
|
71 |
| - dashboard.permitted_attributes("update", ctx_with_admin_user) |
| 75 | + dashboard.permitted_attributes("update") |
72 | 76 | ).not_to include("customer_id")
|
73 | 77 | end
|
74 | 78 | end
|
|
0 commit comments