Sha256: 77deebbfe489d2c89ec4c683e3cb18be8804ac8fef74bd86d48243c2f7714753

Contents?: true

Size: 1.68 KB

Versions: 2

Compression:

Stored size: 1.68 KB

Contents

require 'spec_helper'

describe "item" do
  with_models
  login_as :user

  it 'slug validation (from error)' do
    i = Factory.create :item
    i.slug = 'space '
    i.should_not be_valid
  end

  # describe 'safe_query' do
  #   it "general case" do
  #     Models::Item.safe_query(
  #       name: 'name',
  #       created_at: '10/11/2000',
  #       sort: [['state', -1]], #"state asc",
  #       owner_name: 'name',
  #       state: ['state'],
  #       tags: 'tag',
  #       # _class: 'Note',
  #       updated_at: ['10/11/2000'],
  #
  #       viewers: 'role',
  #       collaborators: 'role'
  #     ).should == [{
  #       "name"=>"name",
  #       "created_at" => "10/11/2000".to_time,
  #       # "order" => "state asc",
  #       "owner_name" => "name",
  #       "state" => ["state"],
  #       "tags" => "tag",
  #       # "_class" => "Note",
  #       "updated_at" => ["10/11/2000".to_time]
  #     },
  #     {
  #       'sort' => [['state', -1]]
  #     },
  #     true]
  #   end
  #
  #   # it "should allow only one-level order and only indexed keywords" do
  #   #   Models::Item.safe_query(order: "name").should == [{'order' => "name"}, false]
  #   #   Models::Item.safe_query(order: "name desc").should == [{'order' => "name desc"}, false]
  #   #   Models::Item.safe_query(order: "name asc").should == [{'order' => "name asc"}, false]
  #   #
  #   #   Models::Item.safe_query(order: "dependent").should == [{}, true] # not indexed
  #   #
  #   #   # two level order
  #   #   Models::Item.safe_query(order: "name created_at").should == [{'order' => 'name'}, true]
  #   #   Models::Item.safe_query(order: "name created_at desc").should == [{'order' => 'name'}, true]
  #   # end
  # end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rad_kit-0.0.10 spec/models/item_spec.rb
rad_kit-0.0.9 spec/models/item_spec.rb