Skip to content
Snippets Groups Projects
Commit 45adf107 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

fix build. Use frozen version of tested repo

parent 9ce1fbc7
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -18,9 +18,9 @@ ActiveRecord::Schema.define(:version => 20130129121754) do
t.string "ref"
t.string "status"
t.datetime "finished_at"
t.text "trace"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.text "trace", :limit => 2147483647
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "sha"
t.datetime "started_at"
t.string "tmp_file"
Loading
Loading
require 'fileutils'
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
User.create(
Loading
Loading
@@ -7,9 +9,32 @@ User.create(
)
 
 
if %w(development test).include?(Rails.env)
print "Unpacking seed repository..."
SEED_REPO = 'six.tar.gz'
REPO_PATH = Rails.root.join('tmp', 'repositories')
# Make whatever directories we need to make
FileUtils.mkdir_p(REPO_PATH)
# Copy the archive to the repo path
FileUtils.cp(Rails.root.join('spec', SEED_REPO), REPO_PATH)
# chdir to the repo path
FileUtils.cd(REPO_PATH) do
# Extract the archive
`tar -xf #{SEED_REPO}`
# Remove the copy
FileUtils.rm(SEED_REPO)
end
puts ' done.'
end
if Rails.env == 'development'
`rm -rf #{Rails.root.join('tmp', 'test_repo')}`
`cd #{Rails.root.join('tmp')} && git clone https://github.com/randx/six.git test_repo`
puts 'Creating projets with builds '
 
project = FactoryGirl.create :project,
name: "Six",
Loading
Loading
# Read about factories at https://github.com/thoughtbot/factory_girl
 
FactoryGirl.define do
factory :project do
name Faker::Name.name
token 'iPWx6WM4lhHNedGfBpPJNP'
default_ref 'master'
path Rails.root.join('tmp', 'test_repo').to_s
scripts 'ls'
end
factory :project_without_token, class: Project do
name Faker::Name.name
default_ref 'master'
path Rails.root.join('tmp', 'test_repo').to_s
path Rails.root.join('tmp', 'repositories', 'six').to_s
scripts 'ls'
factory :project do
token 'iPWx6WM4lhHNedGfBpPJNP'
end
end
end
Loading
Loading
@@ -6,7 +6,7 @@ describe Project do
it { should have_many(:builds) }
 
describe :path do
it { should allow_value(Rails.root.join('tmp', 'test_repo')).for(:path) }
it { should allow_value(Rails.root.join('tmp', 'repositories', 'six')).for(:path) }
it { should_not allow_value('/tmp').for(:path) }
end
 
Loading
Loading
@@ -48,7 +48,7 @@ describe Project do
it { project.last_build.should be_kind_of(Build) }
it { project.human_status.should == 'pending' }
it { project.status_image.should == 'running.png' }
it { project.last_commit.sha.should == 'a26f8df380e56dc79cd74087c8ed4f031eef0460' }
it { project.last_commit.sha.should == '1c8a9df454ef68c22c2a33cca8232bb50849e5c5' }
end
end
end
Loading
Loading
File added
Loading
Loading
@@ -9,13 +9,6 @@ require 'sidekiq/testing/inline'
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
 
test_repo_path = Rails.root.join('tmp', 'test_repo')
unless File.exists?(test_repo_path)
`git clone https://github.com/randx/six.git #{test_repo_path}`
end
RSpec.configure do |config|
config.include LoginHelpers, type: :request
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment