Sha256: 5e86c679e642589f8a35f4dd3878f780fb5a3804e7cf358e321dd129e2d8a6db

Contents?: true

Size: 1.36 KB

Versions: 7

Compression:

Stored size: 1.36 KB

Contents

require "spec_helper"
require "fx/trigger"

module Fx
  describe Trigger do
    describe "#<=>" do
      it "delegates to `name`" do
        trigger_a = Trigger.new(
          "name" => "name_a",
          "definition" => "some defintion",
        )
        trigger_b = Trigger.new(
          "name" => "name_b",
          "definition" => "some defintion",
        )
        trigger_c = Trigger.new(
          "name" => "name_c",
          "definition" => "some defintion",
        )

        expect(trigger_b).to be_between(trigger_a, trigger_c)
      end
    end

    describe "#==" do
      it "compares `name` and `definition`" do
        trigger_a = Trigger.new(
          "name" => "name_a",
          "definition" => "some defintion",
        )
        trigger_b = Trigger.new(
          "name" => "name_b",
          "definition" => "some other defintion",
        )

        expect(trigger_a).not_to eq(trigger_b)
      end
    end

    describe "#to_schema" do
      it "returns a schema compatible version of the trigger" do
        trigger = Trigger.new(
          "name" => "uppercase_users_name",
          "definition" => "CREATE TRIGGER uppercase_users_name ...",
        )

        expect(trigger.to_schema).to eq <<-EOS
  create_trigger :uppercase_users_name, sql_definition: <<-\SQL
      CREATE TRIGGER uppercase_users_name ...
  SQL
        EOS
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
fx-jets-0.6.3s spec/fx/trigger_spec.rb
fx-0.6.2 spec/fx/trigger_spec.rb
fx-0.6.1 spec/fx/trigger_spec.rb
fx-0.6.0 spec/fx/trigger_spec.rb
fx-0.5.0 spec/fx/trigger_spec.rb
fx-0.4.0 spec/fx/trigger_spec.rb
fx-0.3.1 spec/fx/trigger_spec.rb