Sha256: f38f591931a42d500b656b363265a71371f4123f6a9a1b58298b7d777a7b75c0

Contents?: true

Size: 1.38 KB

Versions: 13

Compression:

Stored size: 1.38 KB

Contents

require_relative '../../spec_helper'

describe Cranium::Transformation::Join do

  let(:join) { Cranium::Transformation::Join.new }

  describe "#execute" do
    context "when validating its parameters" do
      before(:each) do
        join.source_left = "left source"
        join.source_right = "right source"
        join.target = "target source"
        join.match_fields = { field1: :field2 }
      end

      it "should raise an error if :source_left isn't set" do
        join.source_left = nil
        expect { join.execute }.to raise_error "Missing left source for join transformation"
      end

      it "should raise an error if :source_right isn't set" do
        join.source_right = nil
        expect { join.execute }.to raise_error "Missing right source for join transformation"
      end

      it "should raise an error if :target isn't set" do
        join.target = nil
        expect { join.execute }.to raise_error "Missing target for join transformation"
      end

      it "should raise an error if :match_fields is set but isn't a Hash" do
        join.match_fields = :field
        expect { join.execute }.to raise_error "Invalid match fields for join transformation"
      end

      it "should raise an error if :type is not supported" do
        join.type = :cross
        expect { join.execute }.to raise_error "Invalid type for join transformation"
      end
    end
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cranium-0.8.1 spec/cranium/transformation/join_spec.rb
cranium-0.8 spec/cranium/transformation/join_spec.rb
cranium-0.7 spec/cranium/transformation/join_spec.rb
cranium-0.6.1 spec/cranium/transformation/join_spec.rb
cranium-0.5 spec/cranium/transformation/join_spec.rb
cranium-0.4.3 spec/cranium/transformation/join_spec.rb
cranium-0.4.2 spec/cranium/transformation/join_spec.rb
cranium-0.4.1 spec/cranium/transformation/join_spec.rb
cranium-0.4 spec/cranium/transformation/join_spec.rb
cranium-0.3.1 spec/cranium/transformation/join_spec.rb
cranium-0.3.0 spec/cranium/transformation/join_spec.rb
cranium-0.2.1 spec/cranium/transformation/join_spec.rb
cranium-0.2.0 spec/cranium/transformation/join_spec.rb