Sha256: 02dd09e8f021871bbf40820d3db21b531d0a37cc56cb6a60d38336412b2c9808

Contents?: true

Size: 781 Bytes

Versions: 11

Compression:

Stored size: 781 Bytes

Contents

require 'spec_helper'
require 'fixtures/components/foo/models/json'

describe Alephant::Renderer::Views::Json do
  let(:data) { {'foo' => 'test', 'bar' => 'white', 'baz' => 'list'} }

  describe "#content_type" do

    it "sets the correct content type" do
      expect(MyApp::Json.new(data).content_type).to eq('application/json')
    end

  end

  describe "#to_h" do

    it "generates a hash based on the white list" do
      expected_result = {'item1' => 'test', 'item2' => 'white'}
      expect(MyApp::Json.new(data).to_h).to eq(expected_result)
    end

  end

  describe "#render" do

    it "returns generated json" do
      expected_result = "{\"item1\":\"test\",\"item2\":\"white\"}"
      expect(MyApp::Json.new(data).render).to eq(expected_result)
    end

  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
alephant-renderer-2.0.1 spec/views_json_spec.rb
alephant-renderer-2.0.0 spec/views_json_spec.rb
alephant-renderer-1.0.5 spec/views_json_spec.rb
alephant-renderer-1.0.4 spec/views_json_spec.rb
alephant-renderer-1.0.3 spec/views_json_spec.rb
alephant-renderer-1.0.2 spec/views_json_spec.rb
alephant-renderer-1.0.1 spec/views_json_spec.rb
alephant-renderer-1.0.0 spec/views_json_spec.rb
alephant-renderer-0.3.0 spec/views_json_spec.rb
alephant-renderer-0.2.0 spec/views_json_spec.rb
alephant-renderer-0.1.0 spec/views_json_spec.rb