Sha256: 2d98d8d853f25767f4cbbb3de7acad45597ebd4e4f0e07a1d696190e2bf7bf4f

Contents?: true

Size: 835 Bytes

Versions: 1

Compression:

Stored size: 835 Bytes

Contents

require 'helper'

describe Plucky::OptionsHash do
  subject { described_class.new }

  describe "#[]=" do
    it "changes order to sort" do
      subject[:order] = "foo asc"
      subject[:sort].should == [["foo", 1]]
      subject[:order].should be_nil
    end

    it "changes select to fields" do
      subject[:select] = [:foo]
      subject[:fields].should == [:foo]
      subject[:select].should be_nil
    end

    it "changes offset to skip" do
      subject[:offset] = 10
      subject[:skip].should == 10
      subject[:offset].should be_nil
    end

    it "changes id to _id" do
      subject[:id] = :foo
      subject[:_id].should == :foo
      subject[:id].should be_nil
    end

    it "does not change the sort field" do
      subject[:order] = :order.asc
      subject[:sort].should == [["order", 1]]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
plucky-0.6.5 spec/functional/options_hash_spec.rb