spec/genomer/runtime_spec.rb in genomer-0.0.7 vs spec/genomer/runtime_spec.rb in genomer-0.0.8

- old
+ new

@@ -47,13 +47,17 @@ end describe "with project name argument" do before do - subject.execute! + @msg = subject.execute! end + it "should print message that project has been created" do + @msg.should == "Genomer project 'project_name' created.\n" + end + it "should create a directory from the named argument" do File.exists?('project_name').should be_true end it "should create an 'assembly' directory" do @@ -131,16 +135,16 @@ end describe "help" do - let(:arguments){ %w|help| } - before do mock(Genomer::Plugin).plugins{ gems } end + let(:arguments){ %w|help| } + describe "with no available plugins" do let(:gems) do [] end @@ -184,11 +188,11 @@ before do stub(Genomer::Plugin).plugins{ gems } end - describe "with no command specified" do + describe "and no command specified" do let(:arguments){ %w|man| } it "should print the man help description" do msg = <<-EOF @@ -198,17 +202,36 @@ subject.execute!.should include msg.unindent.strip end end - describe "with a command specified" do + describe "and a command specified" do let(:arguments){ %w|man simple| } let(:man_file){ 'a' } let(:groffed_man_file){ mock!.path{ 'b' } } before do mock(subject).man_file(['simple']){ man_file } + mock(subject).groffed_man_file(man_file){ groffed_man_file } + mock(File).exists?(man_file){true} + end + + it "should call man for the groffed path" do + mock(Kernel).exec("man b") + subject.execute! + end + + end + + describe "and the init command specified" do + + let(:arguments){ %w|man init| } + let(:man_file){ File.expand_path File.dirname(__FILE__) + '/../../man/genomer-init.1.ronn' } + let(:groffed_man_file){ mock!.path{ 'b' } } + + before do + dont_allow(subject).man_file mock(subject).groffed_man_file(man_file){ groffed_man_file } mock(File).exists?(man_file){true} end it "should call man for the groffed path" do