Sha256: 5747eb18d1dadbfa017b1b631ef998331bba4947699662f5079f8b570e1399c4

Contents?: true

Size: 897 Bytes

Versions: 9

Compression:

Stored size: 897 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe ContentHelper, 'calc_distributed_class' do
  include ContentHelper

  it 'should behave as specified in the old test_calc_distributed_class_basic ' do
    calc_distributed_class(0, 0, "prefix", 5, 15).should == 'prefix5'

    (0..10).each do |article|
      calc_distributed_class(article, 10, "prefix", 0, 10).should == "prefix#{article}"
    end

    (0..20).each do |article|
      calc_distributed_class(article, 20, "prefix", 0, 10).should == "prefix#{(article/2).to_i}"
    end

    (0..5).each do |article|
      calc_distributed_class(article, 5, "prefix", 0, 10).should == "prefix#{(article*2).to_i}"
    end
  end

  it "should behave like the old test_calc_distributed_class_offset" do
    (0..10).each do |article|
      calc_distributed_class(article, 10, "prefix", 6, 16).should == "prefix#{article+6}"
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
typo-5.4.4 spec/helpers/content_helper_spec.rb
typo-5.4.3 spec/helpers/content_helper_spec.rb
typo-5.4.2 spec/helpers/content_helper_spec.rb
typo-5.4.1 spec/helpers/content_helper_spec.rb
typo-5.4 spec/helpers/content_helper_spec.rb
typo-5.1.98 spec/helpers/content_helper_spec.rb
typo-5.2 spec/helpers/content_helper_spec.rb
typo-5.2.98 spec/helpers/content_helper_spec.rb
typo-5.3 spec/helpers/content_helper_spec.rb