Sha256: 1f709407a3c91966e2a1adfcdb04cc730b039e975e87e21c07aa5682b9049016

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe Dune::Admin::FinancialsController do
  routes { Dune::Admin::Engine.routes }
  let(:admin) { create(:user, admin: true) }

  before do
    controller.stub(:current_user).and_return(admin)
  end

  describe "GET index" do
    context 'as html format' do
      before { get :index, locale: 'pt' }

      it{ should render_template :index }
      its(:status){ should == 200 }
    end

    context 'as csv format' do
      before { get :index, format: :csv, locale: 'pt' }

      it{ expect(response.content_type).to eq 'text/csv' }
      its(:status){ should == 200 }
    end
  end

  describe '.collection' do
    let(:project) { create(:project, name: 'Foo Bar Project') }

    context "when there is a match" do
      before do
        get :index, locale: :pt, name_contains: 'Foo Bar Project'
      end
      it{ assigns(:projects).should eq([project]) }
    end

    context "when there is no match" do
      before do
        get :index, locale: :pt, name_contains: 'Other search'
      end
      it{ assigns(:projects).should eq([]) }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dune-admin-1.2.7 spec/controllers/dune/admin/financials_controller_spec.rb
dune-admin-1.2.6 spec/controllers/dune/admin/financials_controller_spec.rb
dune-admin-1.2.5 spec/controllers/dune/admin/financials_controller_spec.rb
dune-admin-1.2.4 spec/controllers/dune/admin/financials_controller_spec.rb
dune-admin-1.2.3 spec/controllers/dune/admin/financials_controller_spec.rb
dune-admin-1.0.0 spec/controllers/dune/admin/financials_controller_spec.rb
dune-admin-1.2.1 spec/controllers/dune/admin/financials_controller_spec.rb
dune-admin-1.2.0 spec/controllers/dune/admin/financials_controller_spec.rb