Sha256: 268408beabf2328a636f2b1f1c9a48081b871b84ab6ecac65626500328f8be73

Contents?: true

Size: 1.13 KB

Versions: 17

Compression:

Stored size: 1.13 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'
require 'mspec/guards/endian'

describe Object, "#big_endian" do
  before :each do
    @guard = BigEndianGuard.new
    BigEndianGuard.stub!(:new).and_return(@guard)
    ScratchPad.clear
  end

  it "yields on big-endian platforms" do
    @guard.stub!(:pattern).and_return([1])
    big_endian { ScratchPad.record :yield }
    ScratchPad.recorded.should == :yield
  end

  it "does not yield on little-endian platforms" do
    @guard.stub!(:pattern).and_return([0])
    big_endian { ScratchPad.record :yield }
    ScratchPad.recorded.should_not == :yield
  end
end

describe Object, "#little_endian" do
  before :each do
    @guard = LittleEndianGuard.new
    LittleEndianGuard.stub!(:new).and_return(@guard)
    ScratchPad.clear
  end

  it "yields on little-endian platforms" do
    @guard.stub!(:pattern).and_return([0])
    little_endian { ScratchPad.record :yield }
    ScratchPad.recorded.should == :yield
  end

  it "does not yield on big-endian platforms" do
    @guard.stub!(:pattern).and_return([1])
    little_endian { ScratchPad.record :yield }
    ScratchPad.recorded.should_not == :yield
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mspec-1.0.0 spec/guards/endian_spec.rb
mspec-1.5.0 spec/guards/endian_spec.rb
mspec-1.1.1 spec/guards/endian_spec.rb
mspec-1.5.3 spec/guards/endian_spec.rb
mspec-1.1.0 spec/guards/endian_spec.rb
mspec-1.2.0 spec/guards/endian_spec.rb
mspec-1.3.0 spec/guards/endian_spec.rb
mspec-1.3.1 spec/guards/endian_spec.rb
mspec-1.4.0 spec/guards/endian_spec.rb
mspec-1.5.1 spec/guards/endian_spec.rb
mspec-1.5.4 spec/guards/endian_spec.rb
mspec-1.5.2 spec/guards/endian_spec.rb
mspec-1.5.9 spec/guards/endian_spec.rb
mspec-1.5.6 spec/guards/endian_spec.rb
mspec-1.5.7 spec/guards/endian_spec.rb
mspec-1.5.8 spec/guards/endian_spec.rb
mspec-1.5.5 spec/guards/endian_spec.rb