forked from hone/heroku_herocutter
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'micronaut' | ||
require 'heroku' | ||
require 'heroku/command' | ||
require 'restclient' | ||
lib_path = File.expand_path(File.dirname(__FILE__) + "/../lib") | ||
$LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path) | ||
|
||
def not_in_editor? | ||
!(ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM')) | ||
end | ||
|
||
Micronaut.configure do |c| | ||
c.filter_run :focused => true | ||
c.alias_example_to :fit, :focused => true | ||
c.color_enabled = not_in_editor? | ||
c.mock_with :rr | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
require File.expand_path(File.dirname(__FILE__) + "/../example_helper") | ||
|
||
describe Heroku::Command::Plugins do | ||
describe "on plugin load" do | ||
before(:each) do | ||
@directory = File.expand_path(File.dirname(__FILE__) + "/../../../") | ||
@herocutter_plugin_name = File.basename(File.expand_path(File.dirname(__FILE__) + "/../../")) | ||
@herocutter_plugin_path = "#{@directory}/#{@herocutter_plugin_name}" | ||
stub(Heroku::Plugin).list { [@herocutter_plugin_name] } | ||
stub(Heroku::Plugin).directory { @directory } | ||
end | ||
|
||
it "should load the plugin without errors" do | ||
Heroku::Plugin.load! | ||
$:.include?("#{@herocutter_plugin_path}/lib").should be_true | ||
end | ||
|
||
describe "on new plugin install" do | ||
before(:each) do | ||
@plugin_name = "new_plugin" | ||
@error_response = <<JSON | ||
{ | ||
"error": "No plugin of that name found." | ||
} | ||
JSON | ||
@success_response = <<JSON | ||
{ | ||
"plugin": { | ||
"name": "herocutter", | ||
"uri": "git://github.com/hone/heroku_herocutter.git", | ||
"updated_at": "2010-01-28T07:10:30Z", | ||
"id": 11, | ||
"description": "Provides extra heroku plugin functionality to work with Herocutter", | ||
"downloads_count": 1, | ||
"created_at": "2010-01-28T07:07:55Z" | ||
} | ||
} | ||
JSON | ||
end | ||
|
||
fit "should fetch the git uri" do | ||
mock(RestClient).get(anything) { @success_response } | ||
Heroku::Command.run("plugins:install", [@plugin_name]) | ||
end | ||
|
||
describe "when the git fetch is successful" do | ||
before(:each) do | ||
stub(RestClient).get("#{Heroku::Command::Plugins::HEROCUTTER_URL}/api/v1/plugins/", :format => 'json') { @success_response } | ||
end | ||
|
||
end | ||
end | ||
end # load! | ||
end |