Sha256: 211379c5216c7aece5d1dfc80ce08cde6d2eec95db810f02d053a9e3222137cf

Contents?: true

Size: 919 Bytes

Versions: 42

Compression:

Stored size: 919 Bytes

Contents

require "spec_helper"
require_relative "../../../lib/octopolo/pivotal/story_commenter"

module Octopolo
  module Pivotal
    describe StoryCommenter do
      let(:client) { stub }
      before do
        Pivotal::Client.stub(:new) { client }
      end

      context ".new" do
        it "finds the story via the pivotal api" do
          client.should_receive(:find_story).with(:id)
          StoryCommenter.new(:id, 'text')
        end
      end

      context "#perform" do
        let(:notes) { stub }
        let(:story) { stub(notes: notes) }
        let(:comment) { "test comment" }

        it "creates a new note for the story" do
          client.stub(:find_story) { story }
          note = stub
          notes.should_receive(:new).with(owner: story, text: comment) { note }
          note.should_receive(:create)
          StoryCommenter.new(story, comment).perform
        end
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
octopolo-1.12.0 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.11.4 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.11.3 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.11.1 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.11.0 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.9.0 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.8.1 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.8.0 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.7.1 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.7.0 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.6.0 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.5.3 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.5.2 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.5.1 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.5.0 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.4.0 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.3.0 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.2.1 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.2.0 spec/octopolo/pivotal/story_commenter_spec.rb
octopolo-1.1.1 spec/octopolo/pivotal/story_commenter_spec.rb