Sha256: a63f51ed5113b32c0d8e740093c011ab6961cb92b2330dddddd06e6e6a44ed9a

Contents?: true

Size: 1.11 KB

Versions: 39

Compression:

Stored size: 1.11 KB

Contents

require 'rails_helper'

describe Tabulatr::JsonBuilder do

  describe '.insert_attribute_in_hash' do
    it "does not complain when no id is manually provided" do
      attribute = {action: :id}
      data = {title: 'test', price: '7.0 EUR'}
      expect{Tabulatr::JsonBuilder.insert_attribute_in_hash(attribute, data)}.to_not raise_error
    end

    it "complains when a non given attribute other than id is requested" do
      attribute = {action: :bar}
      data = {title: 'test', price: '7.0 EUR'}
      expect{Tabulatr::JsonBuilder.insert_attribute_in_hash(attribute, data)}.to raise_error
    end

    # it 'accepts arguments without table name' do
    #   attribute = {action: :title}
    #   data = {"products"=>
    #     {"title"=>"title 9", "id"=>10, "price"=>"32.0 EUR",
    #       "vendor_product_name"=>"title 9 from my first vendor"},
    #   "vendor"=>
    #     {"name"=>"my first vendor"},
    #   "tags"=>{"title"=>"''", "count"=>0},
    #   "_row_config"=>{"class"=>"tabulatr-row"}, "id"=>10}
    #   expect{Tabulatr::JsonBuilder.insert_attribute_in_hash(attribute, data)}.to_not raise_error
    # end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
tabulatr2-0.10.4 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.10.3 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.10.2 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.10.1 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.10.0 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.48 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.47 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.46 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.45 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.44 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.43 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.42 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.41 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.40 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.39 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.38 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.37 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.36 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.35 spec/lib/tabulatr/json_builder_spec.rb
tabulatr2-0.9.34 spec/lib/tabulatr/json_builder_spec.rb