Sha256: 4648eb34cd43681ce43093706a3cba39c0e9cce65af09058c80fc581e8e03577

Contents?: true

Size: 917 Bytes

Versions: 1

Compression:

Stored size: 917 Bytes

Contents

require 'spec_helper'
require 'ronin/code/sql/statement'

describe Ronin::Code::SQL::Statement do
  describe "#initialize" do
    context "when given an argument" do
      let(:argument) { 1 }

      subject { described_class.new(:STATEMENT,argument) }

      it "should set the argument" do
        expect(subject.argument).to eq(argument)
      end
    end

    context "when given a block" do
      subject do
        described_class.new(:STATEMENT) { @x = 1 }
      end

      it "should instance_eval the block" do
        expect(subject.instance_variable_get(:@x)).to eq(1)
      end

      context "that accepts an argument" do
        it "should yield itself" do
          yielded_statement = nil

          described_class.new(:STATEMENT) do |stmt|
            yielded_statement = stmt
          end

          expect(yielded_statement).to be_kind_of(described_class)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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