forked from rgravina/okubo
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80fc4b4
commit 1f23d39
Showing
1 changed file
with
35 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
describe ActiveRecall::ItemMethods do | ||
let(:user) { User.create!(name: "Test User") } | ||
let(:item) { Word.create!(kanji: "漢字", kana: "かんじ", translation: "Kanji") } | ||
|
||
before do | ||
user.words << item | ||
end | ||
|
||
describe "#right_answer_for!" do | ||
it "calls right! on the corresponding item" do | ||
expect_any_instance_of(ActiveRecall::Item).to receive(:right!).and_call_original | ||
user.right_answer_for!(item) | ||
end | ||
end | ||
|
||
describe "#wrong_answer_for!" do | ||
it "calls wrong! on the corresponding item" do | ||
expect_any_instance_of(ActiveRecall::Item).to receive(:wrong!).and_call_original | ||
user.wrong_answer_for!(item) | ||
end | ||
end | ||
|
||
xdescribe "#score!" do | ||
let(:grade) { 4 } | ||
|
||
it "calls score! on the corresponding item with the correct grade" do | ||
expect_any_instance_of(ActiveRecall::Item).to receive(:score!).with(grade).and_call_original | ||
user.score!(grade, item) | ||
end | ||
end | ||
end |