Sha256: d0d30aa47be75c10d3f787e7027dac7072fb080ea95b6c4afa72c0e630f35f99

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Jasmine::Runners::Phantom do
  let!(:port) { 8888 }
  let!(:results_processor) do
    mock('results_processor').tap do |processor|
      processor.stub :process
    end
  end
  let!(:result_batch_size) { Object.new }

  subject do
    Jasmine::Runners::Phantom.new port, results_processor, result_batch_size
  end

  describe '#run' do
    let(:messages) { {'messages' => [{'passed' => true, 'type' => 'expect', 'message' => 'Passed.', 'trace' => {}}]} }
    let(:describe1) do
      {'id' => 1, 'description' => 'foo'}
    end

    let(:describe2) do
      {'id' => 2, 'description' => 'bar'}
    end

    let(:json) do
      {
        'top_level_suites' => [describe1],
        'suites' => [describe1, describe2]
      }
    end

    let(:tempfile) do
      mock('tempfile').tap do |f|
        f.should_receive(:read).and_return(describe1)
        f.should_receive(:close)
      end
    end

    before do
      Process.should_receive :spawn
      Process.should_receive :wait
    end

    describe '#load_suite_info' do
      before do
        JSON.should_receive(:parse).and_return json
        subject.should_receive(:results_hash).and_return {}
        subject.run
      end
      its(:suites) do
        should == [describe1, describe2]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phantom_jasmine-0.1.0 spec/lib/runners/phantom_spec.rb
phantom_jasmine-0.0.9 spec/lib/runners/phantom_spec.rb
phantom_jasmine-0.0.8 spec/lib/runners/phantom_spec.rb
phantom_jasmine-0.0.7 spec/lib/runners/phantom_spec.rb