Sha256: 0e54b50b9193b68844bd0b1a2cc737680d4225310539cef1db097f49f88222c2

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

require 'perl/value/hash'
require 'perl/interpreter'

describe Perl::Value::Hash do
  include PerlValueHelpers

  context "built without arguments" do
    its(:perl) { should_not be_nil }
    its(:hash) { should be_nil }
    its(:hv) { should be_nil }
  end

  context "built from a String" do
    let(:input) { "pippo" }
    it do
      lambda { described_class.new(input) }.should raise_error
    end
  end

  context "built from a Hash" do
    before(:all) do
      @interpreter = Perl::Interpreter.new
    end
    after(:all) do
      @interpreter.stop
    end

    let(:input) { {:a => "b", :c => "d"} }
    subject { described_class.new(input) }
    its(:perl) { should_not be_nil }
    its(:hash) { should_not be_nil }
    its(:hash) { should eq(input) }
    its(:hv) { should be_nil }

    describe "when #to_perl is called" do
      it "should return the expected object" do
        subject.to_perl.should_not be_nil
      end

      it "should cache the returned object" do
        subject.to_perl.should == subject.hv
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-perl-04.01.2011.2 spec/hash_value_spec.rb
ruby-perl-04.01.2011.1 spec/hash_value_spec.rb
ruby-perl-04.01.2011 spec/hash_value_spec.rb
ruby-perl-0.99.15j spec/hash_value_spec.rb