* adding test file to satisfy carrierwave-based model

This commit is contained in:
Seth Call 2013-02-12 23:39:53 -06:00
parent 3c692bbe7c
commit 0ddecbf0b2
5 changed files with 10 additions and 3 deletions

3
.gitignore vendored
View File

@ -23,6 +23,9 @@ doc/
.idea
*.iml
artifacts
Gemfile.lock
.sass-cache
log/development.log.age

View File

@ -29,7 +29,7 @@ class ArtifactsController < ApiController
if @artifact.nil?
render :json => {}, :status => :ok
else
render :json => { "version" => @artifact.version, "uri" => @artifact.uri }, :status => :ok
render :json => { "version" => @artifact.version, "uri" => @artifact.uri.path }, :status => :ok
end
end

View File

@ -1,3 +1,5 @@
include ActionDispatch::TestProcess # added for artifact_update http://stackoverflow.com/questions/5990835/factory-with-carrierwave-upload-field
FactoryGirl.define do
factory :user, :class => JamRuby::User do
sequence(:email) { |n| "person_#{n}@example.com"}
@ -80,7 +82,7 @@ FactoryGirl.define do
factory :artifact_update, :class => JamRuby::ArtifactUpdate do
sequence(:version) { |n| "0.1.#{n}" }
uri { "http://somewhere/jkclient.msi" }
uri { fixture_file_upload("#{Rails.root.to_s}/spec/fixtures/files/jkclient.exe", "application/x-msdownload") }
product { "JamClient/Win32" }
environment { "public" }
sha1 { "blurp" }

2
spec/fixtures/files/jkclient.exe vendored Normal file
View File

@ -0,0 +1,2 @@
Some serious binary stuff is in here.
010101010 beep boop 01010101

View File

@ -14,7 +14,7 @@ describe "Artifact API ", :type => :api do
it "matches an artifact" do
get '/api/versioncheck.json', { :os=>'Win32', :product=>'JamClient'}
last_response.status.should eql(200)
JSON.parse(last_response.body).should eql({ "version" => @artifact.version, "uri" => @artifact.uri})
JSON.parse(last_response.body).should eql({ "version" => @artifact.version, "uri" => @artifact.uri.path})
end
it "matches no artifact" do