Sha256: 5938593f9c16dff3d9d7ca422a061526b7c1204713c0e6539b233c8c66cdbc0e
Contents?: true
Size: 1.57 KB
Versions: 7
Compression:
Stored size: 1.57 KB
Contents
require File.expand_path("../test_helper", __FILE__) class ScopeTest < SearchCop::TestCase def test_scope_name expected = create(:product, :title => "Expected") rejected = create(:product, :notice => "Expected") results = Product.user_search("Expected") assert_includes results, expected refute_includes results, rejected end def test_options expected = create(:product, :title => "Expected") rejected = create(:product, :description => "Expected") results = Product.user_search("Expected") assert_includes results, expected refute_includes results, rejected end def test_custom_scope expected = create(:product, :user => create(:user, :username => "Expected")) rejected = create(:product, :user => create(:user, :username => "Rejected")) results = Product.user_search("user: Expected") assert_includes results, expected refute_includes results, rejected end def test_aliases_with_association expected = create(:product, :user => create(:user, :username => "Expected")) rejected = create(:product, :user => create(:user, :username => "Rejected")) results = Product.search("user: Expected") assert_includes results, expected refute_includes results, rejected end def test_aliases_with_model expected = create(:product, :user => create(:user, :username => "Expected")) rejected = create(:product, :user => create(:user, :username => "Rejected")) results = Product.user_search("user: Expected") assert_includes results, expected refute_includes results, rejected end end
Version data entries
7 entries across 7 versions & 1 rubygems