-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose an aggregate count of pending submissions. Close #129.
Add methods to link auser to all the groups they lead and feeds they own. Use those methods to create an instance variable with the count of pending submissions. We'll refactor this implementation to be more effecient later.
- Loading branch information
Showing
6 changed files
with
56 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'test_helper' | ||
|
||
class FeedsControllerTest < ActionController::TestCase | ||
include Devise::TestHelpers | ||
|
||
def setup | ||
request.env["devise.mapping"] = Devise.mappings[:user] | ||
end | ||
|
||
test "must sign in before new" do | ||
get :new | ||
assert_login_failure | ||
end | ||
|
||
test "not signed in user has nothing to moderate" do | ||
get :index | ||
assert assigns(:pending_submissions_count) | ||
assert_equal assigns(:pending_submissions_count), 0 | ||
end | ||
|
||
test "moderator has pending submissions" do | ||
sign_in users(:katie) | ||
get :index | ||
assert assigns(:pending_submissions_count) | ||
assert_equal assigns(:pending_submissions_count), 1 | ||
end | ||
|
||
end |