Sha256: 3e2f4a1da7e877a44c8a36001f8dec3fff492f5edf192268efcb04d8ba08ec07

Contents?: true

Size: 675 Bytes

Versions: 2

Compression:

Stored size: 675 Bytes

Contents

require 'test_helper'

module Workarea
  module Storefront
    class ReviewsHelperTest < ViewTest
      def test_rating_stars_displays_correct_rating
        assert_match(/1\.0 out of 5 stars/, rating_stars(1))
        assert_match(/2\.5 out of 5 stars/, rating_stars(2.5))
        assert_match(/4\.25 out of 5 stars/, rating_stars(4.251))
      end

      def test_rating_stars_outputs_correct_number_of_stars
        assert_equal(1, rating_stars(1).scan(/<title>star<\/title>/).size)
        assert_equal(4, rating_stars(4.251).scan(/<title>star<\/title>/).size)
        assert_equal(1, rating_stars(4.5).scan(/<title>half_star<\/title>/).size)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-reviews-3.0.9 test/helpers/workarea/storefront/reviews_helper_test.rb
workarea-reviews-3.0.8 test/helpers/workarea/storefront/reviews_helper_test.rb