* artifact_update; changes with sha1
This commit is contained in:
parent
6794547b11
commit
717f076cc7
1
Gemfile
1
Gemfile
|
|
@ -19,6 +19,7 @@ gem 'will_paginate'
|
|||
gem 'actionmailer'
|
||||
gem 'sendgrid'
|
||||
gem 'aws-sdk', '1.8.0'
|
||||
gem 'carrierwave'
|
||||
|
||||
if devenv
|
||||
gem 'jam_db', :path=> "#{workspace}/jam-db/target/ruby_package"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
require "pg"
|
||||
require "active_record"
|
||||
require "carrierwave"
|
||||
require "carrierwave/orm/activerecord"
|
||||
require "jampb"
|
||||
require "uuidtools"
|
||||
require "logging"
|
||||
|
|
@ -19,6 +21,7 @@ require "jam_ruby/version"
|
|||
require "jam_ruby/environment"
|
||||
require "jam_ruby/init"
|
||||
require "jam_ruby/app/mailers/user_mailer"
|
||||
require "jam_ruby/app/uploaders/artifact_uploader"
|
||||
require "jam_ruby/message_factory"
|
||||
require "jam_ruby/models/genre"
|
||||
require "jam_ruby/models/user"
|
||||
|
|
|
|||
|
|
@ -6,10 +6,12 @@ module JamRuby
|
|||
PRODUCTS = ['JamClient/Win32', 'JamClient/MacOSX']
|
||||
|
||||
self.primary_key = 'id'
|
||||
attr_accessible :version, :uri, :sha1, :environment, :product
|
||||
mount_uploader :uri, ArtifactUploader
|
||||
|
||||
validate :version, :presence => true
|
||||
validate :uri, :presence => true
|
||||
validate :sha1, :presence => true
|
||||
validate :sha1, :presence => false
|
||||
validate :environment, presence => true
|
||||
validate :product, :inclusion => {:in => PRODUCTS}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,15 +2,27 @@ require 'spec_helper'
|
|||
|
||||
describe ArtifactUpdate do
|
||||
|
||||
include UsesTempFiles
|
||||
|
||||
ARTIFACT_FILE='jkclient-0.1.1.exe'
|
||||
|
||||
in_directory_with_file(ARTIFACT_FILE)
|
||||
|
||||
before do
|
||||
content_for_file("exe binary globby goo")
|
||||
end
|
||||
|
||||
it "return empty" do
|
||||
ArtifactUpdate.find(:all).length.should == 0
|
||||
end
|
||||
|
||||
|
||||
it "should allow insertion" do
|
||||
|
||||
artifact = ArtifactUpdate.new
|
||||
artifact.product = 'JamClient/Win32'
|
||||
artifact.version = '0.1.1'
|
||||
artifact.uri = 'http://nowhere/'
|
||||
artifact.uri = File.open(ARTIFACT_FILE)
|
||||
artifact.sha1 = 'blahablahblah'
|
||||
|
||||
artifact.save!
|
||||
|
|
@ -18,7 +30,7 @@ describe ArtifactUpdate do
|
|||
artifact.environment.should == "public"
|
||||
artifact.product.should == "JamClient/Win32"
|
||||
artifact.version.should == "0.1.1"
|
||||
artifact.uri.should == "http://nowhere/"
|
||||
File.basename(artifact.uri.path).should == ARTIFACT_FILE
|
||||
artifact.sha1.should == "blahablahblah"
|
||||
|
||||
found = ArtifactUpdate.find_by_product_and_version('JamClient/Win32', '0.1.1')
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
require 'active_record'
|
||||
require 'jam_db'
|
||||
require 'spec_db'
|
||||
require 'uses_temp_files'
|
||||
|
||||
# recreate test database and migrate it
|
||||
SpecDb::recreate_database
|
||||
|
|
@ -22,6 +23,12 @@ include JamRuby
|
|||
# put ActionMailer into test mode
|
||||
ActionMailer::Base.delivery_method = :test
|
||||
|
||||
# set up carrierwave to use file (instead of say, fog) for testing
|
||||
CarrierWave.configure do |config|
|
||||
config.storage = :file
|
||||
config.enable_processing = false
|
||||
end
|
||||
|
||||
#uncomment the following line to use spork with the debugger
|
||||
#require 'spork/ext/ruby-debug'
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue