Commit c7581887 authored by Fabio Pelosin's avatar Fabio Pelosin

[#188] Added tests

parent 8347b776
require File.expand_path('../../../spec_helper', __FILE__)
describe "Pod::Command::List" do
extend SpecHelper::Git
before do
config.repos_dir = fixture('spec-repos')
end
after do
config.repos_dir = tmp_repos_path
end
def command(arguments = argv)
command = Pod::Command::List.new(arguments)
def command.puts(msg = '')
(@printed ||= '') << "#{msg}\n"
end
command
end
it "it accepts corret inputs and runs without errors" do
lambda { command().run }.should.not.raise
lambda { command(argv('10')).run }.should.not.raise
end
it "complains if the days parameter is not a number" do
lambda { command(argv('10a')).run }.should.raise Pod::Command::Help
end
it "returns the specs know in a given commit" do
specs = command(argv('10')).spec_names_from_commit('cad98852103394951850f89f0efde08f9dc41830')
specs[00].should == 'A2DynamicDelegate'
specs[10].should == 'DCTTextFieldValidator'
specs[20].should == 'INKeychainAccess'
specs[30].should == 'MKNetworkKit'
end
it "returns the new specs introduced after a given commit" do
new_specs = command(argv('10')).new_specs_set('1c138d254bd39a3ccbe95a720098e2aaad5c5fc1')
new_specs[0].name.should == 'iCarousel'
new_specs[1].name.should == 'libPusher'
end
end
require File.expand_path('../../../spec_helper', __FILE__)
describe Pod::Command::SetPresent do
before do
@set = Pod::Spec::Set.new(fixture('spec-repos/master/CocoaLumberjack'))
@dummy = Object.new
@dummy.extend(Pod::Command::SetPresent)
def @dummy.puts(msg = '') (@printed ||= '') << "#{msg}\n" end
def @dummy.prinded() @printed.chomp end
end
it "repects the `--name-only' option" do
@dummy.parse_set_options(argv('--name-only'))
@dummy.present_set(@set)
@dummy.prinded.should == 'CocoaLumberjack'
end
it "presents the name, version, description, homepage and source of a specification set" do
@dummy.parse_set_options(argv())
@dummy.present_set(@set)
@dummy.prinded.should.include? 'CocoaLumberjack'
@dummy.prinded.should.include? '1.0'
@dummy.prinded.should.include? '1.1'
@dummy.prinded.should.include? 'A fast & simple, yet powerful & flexible logging framework for Mac and iOS.'
@dummy.prinded.should.include? 'https://github.com/robbiehanson/CocoaLumberjack'
@dummy.prinded.should.include? 'https://github.com/robbiehanson/CocoaLumberjack.git'
end
it "presents the stats of a specification set" do
@dummy.parse_set_options(argv('--stats'))
@dummy.present_set(@set)
@dummy.prinded.should.match(/Watchers:\W+[0-9]+/)
@dummy.prinded.should.match(/Forks:\W+[0-9]+/)
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment