lib/rspec/models/unidom/action/searching_spec.rb in unidom-action-1.17.5 vs lib/rspec/models/unidom/action/searching_spec.rb in unidom-action-1.17.6

- old
+ new

@@ -66,140 +66,26 @@ { platform_name: '1'*platform_name_max_length } => 0, { platform_name: 'A'*platform_name_max_length } => 0, { platform_name: '1'*(platform_name_max_length+1) } => 1, { platform_name: 'A'*(platform_name_max_length+1) } => 1 - it_behaves_like 'validates', model_attributes, :platform_version, - { } => 0, - { platform_version: nil } => 2, - { platform_version: '' } => 2, - { platform_version: '1' } => 0, - { platform_version: 1 } => 0, - { platform_version: 'A' } => 1, - { platform_version: '1.23' } => 1, - { platform_version: 1.23 } => 1, - { platform_version: '-0.01' } => 1, - { platform_version: -0.01 } => 1, - { platform_version: '0' } => 0, - { platform_version: 0 } => 0, - { platform_version: '0.01' } => 1, - { platform_version: 0.01 } => 1, - { platform_version: '999999999' } => 0, - { platform_version: 999_999_999 } => 0, - { platform_version: '1000000000' } => 0, - { platform_version: 1_000_000_000 } => 0, - { platform_version: '1_000_000_001' } => 1, - { platform_version: 1_000_000_001 } => 1 + it_behaves_like 'validates numericality', model_attributes, :platform_version, + range: 0..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true, only_integer: true - it_behaves_like 'validates', model_attributes, :found_count, - { } => 0, - { found_count: nil } => 2, - { found_count: '' } => 2, - { found_count: '1' } => 0, - { found_count: 1 } => 0, - { found_count: 'A' } => 1, - { found_count: '1.23' } => 1, - { found_count: 1.23 } => 1, - { found_count: '-0.01' } => 1, - { found_count: -0.01 } => 1, - { found_count: '0' } => 0, - { found_count: 0 } => 0, - { found_count: '0.01' } => 1, - { found_count: 0.01 } => 1, - { found_count: '999999999' } => 0, - { found_count: 999_999_999 } => 0, - { found_count: '1000000000' } => 0, - { found_count: 1_000_000_000 } => 0, - { found_count: '1_000_000_001' } => 1, - { found_count: 1_000_000_001 } => 1 + it_behaves_like 'validates numericality', model_attributes, :found_count, + range: 0..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true, only_integer: true - it_behaves_like 'validates', model_attributes, :shown_count, - { } => 0, - { shown_count: nil } => 2, - { shown_count: '' } => 2, - { shown_count: '1' } => 0, - { shown_count: 1 } => 0, - { shown_count: 'A' } => 1, - { shown_count: '1.23' } => 1, - { shown_count: 1.23 } => 1, - { shown_count: '-0.01' } => 1, - { shown_count: -0.01 } => 1, - { shown_count: '0' } => 0, - { shown_count: 0 } => 0, - { shown_count: '0.01' } => 1, - { shown_count: 0.01 } => 1, - { shown_count: '999999999' } => 0, - { shown_count: 999_999_999 } => 0, - { shown_count: '1000000000' } => 0, - { shown_count: 1_000_000_000 } => 0, - { shown_count: '1_000_000_001' } => 1, - { shown_count: 1_000_000_001 } => 1 + it_behaves_like 'validates numericality', model_attributes, :shown_count, + range: 0..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true, only_integer: true - it_behaves_like 'validates', model_attributes, :per_page, - { } => 0, - { per_page: nil } => 2, - { per_page: '' } => 2, - { per_page: '1' } => 0, - { per_page: 1 } => 0, - { per_page: 'A' } => 1, - { per_page: '1.23' } => 1, - { per_page: 1.23 } => 1, - { per_page: '-0.01' } => 1, - { per_page: -0.01 } => 1, - { per_page: '0' } => 0, - { per_page: 0 } => 0, - { per_page: '0.01' } => 1, - { per_page: 0.01 } => 1, - { per_page: '999999999' } => 0, - { per_page: 999_999_999 } => 0, - { per_page: '1000000000' } => 0, - { per_page: 1_000_000_000 } => 0, - { per_page: '1_000_000_001' } => 1, - { per_page: 1_000_000_001 } => 1 + it_behaves_like 'validates numericality', model_attributes, :per_page, + range: 0..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true, only_integer: true - it_behaves_like 'validates', model_attributes, :total_pages, - { } => 0, - { total_pages: nil } => 2, - { total_pages: '' } => 2, - { total_pages: '1' } => 0, - { total_pages: 1 } => 0, - { total_pages: 'A' } => 1, - { total_pages: '1.23' } => 1, - { total_pages: 1.23 } => 1, - { total_pages: '-0.01' } => 1, - { total_pages: -0.01 } => 1, - { total_pages: '0' } => 0, - { total_pages: 0 } => 0, - { total_pages: '0.01' } => 1, - { total_pages: 0.01 } => 1, - { total_pages: '999999999' } => 0, - { total_pages: 999_999_999 } => 0, - { total_pages: '1000000000' } => 0, - { total_pages: 1_000_000_000 } => 0, - { total_pages: '1_000_000_001' } => 1, - { total_pages: 1_000_000_001 } => 1 + it_behaves_like 'validates numericality', model_attributes, :total_pages, + range: 0..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true, only_integer: true - it_behaves_like 'validates', model_attributes, :current_page, - { } => 0, - { current_page: nil } => 2, - { current_page: '' } => 2, - { current_page: '1' } => 0, - { current_page: 1 } => 0, - { current_page: 'A' } => 1, - { current_page: '1.23' } => 1, - { current_page: 1.23 } => 1, - { current_page: '-0.01' } => 1, - { current_page: -0.01 } => 1, - { current_page: '0' } => 0, - { current_page: 0 } => 0, - { current_page: '0.01' } => 1, - { current_page: 0.01 } => 1, - { current_page: '999999999' } => 0, - { current_page: 999_999_999 } => 0, - { current_page: '1000000000' } => 0, - { current_page: 1_000_000_000 } => 0, - { current_page: '1_000_000_001' } => 1, - { current_page: 1_000_000_001 } => 1 + it_behaves_like 'validates numericality', model_attributes, :current_page, + range: 0..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true, only_integer: true end end