Commit d7c39b573b7dddb3ad6f2669db0891d838db049c
1 parent
84df5586
Exists in
master
and in
22 other branches
Fix TagsBlock unit test
Showing
4 changed files
with
18 additions
and
12 deletions
Show diff stats
app/models/article.rb
test/unit/tags_block_test.rb
| ... | ... | @@ -8,8 +8,12 @@ class TagsBlockTest < ActiveSupport::TestCase |
| 8 | 8 | @user.articles.build(:name => 'article 2', :tag_list => 'first-tag, second-tag').save! |
| 9 | 9 | @user.articles.build(:name => 'article 3', :tag_list => 'first-tag, second-tag, third-tag').save! |
| 10 | 10 | |
| 11 | - box = Box.create!(:owner => @user) | |
| 12 | - @block = TagsBlock.create!(:box => box) | |
| 11 | + box = Box.new | |
| 12 | + box.owner = @user | |
| 13 | + box.save! | |
| 14 | + @block = TagsBlock.new | |
| 15 | + @block.box = box | |
| 16 | + @block.save | |
| 13 | 17 | end |
| 14 | 18 | attr_reader :block |
| 15 | 19 | ... | ... |
vendor/plugins/acts_as_taggable_on_steroids/lib/tag.rb
vendor/plugins/acts_as_taggable_on_steroids/lib/tag_list.rb
| ... | ... | @@ -40,19 +40,19 @@ class TagList |
| 40 | 40 | end |
| 41 | 41 | |
| 42 | 42 | class << self |
| 43 | - def from(tags) | |
| 44 | - case tags | |
| 45 | - when String | |
| 46 | - new(parse(tags)) | |
| 47 | - when Array | |
| 48 | - new(tags.map(&:to_s)) | |
| 49 | - else | |
| 50 | - new([]) | |
| 43 | + def from(tags) | |
| 44 | + case tags | |
| 45 | + when String | |
| 46 | + new(parse(tags)) | |
| 47 | + when Array | |
| 48 | + new(tags.map(&:to_s)) | |
| 49 | + else | |
| 50 | + new([]) | |
| 51 | 51 | end |
| 52 | 52 | end |
| 53 | 53 | |
| 54 | 54 | def parse(string) |
| 55 | - returning [] do |names| | |
| 55 | + [].tap do |names| | |
| 56 | 56 | string = string.to_s.dup |
| 57 | 57 | |
| 58 | 58 | # Parse the quoted tags | ... | ... |