Skip to content

Commit

Permalink
Fixed specs
Browse files Browse the repository at this point in the history
  • Loading branch information
yumitsu committed Dec 23, 2011
1 parent 6a5bd32 commit d960ed7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
11 changes: 7 additions & 4 deletions spec/commands/command_help_spec.rb
@@ -1,11 +1,14 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "github help" do

it "should output help contents" do
example_output = File.expand_path(File.dirname(__FILE__) + "/../resources/help_output.txt")
$stdout.should_receive(:write).with(File.read(example_output))
GitHub.invoke(:default)
executable = File.expand_path(File.dirname(__FILE__) + '/../../bin/github')

io = IO.popen(executable)
out = io.read rescue ''
io.close

(File.read(example_output).to_s + "\n").should == out
end

end
3 changes: 2 additions & 1 deletion spec/commands/command_issues_spec.rb
Expand Up @@ -74,7 +74,7 @@ def mock_issues_for(state = "open", options = {})
options[:created_at] = 10.hours.ago
options[:user] = "user"
options[:project] = "project"
yaml = <<-YAML.gsub(/^ /, '')
yaml = <<-YAML
---
issues:
- number: 1
Expand All @@ -90,6 +90,7 @@ def mock_issues_for(state = "open", options = {})
state: #{state}
YAML
yaml = yaml.split("\n").map {|l| l.gsub(/^ /, '')}.join("\n")
api_url = "https://github.com/api/v2/yaml/issues/list/#{options[:user]}/#{options[:project]}/#{state}"
@command.should_receive(:open).with(api_url).and_return(yaml)
end
Expand Down
3 changes: 2 additions & 1 deletion spec/resources/help_output.txt
Expand Up @@ -21,6 +21,7 @@ Available commands:
--textile : Create README.textile
create-from-local => Create a new GitHub repository from the current local
repository
% github create-from-local [repo_name]
--private: Create private repository
fetch => Fetch from a remote to a local branch.
fetch_all => Fetch all refs from a user
Expand Down Expand Up @@ -69,4 +70,4 @@ Available commands:
% github track [user/repo]
--private: Use git@github.com: instead of
git://github.com/.
--ssh : Equivalent to --private
--ssh : Equivalent to --private

0 comments on commit d960ed7

Please sign in to comment.