Sha256: 193d5d658ae07a0f9001ba8e48c1c299fc08fba593c7c6ef501813f80259e72c

Contents?: true

Size: 1.59 KB

Versions: 16

Compression:

Stored size: 1.59 KB

Contents

require 'spec_helper'

describe Gemika::RSpec do

  # before(:each) { puts "---", "RSpec example", "---" }

  subject { Gemika::RSpec }

  describe '.binary' do

    it 'returns "spec" for RSpec 1' do
      Gemika::Env.should_receive(:gem?).with('rspec', '< 2', {}).and_return(true)
      subject.binary.should == 'spec'
    end

    it 'returns "rspec" for RSpec 2+' do
      Gemika::Env.should_receive(:gem?).with('rspec', '< 2', {}).and_return(false)
      subject.binary.should == 'rspec'
    end

  end

  describe '.run_specs' do

    it 'shells out to the binary' do
      expected_command = %{#{subject.binary} --color spec}
      subject.should_receive(:shell_out).with(expected_command).and_return(true)
      subject.run_specs(:bundle_exec => false)
    end

    it 'allows to pass a :files option' do
      expected_command = %{#{subject.binary} --color spec/foo_spec.rb:23}
      subject.should_receive(:shell_out).with(expected_command).and_return(true)
      subject.run_specs(
        :bundle_exec => false,
        :files => 'spec/foo_spec.rb:23'
      )
    end

    it 'calls the binary with `bundle exec` if :bundle_exec option is true' do
      expected_command = %{bundle exec #{subject.binary} --color spec}
      subject.should_receive(:shell_out).with(expected_command).and_return(true)
      subject.run_specs(:bundle_exec => true)
    end

    it 'raises an error if the call returns a non-zero error code' do
      subject.should_receive(:shell_out).with(anything).and_return(false)
      expect { subject.run_specs(:bundle_exec => false) }.to raise_error(Gemika::RSpecFailed)
    end

  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
gemika-0.8.4 spec/gemika/rspec_spec.rb
gemika-0.8.3 spec/gemika/rspec_spec.rb
gemika-0.8.2 spec/gemika/rspec_spec.rb
gemika-0.8.1 spec/gemika/rspec_spec.rb
gemika-0.8.0 spec/gemika/rspec_spec.rb
gemika-0.7.1 spec/gemika/rspec_spec.rb
gemika-0.7.0 spec/gemika/rspec_spec.rb
gemika-0.6.1 spec/gemika/rspec_spec.rb
gemika-0.6.0 spec/gemika/rspec_spec.rb
gemika-0.5.0 spec/gemika/rspec_spec.rb
gemika-0.4.1 spec/gemika/rspec_spec.rb
gemika-0.4.0 spec/gemika/rspec_spec.rb
gemika-0.3.4 spec/gemika/rspec_spec.rb
gemika-0.3.3 spec/gemika/rspec_spec.rb
gemika-0.3.2 spec/gemika/rspec_spec.rb
gemika-0.3.1 spec/gemika/rspec_spec.rb