Sha256: f738750e651096106d9dc4d5ed2a5e8e634d61efc07174992837c11176be4954

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

# -*- encoding : utf-8 -*-
require 'wagn/spec_helper'

describe Card::Set::All::Json, "JSON mod" do
  context "status view" do
    it "should handle real and virtual cards" do
      jf = Card::JsonFormat
      real_json = jf.new(Card['T']).show :view=>:status
      JSON[real_json].should == {"key"=>"t","status"=>"real","id"=>Card['T'].id, 'url_key'=>'T'}
      virtual_json = jf.new(Card.fetch('T+*self')).show :view=>:status
      JSON[virtual_json].should == {"key"=>"t+*self","status"=>"virtual",'url_key'=>'T+*self'}
    end
    
    it "should treat both unknown and unreadable cards as unknown" do
      Account.as Card::AnonID do
        jf = Card::JsonFormat
        
        unknown = Card.new :name=>'sump'
        unreadable = Card.new :name=>'kumq', :type=>'Fruit'
        unknown_json = jf.new(unknown).show :view=>:status
        JSON[unknown_json].should == {"key"=>"sump","status"=>"unknown", 'url_key'=>'sump'}
        unreadable_json = jf.new(unreadable).show :view=>:status
        JSON[unreadable_json].should == {"key"=>"kumq","status"=>"unknown", 'url_key'=>'kumq'}
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wagn-1.12.13 spec/mods/standard/sets/all/json_spec.rb
wagn-1.12.12 spec/mods/standard/sets/all/json_spec.rb
wagn-1.12.11 spec/mods/standard/sets/all/json_spec.rb
wagn-1.12.10 spec/mods/standard/sets/all/json_spec.rb