Revision b597a8a5
Added by Shimon Shtein about 8 years ago
test/unit/host_test.rb | ||
---|---|---|
end
|
||
end
|
||
|
||
describe 'taxonomy scopes' do
|
||
test 'no_location overrides default scope' do
|
||
location = FactoryGirl.create(:location)
|
||
host = FactoryGirl.create(:host, :location => nil)
|
||
Location.stubs(:current).returns(location)
|
||
|
||
assert_nil Host.where(:id => host.id).first
|
||
assert_not_nil Host.no_location.where(:id => host.id).first
|
||
Location.unstub(:current)
|
||
end
|
||
|
||
test 'no_organization overrides default scope' do
|
||
organization = FactoryGirl.create(:organization)
|
||
host = FactoryGirl.create(:host, :organization => nil)
|
||
Organization.stubs(:current).returns(organization)
|
||
|
||
assert_nil Host.where(:id => host.id).first
|
||
assert_not_nil Host.no_organization.where(:id => host.id).first
|
||
Organization.unstub(:current)
|
||
end
|
||
end
|
||
|
||
private
|
||
|
||
def parse_json_fixture(relative_path)
|
Also available in: Unified diff
Fixes #14369 - Removed default scope from host counter in taxonomies