Skip to content

Commit

Permalink
Cleaned up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
opsb committed Nov 7, 2010
1 parent 6de7e5b commit fce1294
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
8 changes: 4 additions & 4 deletions test/heroku/commands/zenslap_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ def stub_heroku
@command.stubs(:heroku).returns(@heroku)
end

context "zenslap command" do
context "zenslap" do
setup do
@command = Heroku::Command::Zenslap.new nil
stub_git
stub_zenslap
stub_heroku
end

context "add command" do
context "#create" do

setup do
@command.create
Expand All @@ -78,14 +78,14 @@ def stub_heroku
assert_received @heroku, :install_addon, &with( "conference_hub", ADDON_NAME )
end

should "configure zenslap with github_url" do
should "configure zenslap with github and heroku details" do
assert_received @zenslap_client, :configure,
&with( ZENSLAP_ID, GITHUB_REPO_OWNER, GITHUB_REPO_NAME, GITHUB_CREDENTIALS, HEROKU_APP )
end

end

context "destroy" do
context "#destroy" do
setup do
@command.destroy
end
Expand Down
23 changes: 13 additions & 10 deletions test/zenslap/repo_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
require 'test_helper'

class RepoTest < Test::Unit::TestCase
def stub_git
@git_repo = stub(
:remotes => [
stub( :name => "origin", :url => GITHUB_URL)
],
:add_remote => nil,
:config => nil
)

Git.stubs(:open).returns(@git_repo)
end

context "repository" do
HEROKU_URL= "git@heroku.com:conference_hub.git"
GITHUB_URL = "git@github.com:opsb/conference_hub"
Expand All @@ -25,16 +37,7 @@ class RepoTest < Test::Unit::TestCase
]

setup do
File.stubs(:open).with('./.git/config').returns(StringIO.new(HEROKU_URL + " " + GITHUB_URL))
@git_repo = stub(
:remotes => [
stub( :name => "origin", :url => GITHUB_URL)
],
:add_remote => nil,
:config => nil
)

Git.stubs(:open).returns(@git_repo)
stub_git
@repo = Repo.new
end

Expand Down

0 comments on commit fce1294

Please sign in to comment.