Sha256: 9e6ee6529636a987fb1f300cc365b98625f1926d4802f616ddb1fbd78e86f81d

Contents?: true

Size: 1.44 KB

Versions: 4

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'

describe ArchivesController, "routes" do
  it { should route(:delete, "/accounts/abc/projects/def/archive").
                to(:action => :destroy, :account_id => 'abc', :project_id => 'def') }
  it { should route(:post, "/accounts/abc/projects/def/archive").
                to(:action => :create, :account_id => 'abc', :project_id => 'def') }
end

describe ArchivesController, "destroy", :as => :project_admin do
  before do
    delete :destroy, :project_id => project.to_param, :account_id => account.to_param
  end

  it { should set_the_flash.to(/unarchived/) }

  it "should redirect to account_projects_url" do
    should redirect_to(account_projects_url(account))
  end
end

describe ArchivesController, "archive", :as => :project_admin do
  before do
    post :create, :project_id => project.to_param, :account_id => account.to_param
  end

  it { should set_the_flash.to(/archived/) }

  it "should redirect to account_projects_url" do
    should redirect_to(account_projects_url(account))
  end
end

describe ArchivesController, "as a non-admin", :as => :project_member do
  it { should deny_access.on(:delete, :destroy, :project_id => project.to_param,
                                                :account_id => account.to_param).
                          flash(/admin/) }

  it { should deny_access.on(:post, :create, :account_id => account.to_param, :project_id => project.to_param).
                          flash(/admin/) }
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
saucy-0.5.3 spec/controllers/archives_controller_spec.rb
saucy-0.5.2 spec/controllers/archives_controller_spec.rb
saucy-0.5.1 spec/controllers/archives_controller_spec.rb
saucy-0.5.0 spec/controllers/archives_controller_spec.rb