zenslap 0.1.8 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,26 +1,15 @@
1
- #!/usr/bin/env ruby
2
-
3
- lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
4
- $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
5
-
6
- require 'rubygems'
7
-
8
- require File.dirname(__FILE__) + '/../lib/zenslap'
9
-
10
- args = ARGV.dup
11
- ARGV.clear
12
-
13
- command = args.shift
14
- if command && ["create", "destroy"].include?(command)
15
- Zenslap::Command.new.run(command)
16
- else
17
- puts <<-eos
18
-
19
- === Zenslap commands
20
-
21
- create # create zenslap environment for this project
22
- destroy # destroy zenslap environment for this project
23
-
24
- eos
25
-
26
- end
1
+ #!/bin/sh
2
+ app=$(git config zenslap.zenslap)
3
+ while [ "$app" = "" ]; do·
4
+ echo "Enter the name of the zenslap app"
5
+ read unvalidatedApp·
6
+ $(heroku config --app $unvalidatedApp)
7
+ if [ "$?" != "0" ]; then
8
+ echo $app
9
+ else
10
+ app=$unvalidatedApp
11
+ git config zenslap.zenslap $app
12
+ fi
13
+ done
14
+ echo $app
15
+ heroku $* --app $app
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{zenslap}
8
- s.version = "0.1.8"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["opsb"]
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.description = %q{Client for zenslap continuous integration}
15
15
  s.email = %q{oliver@opsb.co.uk}
16
16
  s.executables = ["zenslap"]
17
- s.files = Dir.glob("{bin,lib}/**/*") + %w(Gemfile zenslap.gemspec)
17
+ s.files = Dir.glob("{bin}/**/*") + %w(zenslap.gemspec)
18
18
 
19
19
  s.homepage = %q{http://github.com/opsb/zenslap-client}
20
20
  s.rdoc_options = ["--charset=UTF-8"]
@@ -22,8 +22,6 @@ Gem::Specification.new do |s|
22
22
  s.rubygems_version = %q{1.3.7}
23
23
  s.summary = %q{Client for zenslap continuous integration}
24
24
  s.test_files = Dir.glob("spec/**/*")
25
- s.add_dependency('heroku', ["= 1.10.10"])
26
- s.add_dependency('opsb-git', ["= 1.2.11"])
27
- s.add_dependency('rest-client', ["= 1.6.1"])
25
+ s.add_dependency('heroku', ["~> 1.17.8"])
28
26
  end
29
27
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zenslap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 8
10
- version: 0.1.8
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - opsb
@@ -24,48 +24,16 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - "="
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- hash: 43
29
+ hash: 67
30
30
  segments:
31
31
  - 1
32
- - 10
33
- - 10
34
- version: 1.10.10
32
+ - 17
33
+ - 8
34
+ version: 1.17.8
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: opsb-git
39
- prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - "="
44
- - !ruby/object:Gem::Version
45
- hash: 9
46
- segments:
47
- - 1
48
- - 2
49
- - 11
50
- version: 1.2.11
51
- type: :runtime
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: rest-client
55
- prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - "="
60
- - !ruby/object:Gem::Version
61
- hash: 13
62
- segments:
63
- - 1
64
- - 6
65
- - 1
66
- version: 1.6.1
67
- type: :runtime
68
- version_requirements: *id003
69
37
  description: Client for zenslap continuous integration
70
38
  email: oliver@opsb.co.uk
71
39
  executables:
@@ -76,17 +44,7 @@ extra_rdoc_files: []
76
44
 
77
45
  files:
78
46
  - bin/zenslap
79
- - lib/zenslap/client.rb
80
- - lib/zenslap/commands.rb
81
- - lib/zenslap/console_error.rb
82
- - lib/zenslap/git_repo.rb
83
- - lib/zenslap.rb
84
- - Gemfile
85
47
  - zenslap.gemspec
86
- - spec/client_spec.rb
87
- - spec/commands_spec.rb
88
- - spec/git_repo_spec.rb
89
- - spec/spec_helper.rb
90
48
  has_rdoc: true
91
49
  homepage: http://github.com/opsb/zenslap-client
92
50
  licenses: []
@@ -121,8 +79,5 @@ rubygems_version: 1.3.7
121
79
  signing_key:
122
80
  specification_version: 3
123
81
  summary: Client for zenslap continuous integration
124
- test_files:
125
- - spec/client_spec.rb
126
- - spec/commands_spec.rb
127
- - spec/git_repo_spec.rb
128
- - spec/spec_helper.rb
82
+ test_files: []
83
+
data/Gemfile DELETED
@@ -1,22 +0,0 @@
1
- source :rubygems
2
-
3
- gemspec
4
-
5
-
6
- group :test do
7
- gem 'rspec'
8
- gem 'ruby-debug'
9
- gem 'shoulda'
10
- gem 'mocha'
11
- gem 'bourne'
12
- gem 'webmock', '1.3.5'
13
- gem 'method_lister'
14
- end
15
-
16
- group :local do
17
- gem 'autotest'
18
- gem 'redgreen'
19
- gem 'autotest-growl'
20
- gem 'autotest-fsevent'
21
- gem 'ruby-debug'
22
- end
@@ -1,4 +0,0 @@
1
- require File.dirname(__FILE__) + '/zenslap/console_error'
2
- require File.dirname(__FILE__) + '/zenslap/client'
3
- require File.dirname(__FILE__) + '/zenslap/git_repo'
4
- require File.dirname(__FILE__) + '/zenslap/commands'
@@ -1,20 +0,0 @@
1
- require 'rest-client'
2
-
3
- class ZenslapClient
4
- ZENSLAP_HOST = ENV['_ZENSLAP_CLIENT_HOST'] || "zenslap.me"
5
-
6
- def self.configure(uuid, repo_owner, repo_name, github_credentials, heroku_app)
7
- #TODO need to make https
8
- RestClient.post("http://#{ZENSLAP_HOST}/projects",
9
- {
10
- :project => github_credentials.merge({
11
- :owner => repo_owner,
12
- :name => repo_name,
13
- :uuid => uuid,
14
- :heroku_app => heroku_app
15
- })
16
- }
17
- )
18
- end
19
-
20
- end
@@ -1,95 +0,0 @@
1
- require 'heroku'
2
- require 'heroku/command'
3
-
4
- module Zenslap
5
- class Command
6
-
7
- ZENSLAP_HEROKU_USER = "admin@zenslap.me"
8
- ZENSLAP_ADDON = "zenslap2"
9
-
10
- def run(command)
11
- case command
12
- when "create" then create
13
- when "destroy" then destroy
14
- else raise "#{command} command not found"
15
- end
16
- end
17
-
18
- def display(message)
19
- puts "---> #{message}"
20
- end
21
-
22
- def display_error(message)
23
- puts "---! #{message}"
24
- end
25
-
26
- def display_numbered_bullets(items)
27
- items.each_with_index do |item, index|
28
- puts " #{index}) #{item}"
29
- end
30
- end
31
-
32
- def git_repo
33
- @git_repo ||= GitRepo.new
34
- end
35
-
36
- def heroku
37
- Heroku::Command.run_internal('auth:client', [])
38
- end
39
-
40
- def test_environment_name(name, owner)
41
- full_name = "#{name}-zenslap-#{owner}".gsub(/[^a-zA-Z\d-]/, '-')
42
- return full_name if full_name.length <= 30
43
- return full_name[0, 27].gsub(/-+$/, "") + "-" + rand(99).to_s
44
- end
45
-
46
- def create
47
- begin
48
- if git_repo.remote_exists? 'zenslap'
49
- display_error "Zenslap has already been set up"
50
- return
51
- end
52
-
53
- display "Checking for github details"
54
- git_repo.github_owner
55
- git_repo.github_name
56
- git_repo.github_credentials
57
-
58
- display "Creating test environment in heroku"
59
- display "Using account: #{heroku.user}"
60
- heroku_app = test_environment_name(git_repo.github_name, git_repo.github_owner)
61
- display "Creating test environment: #{heroku_app}"
62
- heroku.create heroku_app
63
- heroku.add_collaborator(heroku_app, ZENSLAP_HEROKU_USER)
64
- git_repo.add_zenslap_remote(heroku_app)
65
-
66
- display "Installing zenslap addon"
67
- heroku.install_addon heroku_app, ZENSLAP_ADDON
68
- zenslap_id = heroku.config_vars(heroku_app)["ZENSLAP_ID"]
69
-
70
- display "Configuring zenslap"
71
- ZenslapClient.configure( zenslap_id, git_repo.github_owner, git_repo.github_name, git_repo.github_credentials, heroku_app )
72
-
73
- display ""
74
- display "Nearly there, you just need to do add a couple of things on github and you'll be ready to go"
75
- display_numbered_bullets [
76
- "Add 'zenslap' as a collaborator",
77
- "Add 'http://zenslap.me/pushes' to the service hooks"
78
- ]
79
-
80
- rescue ConsoleError => e
81
- display_error e
82
- end
83
- end
84
-
85
- def destroy
86
- display "Destroying zenslap project and test environment"
87
- heroku.destroy git_repo.zenslap_app
88
- display "Removing zenslap git remote"
89
- git_repo.remove_zenslap_remote
90
- display "All done. Thanks for using zenslap."
91
- rescue ConsoleError => e
92
- display_error e
93
- end
94
- end
95
- end
@@ -1,5 +0,0 @@
1
- class ConsoleError < RuntimeError
2
- end
3
-
4
- class InvalidUrlError < ConsoleError
5
- end
@@ -1,88 +0,0 @@
1
- require 'git'
2
-
3
- class GitRepo
4
- GITHUB_REGEX = /github.com[:\/](\S+)\/(\S+?)(?:\.git)?$/
5
- HEROKU_GIT_REGEX = /git@heroku\..*?:(.*)\.git/
6
-
7
- def github_url
8
- @github_url ||= find_url("---> Which github repository do you want to use?", GITHUB_REGEX, "No github remotes found. You need to add one to your git config before you can add zenslap.")
9
- end
10
-
11
- def find_url(help, regex, message)
12
- remotes = git.remotes.select{ |r| r.url =~ regex }
13
- raise ConsoleError.new(message) if remotes.empty?
14
- remotes.length == 1 ? remotes.first.url : choose_one( help, remotes ).url
15
- end
16
-
17
- def choose_one(help, remotes)
18
- names = remotes.map &:name
19
- begin
20
- puts help
21
- puts names
22
- name = gets.chomp
23
- end while not names.include? name
24
- remotes.find{ |r| r.name == name }
25
- end
26
-
27
- def github_credentials
28
- { :login => retrieve_github('user'), :token => retrieve_github('token') }
29
- end
30
-
31
- def add_zenslap_remote(name)
32
- git.add_remote "zenslap", "git@heroku.com:#{name}.git"
33
- end
34
-
35
- def remove_zenslap_remote
36
- git.remote("zenslap").remove
37
- end
38
-
39
- def zenslap_app
40
- HEROKU_GIT_REGEX.match(git.remote("zenslap").url)[1]
41
- end
42
-
43
- def remote_exists?(name)
44
- !!git.remotes.find{|r|r.name == name}
45
- end
46
-
47
- def retrieve_github(param)
48
- value = exec("git config --get github.#{param}").strip
49
- if value == ""
50
- value = ask_for("your github #{param}")
51
- exec("git config --add github.#{param} #{value}")
52
- end
53
- value
54
- end
55
-
56
- def ask_for(message)
57
- value = ""
58
- while value == ""
59
- puts "---> Please enter #{message}"
60
- value = gets.strip
61
- end
62
- value
63
- end
64
-
65
- def exec(command)
66
- `#{command}`
67
- end
68
-
69
- def git
70
- Git.open('.')
71
- end
72
-
73
- def github_owner
74
- @owner ||= parse_github_url[0]
75
- end
76
-
77
- def github_name
78
- @name ||= parse_github_url[1]
79
- end
80
-
81
- private
82
-
83
- def parse_github_url
84
- search_result = /github.com[:\/](\S+)\/(\S+?)(?:\.git)?$/.match(github_url)
85
- raise InvalidUrlError, github_url unless search_result
86
- owner, name = search_result[1..2]
87
- end
88
- end
@@ -1,27 +0,0 @@
1
- require 'spec_helper'
2
- require 'net/http'
3
- require 'uri'
4
-
5
- describe ZenslapClient do
6
-
7
- context "zenslap client" do
8
- ZENSLAP_ID = 5
9
- OWNER = "opsb"
10
- NAME = "carbonpt"
11
- GITHUB_CREDENTIALS = { :login => 'jimbo', :token => 'randomhash'}
12
- HEROKU_EMAIL = "jim@bob.com"
13
- HEROKU_PASSWORD = "password"
14
- HEROKU_APP = "conference_hub_ci"
15
-
16
- before do
17
- RestClient.stubs(:post)
18
- end
19
-
20
- it "should configure the project" do
21
- ZenslapClient.configure ZENSLAP_ID, OWNER, NAME, GITHUB_CREDENTIALS, HEROKU_APP
22
- RestClient.should have_received(:post).with( "http://zenslap.me/projects", :project =>
23
- GITHUB_CREDENTIALS.merge({ :owner => OWNER, :name => NAME, :uuid => ZENSLAP_ID, :heroku_app => HEROKU_APP } ))
24
- end
25
-
26
- end
27
- end
@@ -1,122 +0,0 @@
1
- require 'spec_helper.rb'
2
- require 'heroku'
3
-
4
- module ZenslapSpec
5
-
6
- describe Zenslap::Command do
7
- ZENSLAP_ID = 1
8
- GITHUB_URL = "git@github.com:opsb/conference_hub"
9
- GITHUB_REPO_OWNER = "opsb"
10
- GITHUB_REPO_NAME = "conference_hub"
11
- GITHUB_LOGIN = "jimbo"
12
- GITHUB_TOKEN = "df67sd6f67"
13
- GITHUB_CREDENTIALS = { :login => GITHUB_LOGIN, :token => GITHUB_TOKEN }
14
- HEROKU_EMAIL = "jim@bob.com"
15
- HEROKU_PASSWORD = "password"
16
- HEROKU_APP = "conference-hub-zenslap-opsb"
17
- ADDON_NAME = "zenslap2"
18
-
19
- def stub_git
20
- @git_repo = stub do
21
- stubs(:github_url).returns(GITHUB_URL)
22
- stubs(:github_credentials).returns(GITHUB_CREDENTIALS)
23
- stubs(:github_owner).returns(GITHUB_REPO_OWNER)
24
- stubs(:github_name).returns(GITHUB_REPO_NAME)
25
- stubs(:add_zenslap_remote)
26
- stubs(:remove_zenslap_remote)
27
- stubs(:zenslap_app).returns(HEROKU_APP)
28
- end
29
- GitRepo.stubs(:new).returns(@git_repo)
30
- end
31
-
32
- def stub_zenslap
33
- ZenslapClient.stubs(:configure)
34
- end
35
-
36
- def stub_heroku
37
- @heroku = stub do
38
- stubs(:user).returns(HEROKU_EMAIL)
39
- stubs(:password).returns(HEROKU_PASSWORD)
40
- stubs(:create).returns(HEROKU_APP)
41
- stubs(:add_collaborator)
42
- stubs(:install_addon)
43
- stubs(:config_vars).returns({ "ZENSLAP_ID" => ZENSLAP_ID })
44
- stubs(:destroy)
45
- end
46
- Heroku::Command.stubs(:run_internal).with('auth:client', []).returns(@heroku)
47
- end
48
-
49
- context "zenslap" do
50
- before do
51
- @command = Zenslap::Command.new
52
- @command.stubs(:display_error)
53
- @command.stubs(:display)
54
- @command.stubs(:display_numbered_bullets)
55
- stub_git
56
- stub_zenslap
57
- stub_heroku
58
- end
59
-
60
- it "should ensure test environment names have a maximum of 30 characters" do
61
- name = @command.test_environment_name("delayed_job_groups_mongoid", "opsb")
62
- name.should match /^delayed-job-groups-mongoid-\d+/
63
- name.length.should be <= 30
64
- end
65
-
66
- context "#create" do
67
- context "when zenslap has already been created" do
68
- before do
69
- @git_repo.stubs(:remote_exists?).with("zenslap").returns(true)
70
- @command.create
71
- end
72
-
73
- it "should display message saying zenslap has already been created" do
74
- @command.should have_received(:display_error).with("Zenslap has already been set up")
75
- end
76
- end
77
-
78
- context "before zenslap has been created" do
79
- before do
80
- @git_repo.stubs(:remote_exists?).with("zenslap").returns(false)
81
- @command.create
82
- end
83
-
84
- it "should create new heroku app to be used for running tests and billing" do
85
- @heroku.should have_received(:create).with( HEROKU_APP )
86
- end
87
-
88
- it "should add zenslap remote" do
89
- assert_received @git_repo, :add_zenslap_remote, &with( HEROKU_APP )
90
- end
91
-
92
- it "should add zenslap as a collaborator to heroku app" do
93
- assert_received @heroku, :add_collaborator, &with( HEROKU_APP, "admin@zenslap.me" )
94
- end
95
-
96
- it "should install addon" do
97
- assert_received @heroku, :install_addon, &with( HEROKU_APP, ADDON_NAME )
98
- end
99
-
100
- it "should configure zenslap with github and heroku details" do
101
- assert_received ZenslapClient, :configure,
102
- &with( ZENSLAP_ID, GITHUB_REPO_OWNER, GITHUB_REPO_NAME, GITHUB_CREDENTIALS, HEROKU_APP )
103
- end
104
- end
105
- end
106
-
107
- context "#destroy" do
108
- before do
109
- @command.destroy
110
- end
111
-
112
- it "should destroy heroku app" do
113
- assert_received @heroku, :destroy, &with(HEROKU_APP)
114
- end
115
-
116
- it "should remove zenslap remote" do
117
- @git_repo.should have_received(:remove_zenslap_remote)
118
- end
119
- end
120
- end
121
- end
122
- end
@@ -1,157 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module GitRepoSpec
4
- HEROKU_URL= "git@heroku.com:conference_hub.git"
5
- GITHUB_URL = "git@github.com:opsb/conference_hub"
6
- ZENSLAP_URL = "git@heroku.com:conference_hub-zenslap.git"
7
- GITHUB_USER = "jimbo"
8
- GITHUB_TOKEN = "df67sd6f67"
9
- HEROKU_APP = "conference_hub"
10
- ZENSLAP_ID = "abc"
11
- ZENSLAP_APP = "conference_hub_ci"
12
- ZENSLAP_GIT_REPO = "git@heroku.com:#{ZENSLAP_APP}.git"
13
-
14
- INVALID_GITHUB_URLS = [
15
- "git@invalidhub.com:opsb/conference_hub.git",
16
- "https://opsb@github.com/opsbconference_hub.git",
17
- "http://github.com.git"
18
- ]
19
-
20
- VALID_GITHUB_URLS = [
21
- "git@github.com:opsb/conference_hub.git",
22
- "https://opsb@github.com/opsb/conference_hub.git",
23
- "http://github.com/bblim-ke/we-bmo-ck.git",
24
- "http://github.com/bblim-ke/we.bmo.ck.git",
25
- "git@github.com:opsb/heroku-zenslap"
26
- ]
27
-
28
- describe GitRepo do
29
- def stub_git
30
- origin_remote = stub(:name => "origin", :url => GITHUB_URL)
31
- @zenslap_remote = stub(:name => "zenslap", :url => ZENSLAP_URL, :remove => nil)
32
- @git = stub do
33
- stubs(:remotes).returns([origin_remote])
34
- stubs(:add_remote)
35
- stubs(:config)
36
- end
37
- @git.stubs(:remote).with("zenslap").returns(@zenslap_remote)
38
- Git.stubs(:open).returns(@git)
39
- end
40
-
41
- context "repository" do
42
- before do
43
- stub_git
44
- @git_repo = GitRepo.new
45
- end
46
-
47
- it "should have github owner" do
48
- assert_equal @git_repo.github_owner, "opsb"
49
- end
50
-
51
- it "should have github name" do
52
- assert_equal @git_repo.github_name, "conference_hub"
53
- end
54
-
55
- it "should have github_url" do
56
- assert_equal @git_repo.github_url, GITHUB_URL
57
- end
58
-
59
- it "should know if a remote exists" do
60
- @git_repo.remote_exists?('origin').should be_true
61
- end
62
-
63
- it "should know if a remote does not exist" do
64
- @git_repo.remote_exists?('non existent remote').should be_false
65
- end
66
-
67
- it "should add zenslap remote" do
68
- @git_repo.add_zenslap_remote(HEROKU_APP)
69
- @git.should have_received(:add_remote).with("zenslap", HEROKU_URL)
70
- end
71
-
72
- it "should remove zenslap remote" do
73
- @git_repo.remove_zenslap_remote
74
- @zenslap_remote.should have_received(:remove)
75
- end
76
-
77
- VALID_GITHUB_URLS.each do |url|
78
- context "with remote: #{url}" do
79
- before do
80
- @git = stub(:remotes => [stub(:url => url)])
81
- Git.stubs(:open).returns(@git)
82
- end
83
-
84
- it "should have valid github url" do
85
- @git_repo.github_url.should == url
86
- end
87
-
88
- it "should have valid github owner" do
89
- @git_repo.github_owner.should_not be_blank
90
- end
91
- end
92
- end
93
-
94
- INVALID_GITHUB_URLS.each do |url|
95
- it "should not accept invalid github url #{url}" do
96
- git_repo = stub(:remotes => [stub(:url => url)])
97
- Git.stubs(:open).returns(git_repo)
98
- lambda {
99
- @git_repo.github_url
100
- }.should raise_error(ConsoleError)
101
- end
102
- end
103
-
104
- context "with zenslap remote" do
105
- it "should have zenslap app" do
106
- @git.stubs(:remote).with("zenslap").returns(stub( :name => "zenslap", :url => ZENSLAP_GIT_REPO))
107
- assert_equal @git_repo.zenslap_app, ZENSLAP_APP
108
- end
109
- end
110
-
111
- context "with stored github.user" do
112
- before do
113
- @git_repo.stubs(:exec).with("git config --get github.user").returns(GITHUB_USER + "\n")
114
- @git_repo.stubs(:exec).with("git config --get github.token").returns(GITHUB_TOKEN + "\n")
115
- end
116
-
117
- it "should have github_credentials" do
118
- assert_equal @git_repo.github_credentials, {:login => GITHUB_USER, :token => GITHUB_TOKEN}
119
- end
120
- end
121
-
122
- context "missing github credentials" do
123
- before do
124
- @git_repo.stubs(:exec).with("git config --get github.user").returns("")
125
- @git_repo.stubs(:exec).with("git config --get github.token").returns("")
126
-
127
- @git_repo.stubs(:ask_for).with("your github user").returns(GITHUB_USER)
128
- @git_repo.stubs(:ask_for).with("your github token").returns(GITHUB_TOKEN)
129
-
130
- @git_repo.stubs(:exec).with("git config --add github.user #{GITHUB_USER}")
131
- @git_repo.stubs(:exec).with("git config --add github.token #{GITHUB_TOKEN}")
132
-
133
- @git_repo.github_credentials
134
- end
135
-
136
- it "should have asked for a github user" do
137
- assert_received @git_repo, :ask_for, &with("your github user")
138
- end
139
-
140
- it "should have asked for a github token" do
141
- assert_received @git_repo, :ask_for, &with("your github token")
142
- end
143
- end
144
-
145
- context "missing github address" do
146
- it "should show error" do
147
- Git.stubs( :open ).returns( stub( :remotes => [] ) )
148
- assert_raise ConsoleError do
149
- @git_repo.github_url
150
- end
151
- end
152
- end
153
-
154
- end
155
- end
156
-
157
- end
@@ -1,39 +0,0 @@
1
- Bundler.require(:default, :test)
2
- require 'test/unit'
3
- require 'shoulda'
4
- require 'rspec'
5
- require 'mocha'
6
- require 'bourne'
7
- require 'ruby-debug'
8
-
9
- require File.dirname(__FILE__) + '/../lib/zenslap.rb'
10
-
11
-
12
- RSpec.configure do |config|
13
- config.mock_with :mocha
14
- config.include Test::Unit::Assertions
15
- end
16
-
17
- def with(*args)
18
- Proc.new do |expect|
19
- expect.with *args
20
- end
21
- end
22
-
23
- #Uncomment if you wish to see the requests and responses
24
- # WebMock.after_request do |request_signature, response|
25
- # puts "Request #{request_signature} was made and #{response} was returned"
26
- # end
27
-
28
- def show_invocations
29
- puts
30
- puts "Invocations"
31
- puts "==========="
32
- puts
33
- Mocha::Mockery.instance.invocations.each do |invocation|
34
- puts("#{invocation.mock.inspect}.#{invocation.method_name}( %s )\n\n" % [
35
- invocation.arguments.map(&:inspect).join(", ")
36
- ])
37
- end
38
- end
39
-