Skip to content

Commit

Permalink
Merge pull request #231 from shiotomo/develop
Browse files Browse the repository at this point in the history
judgement機能のテストを追加した
  • Loading branch information
shiotomo committed Mar 21, 2019
2 parents e592de0 + 0a70d73 commit bab99d8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spec/lib/code_candy/judgement_spec.rb
@@ -0,0 +1,22 @@
require 'spec_helper'
require './lib/code_candy/judgement'

describe "judgement" do
before do
@uesr = create(:user, id: 1)
@question = create(:question, id: 1)
@question.answers.create(
input: 'hello',
output: 'hello'
)
end

context "実行したプログラムが正解になること" do
it "Ruby", code_runner: true do
@source_code = "a = gets \n print a"
judgement = CodeCandy::Judgement.new("ruby", @source_code, 1, 1)
result = judgement.exec
expect(result[:answer]).to eq "正解"
end
end
end

0 comments on commit bab99d8

Please sign in to comment.