Sha256: 05fddb6db6a74cba8c63eb6e948755954126996d12ba211f302a91a513d1b333

Contents?: true

Size: 1.72 KB

Versions: 12

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'

describe Object do

  context 'basic object' do
    let(:object) { described_class.new }

    # describe "exclaim" do
    #   it "delegates to puts" do
    #     STDOUT.should_receive(:puts).once.with :bla
    #     STDOUT.should_receive(:flush).once.with
    #
    #     object.exclaim :bla
    #   end
    # end

    describe "timed_exclaim" do
      it "should exclaim right" do
        Time.stub! :now => Time.parse('07-03-1977 12:34:56')
        object.should_receive(:exclaim).once.with "12:34:56: bla"

        object.timed_exclaim 'bla'
      end
    end

    describe 'warn_gem_missing' do
      it 'should warn right' do
        object.should_receive(:warn).once.with "gnorf gem missing!\nTo use gnarble gnarf, you need to:\n  1. Add the following line to Gemfile:\n     gem 'gnorf'\n     or\n     require 'gnorf'\n     for example at the top of your app.rb file.\n  2. Then, run:\n     bundle update\n"

        object.warn_gem_missing 'gnorf', 'gnarble gnarf'
      end
    end
  end

  describe 'indented_to_s' do
    describe String do
      let(:string) { String.new("Hello\nTest") }

      it 'indents a default amount' do
        string.indented_to_s.should == "  Hello\n  Test"
      end
      it 'indents twice' do
        string.indented_to_s.indented_to_s.should == "    Hello\n    Test"
      end
      it 'indents correctly' do
        string.indented_to_s(3).should == "   Hello\n   Test"
      end
    end
    describe Array do
      let(:array) { Array.new(["Hello", "Test"]) }

      it 'indents a default amount' do
        array.indented_to_s.should == "  Hello\n  Test"
      end
      it 'indents twice' do
        array.indented_to_s.indented_to_s.should == "    Hello\n    Test"
      end
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
picky-4.0.9 spec/lib/extensions/object_spec.rb
picky-4.0.8 spec/lib/extensions/object_spec.rb
picky-4.0.7 spec/lib/extensions/object_spec.rb
picky-4.0.6 spec/lib/extensions/object_spec.rb
picky-4.0.5 spec/lib/extensions/object_spec.rb
picky-4.0.4 spec/lib/extensions/object_spec.rb
picky-4.0.3 spec/lib/extensions/object_spec.rb
picky-4.0.1 spec/lib/extensions/object_spec.rb
picky-4.0.0 spec/lib/extensions/object_spec.rb
picky-4.0.0pre6 spec/lib/extensions/object_spec.rb
picky-4.0.0pre5 spec/lib/extensions/object_spec.rb
picky-4.0.0pre3 spec/lib/extensions/object_spec.rb