Sha256: 102553cf75eac8349e163932d9f7e6b260f47a524fddd2bf8507afaaf50b99ce

Contents?: true

Size: 1 KB

Versions: 24

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe "rearview/dashboards/index" do
  let(:dashboards) {
    [ create(:dashboard), create(:dashboard) ]
  }
  it "renders dashboards json" do
    assign(:dashboards,dashboards)
    render :template => "rearview/dashboards/index", :formats => :json, :handler => :jbuilder
    json = JSON.parse(rendered)
    expect(json).to be_a_kind_of(Array)
    expect(json.size).to eq(2)
  end
  context "renders json with the correct enclosing type when there is no data" do
    it "when nil" do
      assign(:dashboards,nil)
      render :template => "rearview/dashboards/index", :formats => :json, :handler => :jbuilder
      json = JSON.parse(rendered)
      expect(json).to be_a_kind_of(Array)
      expect(json).to be_empty
    end
    it "when empty" do
      assign(:dashboards,[])
      render :template => "rearview/dashboards/index", :formats => :json, :handler => :jbuilder
      json = JSON.parse(rendered)
      expect(json).to be_a_kind_of(Array)
      expect(json).to be_empty
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
rearview-1.2.3-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.2.2.rc.2-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.2.2.rc.1-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.2.1-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.2.0-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.1.2-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.1.1-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.1.0-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.0.3.rc.4-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.0.3.rc.3-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.0.3.rc.2-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.0.3.rc.1-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.0.2-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.0.2.rc.4-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.0.2.rc.3-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.0.2.rc.2-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.0.2.rc.1-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.0.1-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.0.0-jruby spec/views/dashboards/index.json.jbuilder_spec.rb
rearview-1.0.0.rc5-jruby spec/views/dashboards/index.json.jbuilder_spec.rb