Permalink
Browse files

fix build. Use frozen version of tested repo

  • Loading branch information...
1 parent 9ce1fbc commit 45adf107b4cd8fffc2cc2eed359412b59e962bf0 @randx randx committed Mar 13, 2013
Showing with 37 additions and 23 deletions.
  1. +3 −3 db/schema.rb
  2. +27 −2 db/seeds.rb
  3. +5 −9 spec/factories/projects.rb
  4. +2 −2 spec/models/project_spec.rb
  5. BIN spec/six.tar.gz
  6. +0 −7 spec/spec_helper.rb
View
@@ -18,9 +18,9 @@
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"
View
@@ -1,3 +1,5 @@
+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(
@@ -7,9 +9,32 @@
)
+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",
View
@@ -1,18 +1,14 @@
# 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
@@ -6,7 +6,7 @@
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
@@ -48,7 +48,7 @@
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
View
Binary file not shown.
View
@@ -9,13 +9,6 @@
# 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

0 comments on commit 45adf10

Please sign in to comment.