Sha256: 25f0b1758f3c670ea037dfe06bc77ede10c5b257b3c6b834e90e8daaee964d16

Contents?: true

Size: 1.52 KB

Versions: 8

Compression:

Stored size: 1.52 KB

Contents

require 'helper'

class TestField < Coupler::Test::IntegrationTest
  def self.startup
    super
    Connection.delete
    each_adapter do |adapter, config|
      data = Array.new(50) { [Forgery(:name).first_name, Forgery(:name).last_name] }
      conn = new_connection(adapter, :name => "#{adapter} connection").save!
      conn.database do |db|
        db.create_table!(:test_data) do
          primary_key :id
          String :first_name
          String :last_name
        end
        db[:test_data].import([:first_name, :last_name], data)
      end
    end
  end

  each_adapter do |adapter, _|
    adapter_test(adapter, "scenarios_dataset") do
      connection = new_connection(adapter, :name => "#{adapter} connection").save!
      project = Project.create(:name => "foo")
      resource = Resource.create({
        :name => "Test resource", :table_name => 'test_data',
        :project => project, :connection => connection
      })
      scenario = Scenario.create({
        :name => "Test scenario",
        :resource_1 => resource, :project => project
      })
      first_name = resource.fields_dataset[:name => 'first_name']
      matcher = Matcher.create({
        :scenario => scenario,
        :comparisons_attributes => [
          {:lhs_type => 'field', :raw_lhs_value => first_name.id, :lhs_which => 1, :rhs_type => 'field', :raw_rhs_value => first_name.id, :rhs_which => 2, :operator => 'equals'},
        ],
      })

      ds = first_name.scenarios_dataset
      assert_equal scenario.id, ds.get(:scenarios__id)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
coupler-0.0.9-java test/integration/test_field.rb
coupler-0.0.8-java test/integration/test_field.rb
coupler-0.0.7-java test/integration/test_field.rb
coupler-0.0.6-java test/integration/test_field.rb
coupler-0.0.4-java test/integration/test_field.rb
coupler-0.0.3-java test/integration/test_field.rb
coupler-0.0.2-java test/integration/test_field.rb
coupler-0.0.1-java test/integration/test_field.rb