Sha256: ef709bdb745c08d6a11f994635c1555a391ff814f98db35f71448a9c4941d252

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

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

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

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

    it "should have the value of :NULL" do
      expect(subject.null.value).to eq(:NULL)
    end
  end

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

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

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

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ronin-code-sql-2.0.0.beta1 spec/sql/literals_spec.rb