added crash dumps and tests

This commit is contained in:
Mike Slemmer 2013-07-31 18:46:24 -07:00
parent ab46fffa9b
commit a58db24d15
4 changed files with 36 additions and 1 deletions

View File

@ -71,6 +71,7 @@ require "jam_ruby/models/recording"
require "jam_ruby/models/recorded_track"
require "jam_ruby/models/mix"
require "jam_ruby/models/claimed_recording"
require "jam_ruby/models/crash_dump"
include Jampb

View File

@ -5,7 +5,12 @@ module JamRuby
@@dictionary = nil
def self.dictionary
@@dictionary ||= YAML.load_file(@@dictionary_file)
if File.exists? @@dictionary_file
@@dictionary ||= YAML.load_file(@@dictionary_file)
else
@@dictionary = []
end
@@dictionary
end
def self.check_word(word)

View File

@ -0,0 +1,10 @@
module JamRuby
class CrashDump < ActiveRecord::Base
self.table_name = "crash_dumps"
self.primary_key = 'id'
validates :client_type, presence: true
end
end

View File

@ -0,0 +1,19 @@
require 'spec_helper'
describe CrashDump do
before do
end
it "should fail to save a crash dump without a client_type" do
CrashDump.new(:client_type => "").should_not be_valid
end
it "should be able to save a crash dump with JUST a client_type" do
@cd = CrashDump.new
@cd.client_type = "Win32"
@cd.should be_valid
@cd.save
CrashDump.first.id.should == @cd.id
end
end