Sha256: 5c2ba8616e91d43b5bb44cae77f968a1527f092451bbb2294c22409d5887950f

Contents?: true

Size: 726 Bytes

Versions: 5

Compression:

Stored size: 726 Bytes

Contents

module Macros
  def it_converts_string_through_text_class_on(*fields)
    fields.each do |field|
      describe "#formatted_#{field}" do
        let(:text) { double :text, :to_s => "formatedd #{field}"}
        before(:each) do
          PivotalToPdf::Text.stub(:new).and_return text
        end
        
        it "sends the string to Text class" do
          PivotalToPdf::Text.should_receive(:new).with(subject.send(field)).and_return text
          subject.send("formatted_#{field}")
        end

        it "returns Text.to_s" do
          text.should_receive(:to_s).and_return "formatted #{field}"
          expect(subject.send("formatted_#{field}")).to eq("formatted #{field}")
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pivotal_to_pdf-1.6.0 spec/support/macros/it_converts_string_through_text_class_on.rb
pivotal_to_pdf-1.4.0 spec/support/macros/it_converts_string_through_text_class_on.rb
pivotal_to_pdf-1.3.4 spec/support/macros/it_converts_string_through_text_class_on.rb
pivotal_to_pdf-1.3.3 spec/support/macros/it_converts_string_through_text_class_on.rb
pivotal_to_pdf-1.3.2 spec/support/macros/it_converts_string_through_text_class_on.rb