- check_query(Trace.visible_to(1), [
- :public_trace_file, :identifiable_trace_file, :pending_trace_file
- ])
- check_query(Trace.visible_to(2), [
- :public_trace_file, :anon_trace_file, :trackable_trace_file,
- :identifiable_trace_file, :pending_trace_file
- ])
- check_query(Trace.visible_to(3), [
- :public_trace_file, :identifiable_trace_file, :pending_trace_file
- ])
+ first_user = create(:user)
+ second_user = create(:user)
+ third_user = create(:user)
+ fourth_user = create(:user)
+ public_trace_file = create(:trace, :visibility => "public", :user => first_user)
+ anon_trace_file = create(:trace, :visibility => "private", :user => second_user)
+ identifiable_trace_file = create(:trace, :visibility => "identifiable", :user => first_user)
+ pending_trace_file = create(:trace, :visibility => "public", :user => second_user, :inserted => false)
+ trackable_trace_file = create(:trace, :visibility => "trackable", :user => second_user)
+ _other_trace_file = create(:trace, :visibility => "private", :user => third_user)
+
+ check_query(Trace.visible_to(first_user), [
+ public_trace_file, identifiable_trace_file, pending_trace_file
+ ])
+ check_query(Trace.visible_to(second_user), [
+ public_trace_file, anon_trace_file, trackable_trace_file,
+ identifiable_trace_file, pending_trace_file
+ ])
+ check_query(Trace.visible_to(fourth_user), [
+ public_trace_file, identifiable_trace_file, pending_trace_file
+ ])