|
9 | 9 |
|
10 | 10 | result = hider.summarize(question) |
11 | 11 |
|
12 | | - result.title.should eq question.title |
13 | | - result.value.should eq UnansweredQuestionHider::NO_ANSWER |
| 12 | + result.should eq UnansweredQuestionHider::NO_ANSWER |
14 | 13 | end |
15 | 14 |
|
16 | 15 | it 'delegates to the summarizer given a user with an answer' do |
17 | | - summary = stub('summary') |
18 | 16 | user = build_stubbed(:user) |
19 | 17 | question = stub_answered_question(user, true) |
20 | | - summarizer = stub_summarizer(question, summary) |
| 18 | + summarizer = stub_summarizer(question, 'value') |
21 | 19 | hider = UnansweredQuestionHider.new(summarizer, user) |
22 | 20 |
|
23 | 21 | result = hider.summarize(question) |
24 | 22 |
|
25 | | - result.should eq summary |
| 23 | + result.should eq 'value' |
26 | 24 | end |
27 | 25 |
|
28 | 26 | it 'delegates to the summarizer without a user' do |
29 | | - summary = stub('summary') |
30 | 27 | question = build_stubbed(:question) |
31 | | - summarizer = stub_summarizer(question, summary) |
| 28 | + summarizer = stub_summarizer(question, 'value') |
32 | 29 | hider = UnansweredQuestionHider.new(summarizer, nil) |
33 | 30 |
|
34 | 31 | result = hider.summarize(question) |
35 | 32 |
|
36 | | - result.should eq summary |
| 33 | + result.should eq 'value' |
37 | 34 | end |
38 | 35 |
|
39 | | - def stub_summarizer(question, summary) |
| 36 | + def stub_summarizer(question, value) |
40 | 37 | stub('summarizer').tap do |summarizer| |
41 | | - question.stubs(:summary_using).with(summarizer).returns(summary) |
| 38 | + summarizer.stubs(:summarize).with(question).returns(value) |
42 | 39 | end |
43 | 40 | end |
44 | 41 |
|
|
0 commit comments