Sha256: 28cdf6ab4f20b5530db4358f662420a72dfe358b2d3e3f0990b572b88bf7562d

Contents?: true

Size: 1.55 KB

Versions: 4

Compression:

Stored size: 1.55 KB

Contents

require File.join(File.dirname(__FILE__), '..', 'spec_helper')

describe GitPivotalTracker::Story do
  describe "#run!" do
    before do
      stub_git_config
      stub_request(:get, 'http://www.pivotaltracker.com/services/v3/projects/123').
          to_return :body => File.read("#{FIXTURES_PATH}/project.xml")
      @story = GitPivotalTracker::Info.new("-t", "8a8a8a8", "-p", "123")
    end

    context "given no story ID is found" do
      before do
        @story.stub!(:story_id).and_return(nil)
      end

      it "fails" do
        @story.run!.should == 1
      end
    end

    context "given a story exists" do
      before do
        @story.stub!(:story_id).and_return('1234567890')
        stub_request(:get, 'http://www.pivotaltracker.com/services/v3/projects/123/stories/1234567890').
            to_return :body => File.read("#{FIXTURES_PATH}/story.xml")
        stub_request(:get, 'http://www.pivotaltracker.com/services/v3/projects/123/stories/1234567890/notes').
            to_return :body => File.read("#{FIXTURES_PATH}/notes.xml")
      end

      it "outputs correctly" do
        @story.should_receive(:puts).with("URL:           http://www.pivotaltracker.com/story/show/1234567890")
        @story.should_receive(:puts).with("Story:          Pause the film!")
        @story.should_receive(:puts).with("Description:   As a moderator,\nI can pause the film\nIn order to allow another activity to take place (discussion, etc).")
        @story.should_receive(:puts).with("Comments:      Testing comments")
        @story.run!.should == 0
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
git_pivotal_tracker-0.2.1 spec/git_pivotal_tracker/info_spec.rb
git_pivotal_tracker-0.2.0 spec/git_pivotal_tracker/info_spec.rb
git_pivotal_tracker-0.1.0 spec/git_pivotal_tracker/info_spec.rb
git_pivotal_tracker-0.0.9 spec/git_pivotal_tracker/info_spec.rb