Sha256: f61ce28419b72e991fb21c263b31497478f3e77c3911d444566d268ad3a0a5f8

Contents?: true

Size: 797 Bytes

Versions: 7

Compression:

Stored size: 797 Bytes

Contents

require 'spec_helper'
require 'ej'

describe Ej::Core do
  before do
    @core = Core.new('localhost', '_all', false)
  end

  it "core not nil" do
    @core.should_not nil
  end

  it "parse json" do
    @core.send(:parse_json, '{"id":1, "name":"rspec"}').should == [{"id" => 1, "name" => "rspec"}]
  end

  it "parse json" do
    json = %[{"id":1, "name":"rspec"}
      {"id":1, "name":"rspec"}
      {"id":1, "name":"rspec"}
      {"id":1, "name":"rspec"}] 
    @core.send(:parse_json, json).should == [{"id" => 1, "name" => "rspec"}, {"id" => 1, "name" => "rspec"}, {"id" => 1, "name" => "rspec"}, {"id" => 1, "name" => "rspec"}]
  end

  it "generate id" do
    @core.send(:generate_id, '%s_%s', {"id" => 1, "name" => "rspec"}, ['id', 'name']).should == '1_rspec'
  end

  after do
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ej-0.1.4 spec/core_spec.rb
ej-0.1.3 spec/core_spec.rb
ej-0.1.2 spec/core_spec.rb
ej-0.1.1 spec/core_spec.rb
ej-0.1.0 spec/core_spec.rb
ej-0.0.12 spec/core_spec.rb
ej-0.0.10 spec/core_spec.rb