Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Subclasses with Strategies: Step Four
* Move subclass-specific behavior into strategies
- Loading branch information
Showing
8 changed files
with
37 additions
and
26 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
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
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
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
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 |
---|---|---|
@@ -1,16 +1,3 @@ | ||
describe MultipleChoiceQuestion do | ||
it { should have_many(:options) } | ||
end | ||
|
||
describe MultipleChoiceQuestion, '#options_for_form' do | ||
it 'adds empty options when none are present' do | ||
question = build_stubbed(:multiple_choice_question, options: []) | ||
question.options_for_form.count.should == 3 | ||
end | ||
|
||
it 'leaves existing options alone' do | ||
options = [Option.new(text: 'hey'), Option.new(text: 'hello')] | ||
question = build_stubbed(:multiple_choice_question, options: options) | ||
question.options_for_form.map(&:text).should match_array(['hey', 'hello']) | ||
end | ||
end |
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
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
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