Skip to content

Commit

Permalink
Update flow to use Fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
epugh committed Jan 15, 2025
1 parent 62bb3f0 commit e935723
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
1 change: 0 additions & 1 deletion app/jobs/run_judge_judy_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class RunJudgeJudyJob < ApplicationJob
# rubocop:disable Metrics/MethodLength
def perform book, judge, number_of_pairs
counter = 0
puts "the key is #{judge.openai_key}"
llm_service = LlmService.new judge.openai_key, {}
loop do
break if number_of_pairs && counter >= number_of_pairs
Expand Down
17 changes: 3 additions & 14 deletions test/integration/judge_judy_flow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class JudgeJudyFlowTest < ActionDispatch::IntegrationTest
let(:acase) { cases(:shared_with_team) }
let(:team) { teams(:shared) }
let(:user) { users(:random) }
let(:judge_judy) { users(:judge_judy) }

test 'Demonstrate how to work with Judge Judy' do
post users_login_url params: { user: { email: user.email, password: 'password' }, format: :json }
Expand All @@ -18,23 +19,11 @@ class JudgeJudyFlowTest < ActionDispatch::IntegrationTest
assert_includes acase.teams, team
assert_includes book.teams, team

# this is causing issues due to counter cache settings.
# assert_equal 7, book.query_doc_pairs.size

# Set up Judge Judy. Give her a prompt (and an OPENAI KEY)
judge_judy = User.new name: 'judge judy', email: '[email protected]', password: 'password'

# Add her to the team
judge_judy.teams << team
judge_judy.save!

# Add her to the book's list of ai_judges
book.ai_judges << judge_judy
book.save!
assert_includes judge_judy.teams, team
assert_includes book.ai_judges, judge_judy

# Wait for her to judge
perform_enqueued_jobs do
# patch :update, params: data
RunJudgeJudyJob.perform_later(book, judge_judy, nil)
end

Expand Down

0 comments on commit e935723

Please sign in to comment.