Sha256: eef521e3aa10851ef2cf0d57655f996f74bba32ad20b2e7f3f3551279224b13a

Contents?: true

Size: 670 Bytes

Versions: 1

Compression:

Stored size: 670 Bytes

Contents

describe VarName do

  let(:context) { clean_context }
  let(:variable_name) { 'var'.to_var_name }

  it "returns the associated value if it was defined in the context" do
    context.set variable_name, 42.to_gbs_num
    expect(variable_name.evaluate(context)).to eq(42.to_gbs_num)
  end

  it "raises an error if there is no definition in context" do
    expect { variable_name.evaluate context }
      .to raise_error(UndefinedVariableError)
  end

  describe "#named?" do

    it "is named 'var'" do
      expect(variable_name.named? 'var').to be true
    end

    it "is not named 'blah'" do
      expect(variable_name.named? 'blah').to be false
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gobstones-0.0.2 spec/lang/expressions/var_name_spec.rb