Sha256: 2dcdeb35ec18e396cf46a29325d47e69234a250bdecbf4da3e290d3f9e5618f7

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require "spec_helper"

module Scenic::ActiveRecord::CommandRecorder
  describe StatementArguments do
    describe "#view" do
      it "is the view name" do
        raw_args = [:spaceships, { foo: :bar }]
        args = StatementArguments.new(raw_args)

        expect(args.view).to eq :spaceships
      end
    end

    describe "#revert_to_version" do
      it "is the revert_to_version from the keyword arguments" do
        raw_args = [:spaceships, { revert_to_version: 42 }]
        args = StatementArguments.new(raw_args)

        expect(args.revert_to_version).to eq 42
      end

      it "is nil if the revert_to_version was not supplied" do
        raw_args = [:spaceships, { foo: :bar }]
        args = StatementArguments.new(raw_args)

        expect(args.revert_to_version).to be nil
      end
    end

    describe "#invert_version" do
      it "returns object with version set to revert_to_version" do
        raw_args = [:meatballs, { version: 42, revert_to_version: 15 }]

        inverted_args = StatementArguments.new(raw_args).invert_version

        expect(inverted_args.version).to eq 15
        expect(inverted_args.revert_to_version).to be nil
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scenic-0.1.0 spec/scenic/active_record/command_recorder/statement_arguments_spec.rb