Skip to content

Commit

Permalink
Deleted instances of answer/answers (publiclab#9487)
Browse files Browse the repository at this point in the history
  • Loading branch information
TildaDares authored and reginaalyssa committed Oct 16, 2021
1 parent 3ccdf08 commit 4b9ce64
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
2 changes: 0 additions & 2 deletions app/controllers/stats_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ def index
@weekly_notes = Node.past_week.select(:type).where(type: 'note').size
@weekly_wikis = Revision.past_week.size
@weekly_questions = Node.questions.past_week.size
@weekly_answers = Answer.past_week.size
@weekly_members = User.past_week.where(status: 1).size
@monthly_notes = Node.past_month.select(:type).where(type: 'note').size
@monthly_wikis = Revision.past_month.size
@monthly_members = User.past_month.where(status: 1).size
@monthly_questions = Node.questions.past_month.size
@monthly_answers = Answer.past_month.size

@notes_per_week_period = Node.frequency('note', @start, @end).round(2)
@edits_per_week_period = Revision.frequency(@start, @end).round(2)
Expand Down
8 changes: 2 additions & 6 deletions test/functional/questions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,21 @@ def setup
assert_response :success
end

test 'should not show answer accept button to users if not logged in' do
test 'should not show accept button to users if not logged in' do
note = nodes(:question)
answer = answers(:one)

get :show, params: { author: note.author.name, date: Time.at(note.created).strftime('%m-%d-%Y'), id: note.title.parameterize }

assert_response :success
assert_select '#answer-' + answer.id.to_s + '-accept', 0
end

test 'should not show accept answer button to user who is not the author of the question' do
test 'should not show accept button to user who is not the author of the question' do
UserSession.create(users(:bob))
note = nodes(:question)
answer = answers(:one)

get :show, params: { author: note.author.name, date: Time.at(note.created).strftime('%m-%d-%Y'), id: note.title.parameterize }

assert_response :success
assert_select '#answer-' + answer.id.to_s + '-accept', 0
end

test 'should get answered' do
Expand Down
4 changes: 1 addition & 3 deletions test/unit/comment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,10 @@ def setup
assert comment.save
end

test 'should relate answer comments to user and answer but not node' do
answer = answers(:one)
test 'should relate comments to user but not node' do
user = users(:bob)
comment = Comment.new(comment: 'Test comment')
comment.user = user
comment.answer = answer

assert comment.save
assert_equal user.comments.last, comment
Expand Down

0 comments on commit 4b9ce64

Please sign in to comment.