Sha256: c4b862fc90370f73a3ef3943776c6cee6d8aa8ea9dd3016fc26d2fa18de40aa7
Contents?: true
Size: 1.28 KB
Versions: 5
Compression:
Stored size: 1.28 KB
Contents
# frozen_string_literal: true require "spec_helper" RSpec.describe "Tag names for scopes" do it "returns tag names for a given model" do Article.create :tag_names => %w[ koala wombat ] Article.create :tag_names => %w[ cassowary ] expect(Gutentag::Tag.names_for_scope(Article)). to match_array(%w[ koala wombat cassowary ]) end it "returns tag names for a given scope" do Article.create :title => "mammals", :tag_names => %w[ koala wombat ] Article.create :title => "birds", :tag_names => %w[ cassowary ] expect(Gutentag::Tag.names_for_scope(Article.where(:title => "mammals"))). to match_array(%w[ koala wombat ]) end it "does not duplicate tag names for a given model/scope" do Article.create :tag_names => %w[ koala wombat ] Article.create :tag_names => %w[ cassowary ] Article.create :tag_names => %w[ cassowary wombat ] expect(Gutentag::Tag.names_for_scope(Article)). to match_array(%w[ koala wombat cassowary ]) end it "returns an empty array for an empty scope" do Article.create :title => "mammals", :tag_names => %w[ koala wombat ] Article.create :title => "birds", :tag_names => %w[ cassowary ] expect(Gutentag::Tag.names_for_scope(Article.where(:title => "reptiles"))). to match_array([]) end end
Version data entries
5 entries across 5 versions & 1 rubygems