Sha256: 2316538804755e0b0e0e2f259cede0c5db0309afc61bb131dbca2229c8cf6b9b

Contents?: true

Size: 675 Bytes

Versions: 1

Compression:

Stored size: 675 Bytes

Contents

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

describe Trophy do
   before(:all) do
    @trophy = Trophy.create(user_id:99,generic_file_id:"99")
  end
  after(:all) do
    @trophy.delete
  end

  it "should have a user" do
     @trophy.should respond_to(:user_id)
     @trophy.user_id.should == 99
  end
  it "should have a file" do
     @trophy.should respond_to(:generic_file_id)
     @trophy.generic_file_id.should == "99"
  end

  it "should not allow six trophies" do
     (1..6).each {|n| Trophy.create(user_id:120,generic_file_id:n.to_s)}
     Trophy.where(user_id:120).count.should == 5
     Trophy.where(user_id:120).map(&:delete)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sufia-3.0.0 spec/models/trophy_spec.rb