Sha256: 9f94a3b550412a73ef01762e63129420a2f73718ea7e937331566b194afaf084

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'
require 'ronin/sql/literals'

describe SQL::Literals do
  subject { Object.new.extend(described_class) }

  describe "#null" do
    it "should return a Literal" do
      subject.null.should be_kind_of(SQL::Literal)
    end

    it "should have the value of :NULL" do
      subject.null.value.should == :NULL
    end
  end

  describe "#int" do
    it "should return a Literal" do
      subject.int(5).should be_kind_of(SQL::Literal)
    end

    it "should convert the value to an Integer" do
      subject.int('5').value.should == 5
    end
  end

  describe "#float" do
    it "should return a Literal" do
      subject.float(1.5).should be_kind_of(SQL::Literal)
    end

    it "should convert the value to a Float" do
      subject.float('1.5').value.should == 1.5
    end
  end

  describe "#float" do
    it "should return a Literal" do
      subject.string('A').should be_kind_of(SQL::Literal)
    end

    it "should convert the value to a String" do
      subject.string(42).value.should == '42'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ronin-sql-1.1.0 spec/sql/literals_spec.rb
ronin-sql-1.0.0 spec/sql/literals_spec.rb