Sha256: 32de3cb401c91148a90452d433ab5d59ff5db2b6be5c5d460f8fc351391b64f3

Contents?: true

Size: 934 Bytes

Versions: 20

Compression:

Stored size: 934 Bytes

Contents

require 'spec_helper'

describe Rearview::DashboardChildrenController do

  let(:parent) { create(:dashboard) }
  before do
    @routes = Rearview::Engine.routes
    sign_in_as create(:user)
  end

  context "GET /children" do
    it "renders the index view" do
      get :index, dashboard_id: parent.id, format: :json
      render_template(:index)
    end
  end

  context "POST /children" do
    it "renders the create view" do
      json = JsonFactory::Dashboard.create(build(:dashboard))
      json[:dashboard_id] = parent.id
      post :create, json
      render_template(:create)
    end
    it "creates the child association to the parent" do
      dashboard = build(:dashboard)
      json = JsonFactory::Dashboard.create(build(:dashboard))
      json[:dashboard_id] = parent.id
      Rearview::Dashboard.stubs(:new).returns(dashboard)
      dashboard.expects(:parent=).with(parent)
      post :create, json
    end
  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rearview-1.2.0-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.1.2-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.1.1-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.1.0-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.3.rc.4-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.3.rc.3-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.3.rc.2-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.3.rc.1-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.2-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.2.rc.4-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.2.rc.3-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.2.rc.2-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.2.rc.1-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.1-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.0-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.0.rc5-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.0.rc4-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.0.rc3-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.0.rc2-jruby spec/controllers/dashboard_children_controller_spec.rb
rearview-1.0.0.rc1-jruby spec/controllers/dashboard_children_controller_spec.rb