Sha256: 37133bc36d47457ef09bad1cc3aa38100b2e24b64cb4ccbf44e4397dd399e92a
Contents?: true
Size: 1023 Bytes
Versions: 2
Compression:
Stored size: 1023 Bytes
Contents
require "spec_helper" describe Recommendations::User::Similarity do describe "#update similarity" do subject {Recommendations::User.new("1")} let :ratings do { "1" => { "1" => "5", "2" => "4", "3" => "3", "4" => "2" }, "2" => { "1" => "5", "2" => "4", "3" => "2", "4" => "1" }, "3" => { "1" => "1", "2" => "2", "3" => "1", "4" => "1" }, "4" => { "1" => "4", "2" => "3", "3" => "2", "4" => "1" } } end before do ratings.each do |user_id, user_ratings| user = Recommendations::User.new(user_id) user_ratings.each {|item_id, rating| user.rate(item_id, rating)} end end it "update similars" do subject.update_similars subject.similars.should == %w(2 4 3) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
recommendations2-0.0.5 | spec/recommendations/user/similarity_spec.rb |
recommendations2-0.0.4 | spec/recommendations/user/similarity_spec.rb |