Sha256: a6a2242ee21a4895dbc6850e28fc9cb0b2fdfa22dfc492e3566874613e373cb7

Contents?: true

Size: 1.63 KB

Versions: 25

Compression:

Stored size: 1.63 KB

Contents

require 'test_helper'
class ReviewsTest < Test::Unit::TestCase
  def setup
    @base_url = "http://bobcatdev.library.nyu.edu"
    @user_id = "N12162279"
    @institution = "NYU"
    @record_id = "nyu_aleph000062856"
  end

  def test_reviews
    reviews = Exlibris::Primo::Reviews.
      new(:base_url => @base_url, :institution => @institution, 
        :user_id => @user_id, :record_id => @record_id)
    VCR.use_cassette('reviews check empty reviews first') do
      assert_not_nil reviews.reviews
      assert(reviews.reviews.empty?)
    end
    VCR.use_cassette('reviews add review') do
      reviews.add_review("Test review", "1", "Scot Thomas")
    end
    VCR.use_cassette('reviews reviews') do
      assert_not_nil reviews.reviews
      assert((not reviews.reviews.empty?))
      assert_equal(1, reviews.reviews.size)
      
    end
    VCR.use_cassette('reviews user') do
      assert_not_nil reviews.user_reviews
      assert((not reviews.user_reviews.empty?))
      assert_equal(2, reviews.user_reviews.size)
    end
    VCR.use_cassette('reviews record') do
      assert_not_nil reviews.record_reviews
      assert((not reviews.record_reviews.empty?))
      assert_equal(1, reviews.record_reviews.size)
    end
    VCR.use_cassette('reviews rating') do
      assert_not_nil reviews.rating_reviews("1")
      assert((not reviews.rating_reviews("1").empty?))
      assert_equal(2, reviews.rating_reviews("1").size)
    end
    VCR.use_cassette('reviews remove review') do
      reviews.remove_review
    end
    VCR.use_cassette('reviews check empty reviews last') do
      assert_not_nil reviews.reviews
      assert(reviews.reviews.empty?)
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
exlibris-primo-2.1.1 test/reviews_test.rb
exlibris-primo-2.1.0 test/reviews_test.rb
exlibris-primo-2.0.0 test/reviews_test.rb
exlibris-primo-1.1.9 test/reviews_test.rb
exlibris-primo-1.1.8 test/reviews_test.rb
exlibris-primo-1.1.7 test/reviews_test.rb
exlibris-primo-1.1.6 test/reviews_test.rb
exlibris-primo-1.1.5 test/reviews_test.rb
exlibris-primo-1.1.4 test/reviews_test.rb
exlibris-primo-1.1.3 test/reviews_test.rb
exlibris-primo-1.1.2 test/reviews_test.rb
exlibris-primo-1.1.1 test/reviews_test.rb
exlibris-primo-1.1.0 test/reviews_test.rb
exlibris-primo-1.0.11 test/reviews_test.rb
exlibris-primo-1.0.10 test/reviews_test.rb
exlibris-primo-1.0.9 test/reviews_test.rb
exlibris-primo-1.0.8 test/reviews_test.rb
exlibris-primo-1.0.7 test/reviews_test.rb
exlibris-primo-1.0.6 test/reviews_test.rb
exlibris-primo-1.0.5 test/reviews_test.rb