Sha256: 831135173c8041eb2e965048da0ba2831b4a6286ac1f3369bca86e86d47b3e7f

Contents?: true

Size: 1.75 KB

Versions: 42

Compression:

Stored size: 1.75 KB

Contents

require "spec_helper"
require_relative "../../lib/octopolo/convenience_wrappers"
require_relative "../../lib/octopolo/git"

module Octopolo
  class Foo
    include CLIWrapper
    include ConfigWrapper
    include UserConfigWrapper
    include GitWrapper
  end

  describe CLIWrapper do
    let(:foo) { Foo.new }
    let(:cli) { stub(:CLI) }

    context "#cli" do
      it "wraps around the CLI class" do
        foo.cli.should == CLI
      end

      it "uses the given CLI class" do
        foo.cli = cli
        foo.cli.should == cli
      end
    end
  end

  describe ConfigWrapper do
    let(:foo) { Foo.new }
    let(:config) { stub(:config) }

    context "#config" do
      it "parses the current config" do
        Octopolo.should_receive(:config) { config }
        foo.config.should == config
      end

      it "uses the given parsed config" do
        Config.should_not_receive(:parse)
        foo.config = config
        foo.config.should == config
      end
    end
  end

  describe UserConfigWrapper do
    let(:foo) { Foo.new }
    let(:user_config) { stub(:user_config) }

    context "#user_config" do
      it "parses the current user config" do
        UserConfig.should_receive(:parse) { user_config }
        foo.user_config.should == user_config
      end

      it "uses the given parsed config" do
        foo.user_config = user_config
        UserConfig.should_not_receive(:parse)
        foo.user_config.should == user_config
      end
    end
  end

  describe GitWrapper do
    subject { Foo.new }
    let(:git) { stub(:Git) }

    context "#git" do
      it "wraps around the Git class" do
        subject.git.should == Git
      end

      it "uses the given Git" do
        subject.git = git
        subject.git.should == git
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

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