mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-04 15:01:48 +01:00
Add a Sidebar class to represent the side bar
Start using it throughout the rest of the app instead of the various instance variables
This commit is contained in:
parent
2883d1b7f4
commit
8d24f5105a
5 changed files with 66 additions and 17 deletions
29
test/models/sidebar_test.rb
Normal file
29
test/models/sidebar_test.rb
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
require 'test_helper'
|
||||
|
||||
class SidebarTest < ActiveSupport::TestCase
|
||||
|
||||
def setup
|
||||
@sidebar = Sidebar.new(users(:admin_user))
|
||||
end
|
||||
|
||||
def test_it_gets_the_active_contexts
|
||||
assert @sidebar.active_contexts == users(:admin_user).contexts.active
|
||||
end
|
||||
|
||||
def test_it_gets_the_hidden_contexts
|
||||
assert @sidebar.hidden_contexts == users(:admin_user).contexts.hidden
|
||||
end
|
||||
|
||||
def test_it_gets_the_active_projects
|
||||
assert @sidebar.active_projects == users(:admin_user).projects.active
|
||||
end
|
||||
|
||||
def test_it_gets_the_hidden_projects
|
||||
assert @sidebar.hidden_projects == users(:admin_user).projects.hidden
|
||||
end
|
||||
|
||||
def test_it_gets_the_completed_projects
|
||||
assert @sidebar.completed_projects == users(:admin_user).projects.completed
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue