Sha256: 5bf9fb1273e67581a47f72b37959199b77205e8898688b270dc8ef884ae2d23a

Contents?: true

Size: 1.63 KB

Versions: 4

Compression:

Stored size: 1.63 KB

Contents

require 'spec_helper'

describe Rearview::DashboardsController do

  before do
    sign_in_as create(:user)
    @routes = Rearview::Engine.routes
  end

  context "GET /dashboards" do
    it "renders the index view" do
      get :index, format: :json
      expect(response).to render_template("rearview/dashboards/index")
    end
  end

  context "GET /dashboards/:id" do
    it "renders the show view" do
      app = create(:dashboard)
      get :show, id: app.id, format: :json
      expect(response).to render_template("rearview/dashboards/show")
    end
  end

  context "GET /dashboards/:id/errors" do
    it "renders the errors view" do
      app = create(:dashboard)
      get :errors, id: app.id, format: :json
      expect(response).to render_template("rearview/dashboards/errors")
    end
  end

  context "POST /dashboards" do
    it "renders the create view" do
      app = build(:dashboard)
      post :create, JsonFactory::Dashboard.create(app)
      expect(response).to render_template("rearview/dashboards/show")
    end
  end

  context "PUT /dashboards/:id" do
    it "renders the update view" do
      app1 = create(:dashboard)
      app2 = build(:dashboard)
      params = JsonFactory::Dashboard.create(app2) do |json|
        json["id"]=app1.id
        json["userId"]=app1.user_id
      end
      put :update, params
      expect(response).to render_template("rearview/dashboards/show")
    end
  end

  context "DELETE /dashboards/:id" do
    it "renders the show view" do
      app = create(:dashboard)
      delete :destroy, id: app.id, format: :json
      expect(response).to render_template("rearview/dashboards/show")
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rearview-1.2.3-jruby spec/controllers/dashboards_controller_spec.rb
rearview-1.2.2.rc.2-jruby spec/controllers/dashboards_controller_spec.rb
rearview-1.2.2.rc.1-jruby spec/controllers/dashboards_controller_spec.rb
rearview-1.2.1-jruby spec/controllers/dashboards_controller_spec.rb