Sha256: 4debb7fad1940190d6a2ff075af43626db857ed9ba0cc814b815a0a2e91d018b

Contents?: true

Size: 782 Bytes

Versions: 10

Compression:

Stored size: 782 Bytes

Contents

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

describe Alephant::Publisher::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

10 entries across 10 versions & 1 rubygems

Version Path
alephant-publisher-0.6.10 spec/views_json_spec.rb
alephant-publisher-0.6.9 spec/views_json_spec.rb
alephant-publisher-0.6.8 spec/views_json_spec.rb
alephant-publisher-0.6.7 spec/views_json_spec.rb
alephant-publisher-0.6.6 spec/views_json_spec.rb
alephant-publisher-0.6.5 spec/views_json_spec.rb
alephant-publisher-0.6.4 spec/views_json_spec.rb
alephant-publisher-0.6.3 spec/views_json_spec.rb
alephant-publisher-0.6.2 spec/views_json_spec.rb
alephant-publisher-0.6.1 spec/views_json_spec.rb