Sha256: 2051fa0be30bd576ae1eef0a617c09d3f954a6e436684353f0ad92591ef01163

Contents?: true

Size: 658 Bytes

Versions: 2

Compression:

Stored size: 658 Bytes

Contents

require 'spec_helper'
module Alf
  describe Selector, ".coerce" do

    subject{ Selector.coerce(arg) }

    before do
      subject.should be_a(Selector)
    end

    context 'on a Symbol' do
      let(:arg){ :name }

      it { should eq(Selector.new(:name)) }
    end

    context 'on a single string' do
      let(:arg){ "name" }

      it { should eq(Selector.new(:name)) }
    end

    context 'on a composite string' do
      let(:arg){ "a.name" }

      it { should eq(Selector.new([:a, :name])) }
    end

    context 'on an array of strings' do
      let(:arg){ ["a", "name"] }

      it { should eq(Selector.new([:a, :name])) }
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-types/selector/test_coerce.rb
alf-core-0.14.0 spec/unit/alf-types/selector/test_coerce.rb