Skip to content

Commit

Permalink
Revert "Merge pull request #18386 from yrudman/gaprindashvili-fixed-s…
Browse files Browse the repository at this point in the history
…aving-tag-name"

This reverts commit ac3a51e, reversing
changes made to 5d837f5.

https://bugzilla.redhat.com/show_bug.cgi?id=1668730
  • Loading branch information
simaishi committed Jan 29, 2019
1 parent 1bd334a commit 5fdf738
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
6 changes: 1 addition & 5 deletions app/models/classification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,7 @@ def find_tag
end

def save_tag
if tag.present?
tag.update_attributes(:name => Classification.name2tag(name, parent_id, ns))
else
self.tag = Tag.find_or_create_by_classification_name(name, region_id, ns, parent_id)
end
self.tag = Tag.find_or_create_by_classification_name(name, region_id, ns, parent_id)
end

def delete_all_entries
Expand Down
25 changes: 0 additions & 25 deletions spec/models/classification_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -539,31 +539,6 @@
end
end

describe '#save' do
let(:new_name) { "new_tag_name" }

context "editing existing tag" do
it "updates record in Tag table which linked to this classification" do
classification = FactoryBot.create(:classification_tag, :name => "some_tag_name")
tag = classification.tag
classification.name = new_name
classification.save
expect(tag.id).to eq classification.tag.id
expect(classification.tag.name).to eq(Classification.name2tag(new_name))
end
end

context "saving new tag" do
it "creates new record in Tag table and links it to this classification" do
classification = Classification.new
classification.description = "some description"
classification.name = new_name
classification.save
expect(classification.tag).to eq(Tag.last)
end
end
end

def all_tagged_with(target, all, category = nil)
tagged_with(target, :all => all, :cat => category)
end
Expand Down

0 comments on commit 5fdf738

Please sign in to comment.