Merge pull request #40 from opf/rubocop

Rubocop issues
pull/6827/head
Stefan Botzenhart 9 years ago
commit bb4c609524
  1. 940
      .rubocop.yml
  2. 24
      app/controllers/documents_controller.rb
  3. 6
      app/mailers/documents_mailer.rb
  4. 8
      app/models/activity/document_activity_provider.rb
  5. 12
      app/models/document.rb
  6. 6
      app/models/document_category.rb
  7. 1
      app/models/document_category_custom_field.rb
  8. 1
      app/models/document_observer.rb
  9. 2
      config/routes.rb
  10. 22
      lib/open_project/documents/engine.rb
  11. 2
      lib/open_project/documents/hooks.rb
  12. 6
      lib/open_project/documents/patches/custom_fields_helper_patch.rb
  13. 2
      lib/open_project/documents/patches/project_patch.rb
  14. 17
      lib/open_project/documents/patches/text_formatting_patch.rb
  15. 38
      spec/application_helper_spec.rb
  16. 80
      spec/controllers/documents_controller_spec.rb
  17. 2
      spec/factories/document_factory.rb
  18. 2
      spec/lib/acts_as_journalized/journaled_spec.rb
  19. 13
      spec/mailers/documents_mailer_spec.rb
  20. 15
      spec/models/document_category_spec.rb
  21. 2
      spec/models/document_observer_spec.rb
  22. 12
      spec/models/document_spec.rb
  23. 56
      spec/routing/documents_routing_spec.rb

File diff suppressed because it is too large Load Diff

@ -33,10 +33,10 @@
class DocumentsController < ApplicationController
default_search_scope :documents
model_object Document
before_filter :find_project_by_project_id, :only => [:index, :new, :create]
before_filter :find_model_object, :except => [:index, :new, :create]
before_filter :find_project_from_association, :except => [:index, :new, :create]
before_filter :authorize
before_action :find_project_by_project_id, only: [:index, :new, :create]
before_action :find_model_object, except: [:index, :new, :create]
before_action :find_project_from_association, except: [:index, :new, :create]
before_action :authorize
def index
@ -52,7 +52,7 @@ class DocumentsController < ApplicationController
else
@grouped = documents.includes(:category).group_by(&:category)
end
render :layout => false if request.xhr?
render layout: false if request.xhr?
end
def show
@ -68,12 +68,12 @@ class DocumentsController < ApplicationController
@document = @project.documents.build
@document.attributes = document_params
if @document.save
attachments = Attachment.attach_files(@document, params[:attachments])
Attachment.attach_files(@document, params[:attachments])
render_attachment_warning_if_needed(@document)
flash[:notice] = l(:notice_successful_create)
redirect_to project_documents_path(@project)
else
render :action => 'new'
render action: 'new'
end
end
@ -85,15 +85,15 @@ class DocumentsController < ApplicationController
@document.attributes = document_params
if @document.save
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'show', :id => @document
redirect_to action: 'show', id: @document
else
render :action => 'edit'
render action: 'edit'
end
end
def destroy
@document.destroy
redirect_to :controller => '/documents', :action => 'index', :project_id => @project
redirect_to controller: '/documents', action: 'index', project_id: @project
end
def add_attachment
@ -106,10 +106,10 @@ class DocumentsController < ApplicationController
UserMailer.attachments_added(user, attachments[:files]).deliver
end
end
redirect_to :action => 'show', :id => @document
redirect_to action: 'show', id: @document
end
private
private
def document_params
params.require(:document).permit('category_id', 'title', 'description')
end

@ -39,7 +39,7 @@ class DocumentsMailer < UserMailer
with_locale_for(user) do
subject = "[#{@document.project.name}] #{t(:label_document_new)}: #{@document.title}"
mail :to => user.mail, :subject => subject
mail to: user.mail, subject: subject
end
end
@ -47,11 +47,9 @@ class DocumentsMailer < UserMailer
container = attachments.first.container
@added_to = "#{Document.model_name.human}: #{container.title}"
@added_to_url = url_for(:controller => '/documents', :action => 'show', :id => container.id)
@added_to_url = url_for(controller: '/documents', action: 'show', id: container.id)
super
end
end

@ -40,19 +40,19 @@ class Activity::DocumentActivityProvider < Activity::BaseActivityProvider
]
end
def event_title(event, activity)
def event_title(event, _activity)
"#{Document.model_name.human}: #{event['document_title']}"
end
def event_type(event, activity)
def event_type(_event, _activity)
'document'
end
def event_path(event, activity)
def event_path(event, _activity)
url_helpers.project_documents_url(url_helper_parameter(event))
end
def event_url(event, activity)
def event_url(event, _activity)
url_helpers.project_documents_url(url_helper_parameter(event))
end

@ -32,8 +32,8 @@
class Document < ActiveRecord::Base
belongs_to :project
belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id"
acts_as_attachable :delete_permission => :manage_documents
belongs_to :category, class_name: "DocumentCategory", foreign_key: "category_id"
acts_as_attachable delete_permission: :manage_documents
acts_as_journalized
acts_as_event title: Proc.new { |o| "#{Document.model_name.human}: #{o.title}" },
@ -44,12 +44,12 @@ class Document < ActiveRecord::Base
end)
acts_as_searchable :columns => ['title', "#{table_name}.description"],
:include => :project,
references: :projects
acts_as_searchable columns: ['title', "#{table_name}.description"],
include: :project,
references: :projects
validates_presence_of :project, :title, :category
validates_length_of :title, :maximum => 60
validates_length_of :title, maximum: 60
scope :visible, lambda {
includes(:project)

@ -31,12 +31,12 @@
#++
class DocumentCategory < Enumeration
has_many :documents, :foreign_key => 'category_id'
has_many :documents, foreign_key: 'category_id'
OptionName = :enumeration_doc_categories
OPTION_NAME = :enumeration_doc_categories
def option_name
OptionName
OPTION_NAME
end
def objects_count

@ -35,4 +35,3 @@ class DocumentCategoryCustomField < CustomField
:enumeration_doc_categories
end
end

@ -41,4 +41,3 @@ class DocumentObserver < ActiveRecord::Observer
end
end
end

@ -35,5 +35,3 @@ OpenProject::Application.routes.draw do
resources :documents, shallow: true
end
end

@ -37,18 +37,20 @@ module OpenProject::Documents
include OpenProject::Plugins::ActsAsOpEngine
register 'openproject-documents',
:author_url => "http://www.finn.de",
:requires_openproject => ">= 4.0.0" do
author_url: "http://www.finn.de",
requires_openproject: ">= 4.0.0" do
menu :project_menu, :documents,
{ :controller => '/documents', :action => 'index' },
:param => :project_id,
:caption => :label_document_plural,
:html => { :class => 'icon2 icon-book1' }
{ controller: '/documents', action: 'index' },
param: :project_id,
caption: :label_document_plural,
html: { class: 'icon2 icon-book1' }
project_module :documents do |map|
permission :manage_documents, {:documents => [:new, :create, :edit, :update, :destroy, :add_attachment]}, :require => :loggedin
permission :view_documents, :documents => [:index, :show, :download]
project_module :documents do |_map|
permission :manage_documents, {
documents: [:new, :create, :edit, :update, :destroy, :add_attachment]
}, require: :loggedin
permission :view_documents, documents: [:index, :show, :download]
end
Redmine::Notifiable.all << Redmine::Notifiable.new('document_added')
@ -68,7 +70,7 @@ module OpenProject::Documents
require 'open_project/documents/hooks'
end
initializer 'documents.register_observers' do |app|
initializer 'documents.register_observers' do |_app|
ActiveRecord::Base.observers.push :document_observer
end

@ -32,6 +32,6 @@
module OpenProject::Documents
class Hooks < Redmine::Hook::ViewListener
render_on :activity_index_head,
:partial => 'hooks/documents/activity_index_head'
partial: 'hooks/documents/activity_index_head'
end
end

@ -36,7 +36,11 @@ module OpenProject::Documents::Patches
base.class_eval do
def custom_fields_tabs_with_documents
custom_fields_tabs_without_documents << {:name => 'DocumentCategoryCustomField', :partial => 'custom_fields/tab', :label => DocumentCategory::OptionName}
custom_fields_tabs_without_documents << {
name: 'DocumentCategoryCustomField',
partial: 'custom_fields/tab',
label: DocumentCategory::OptionName
}
end
alias_method_chain :custom_fields_tabs, :documents

@ -34,7 +34,7 @@ module OpenProject::Documents::Patches
def self.included(base)
base.class_eval do
has_many :documents, :dependent => :destroy
has_many :documents, dependent: :destroy
end
end
end

@ -36,8 +36,14 @@ module OpenProject::Documents::Patches
base.class_eval do
def parse_redmine_links_with_documents(text, project, obj, attr, only_path, options)
text.gsub!(/([\s\(,\-\[\>]|^)(!)?(([a-z0-9\-_]+):)?(document)((#+|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|\]|<|$)/) do |m|
leading, esc, project_prefix, project_identifier, prefix, sep, identifier = $1, $2, $3, $4, $5, $7 || $9, $8 || $10
text.gsub!(/([\s\(,\-\[\>]|^)(!)?(([a-z0-9\-_]+):)?(document)((#+|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|\]|<|$)/) do |_m|
leading = $1
esc = $2
project_prefix = $3
project_identifier = $4
prefix = $5
sep = $7 || $9
identifier = $8 || $10
link = nil
if project_identifier
project = Project.visible.find_by_identifier(project_identifier)
@ -51,8 +57,11 @@ module OpenProject::Documents::Patches
document = project.documents.visible.find_by_title(name)
end
if document
link = link_to document.title, {:only_path => only_path, :controller => '/documents', :action => 'show', :id => document},
:class => 'document'
link = link_to document.title, {
only_path: only_path,
controller: '/documents',
action: 'show', id: document },
class: 'document'
end
end
leading + (link || "#{project_prefix}#{prefix}#{sep}#{identifier}")

@ -41,14 +41,20 @@ describe ApplicationHelper do
describe ".format_text" do
let(:project) { FactoryGirl.create :valid_project }
let(:identifier) { project.identifier }
let(:project_member) { FactoryGirl.create :user,
:member_in_project => project,
:member_through_role => FactoryGirl.create(:role,
:permissions => [:view_work_packages, :edit_work_packages,
:view_documents, :browse_repository, :view_changesets, :view_wiki_pages]) }
let(:document) { FactoryGirl.create :document,
:title => 'Test document',
:project => project }
let(:role) {
FactoryGirl.create(:role, permissions: [
:view_work_packages, :edit_work_packages, :view_documents, :browse_repository, :view_changesets, :view_wiki_pages
])
}
let(:project_member) {
FactoryGirl.create :user, member_in_project: project,
member_through_role: role
}
let(:document) {
FactoryGirl.create :document,
title: 'Test document',
project: project
}
before do
@project = project
@ -60,9 +66,11 @@ describe ApplicationHelper do
end
context "Simple Document links" do
let(:document_link) { link_to('Test document',
{:controller => 'documents', :action => 'show', :id => document.id},
:class => 'document') }
let(:document_link) {
link_to('Test document',
{ controller: 'documents', action: 'show', id: document.id },
class: 'document')
}
context "Plain link" do
subject { format_text("document##{document.id}") }
@ -93,25 +101,25 @@ describe ApplicationHelper do
let(:the_other_project) { FactoryGirl.create :valid_project }
context "By name without project" do
subject { format_text("document:\"#{document.title}\"", :project => the_other_project) }
subject { format_text("document:\"#{document.title}\"", project: the_other_project) }
it { is_expected.to eq('<p>document:"Test document"</p>') }
end
context "By id and given project" do
subject { format_text("#{identifier}:document##{document.id}", :project => the_other_project) }
subject { format_text("#{identifier}:document##{document.id}", project: the_other_project) }
it { is_expected.to eq("<p><a class=\"document\" href=\"/documents/#{document.id}\">Test document</a></p>") }
end
context "By name and given project" do
subject { format_text("#{identifier}:document:\"#{document.title}\"", :project => the_other_project) }
subject { format_text("#{identifier}:document:\"#{document.title}\"", project: the_other_project) }
it { is_expected.to eq("<p><a class=\"document\" href=\"/documents/#{document.id}\">Test document</a></p>") }
end
context "Invalid link" do
subject { format_text("invalid:document:\"Test document\"", :project => the_other_project) }
subject { format_text("invalid:document:\"Test document\"", project: the_other_project) }
it { is_expected.to eq('<p>invalid:document:"Test document"</p>') }
end

@ -28,8 +28,8 @@
#
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.dirname(__FILE__) + '/../spec_helper'
require File.dirname(__FILE__) + '/../spec_helper'
describe DocumentsController do
@ -38,10 +38,11 @@ describe DocumentsController do
let(:admin) { FactoryGirl.create(:admin)}
let(:project) { FactoryGirl.create(:project, name: "Test Project")}
let(:user) { FactoryGirl.create(:user)}
let(:role) { FactoryGirl.create(:role, :permissions => [:view_documents]) }
let(:default_category){ FactoryGirl.create(:document_category, project: project, name: "Default Category")}
let(:role) { FactoryGirl.create(:role, permissions: [:view_documents]) }
let(:default_category){
FactoryGirl.create(:document_category, project: project, name: "Default Category")
}
before do
allow(User).to receive(:current).and_return admin
@ -49,28 +50,27 @@ describe DocumentsController do
describe "index" do
let(:document) { FactoryGirl.create(:document, title: "Sample Document", project: project, category: default_category) }
let(:document) {
FactoryGirl.create(:document, title: "Sample Document", project: project, category: default_category)
}
before :each do
before do
document.update_attributes(description:<<LOREM)
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut egestas, mi vehicula varius varius, ipsum massa fermentum orci, eget tristique ante sem vel mi. Nulla facilisi. Donec enim libero, luctus ac sagittis sit amet, vehicula sagittis magna. Duis ultrices molestie ante, eget scelerisque sem iaculis vitae. Etiam fermentum mauris vitae metus pharetra condimentum fermentum est pretium. Proin sollicitudin elementum quam quis pharetra. Aenean facilisis nunc quis elit volutpat mollis. Aenean eleifend varius euismod. Ut dolor est, congue eget dapibus eget, elementum eu odio. Integer et lectus neque, nec scelerisque nisi. EndOfLineHere
Vestibulum non velit mi. Aliquam scelerisque libero ut nulla fringilla a sollicitudin magna rhoncus. Praesent a nunc lorem, ac porttitor eros. Sed ac diam nec neque interdum adipiscing quis quis justo. Donec arcu nunc, fringilla eu dictum at, venenatis ac sem. Vestibulum quis elit urna, ac mattis sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
LOREM
get :index, :project_id => project.identifier
get :index, project_id: project.identifier
end
it "should render the index-template successfully" do
expect(response).to be_success
expect(response).to render_template("index")
end
it "should group documents by category, if no other sorting is given " do
expect(assigns(:grouped)).not_to be_nil
expect(assigns(:grouped)).not_to be_nil
expect(assigns(:grouped).keys.map(&:name)).to eql [default_category.name]
end
@ -79,7 +79,6 @@ LOREM
expect(response.body).to have_css('.wiki p')
expect(response.body).to have_css('.wiki p', text: (document.description.split("\n").first + '...'))
expect(response.body).to have_css('.wiki p', text: /EndOfLineHere.../)
end
end
@ -87,20 +86,25 @@ LOREM
describe "create" do
let(:document_attributes) { FactoryGirl.attributes_for(:document, title: "New Document", project_id: project.id, category_id: default_category.id) }
let(:document_attributes) {
FactoryGirl.attributes_for(:document, title: "New Document",
project_id: project.id,
category_id: default_category.id)
}
before :each do
before do
ActionMailer::Base.deliveries.clear
allow(Setting).to receive(:notified_events).and_return(Setting.notified_events.dup << 'document_added')
end
it "should create a new document with valid arguments" do
expect do
post :create, :project_id => project.identifier,
:document => FactoryGirl.attributes_for(:document, title: "New Document", project_id: project.id, category_id: default_category.id)
#:attachments => {'1' => FactoryGirl.attributes_for(:attachment, :author => admin)}
post :create, project_id: project.identifier,
document: FactoryGirl.attributes_for(:document, title: "New Document",
project_id: project.id,
category_id: default_category.id
)
end.to change{Document.count}.by 1
end
@ -108,22 +112,24 @@ LOREM
it "should create a new document with valid arguments" do
expect do
post :create,
:project_id => project.identifier,
:document => document_attributes
project_id: project.identifier,
document: document_attributes
end.to change{Document.count}.by 1
end
describe "with attachments" do
before :each do
before do
notify_project = project
notify_member = FactoryGirl.create(:member, :project => notify_project, :user => user, :roles => [role])
FactoryGirl.create(:member, project: notify_project, user: user, roles: [role])
post :create,
:project_id => notify_project.identifier,
:document => FactoryGirl.attributes_for(:document, title: "New Document", project_id: notify_project.id, category_id: default_category.id),
:attachments => {'1' => {description: "sample file", file: file_attachment}}
project_id: notify_project.identifier,
document: FactoryGirl.attributes_for(:document, title: "New Document",
project_id: notify_project.id,
category_id: default_category.id
),
attachments: { '1' => { description: "sample file", file: file_attachment } }
end
it "should add an attachment" do
@ -140,28 +146,24 @@ LOREM
end
it "should send out mails with notifications to members of the project with :view_documents-permission" do
document = Document.last
expect(ActionMailer::Base.deliveries.size).to eql 1
end
end
end
describe "destroy" do
let(:document) { FactoryGirl.create(:document, title: "Sample Document", project: project, category: default_category) }
let(:document) {
FactoryGirl.create(:document, title: "Sample Document", project: project, category: default_category)
}
before :each do
before do
document
end
it "should delete the document and redirect back to documents-page of the project" do
expect{
delete :destroy, :id => document.id
delete :destroy, id: document.id
}.to change{Document.count}.by -1
expect(response).to redirect_to "/projects/#{project.identifier}/documents"
@ -169,16 +171,8 @@ LOREM
end
end
def file_attachment
test_document = "#{OpenProject::Documents::Engine.root}/spec/assets/attachments/testfile.txt"
Rack::Test::UploadedFile.new(test_document, "text/plain")
end
end

@ -32,7 +32,7 @@
FactoryGirl.define do
factory :document do
project
category :factory => :document_category
category factory: :document_category
sequence(:description) { |n| "I am a document's description No. #{n}" }
sequence(:title) { |n| "I am the document No. #{n}" }
end

@ -35,7 +35,7 @@ describe "Journalized Objects" do
before(:each) do
@type ||= FactoryGirl.create(:type_feature)
@project ||= FactoryGirl.create(:project_with_types)
@current = FactoryGirl.create(:user, :login => "user1", :mail => "user1@users.com")
@current = FactoryGirl.create(:user, login: "user1", mail: "user1@users.com")
allow(User).to receive(:current).and_return @current
end

@ -32,11 +32,14 @@ require File.dirname(__FILE__) + '/../spec_helper'
describe DocumentsMailer do
let(:user) { FactoryGirl.create(:user, firstname: 'Test', lastname: "User", :mail => 'test@test.com') }
let(:project) { FactoryGirl.create(:project, name: "TestProject")}
let(:document) { FactoryGirl.create(:document, project: project, description: "Test Description", title: "Test Title" )}
let(:mail) { DocumentsMailer.document_added(user, document) }
let(:user) {
FactoryGirl.create(:user, firstname: 'Test', lastname: "User", mail: 'test@test.com')
}
let(:project) { FactoryGirl.create(:project, name: "TestProject") }
let(:document) {
FactoryGirl.create(:document, project: project, description: "Test Description", title: "Test Title" )
}
let(:mail) { DocumentsMailer.document_added(user, document) }
describe "document added-mail" do
it "renders the subject" do

@ -40,10 +40,10 @@ describe DocumentCategory do
end
it "should order documents by the category they are created with" do
uncategorized = FactoryGirl.create :document_category, :name => "Uncategorized", :project => project
user_documentation = FactoryGirl.create :document_category, :name => "User documentation"
uncategorized = FactoryGirl.create :document_category, name: "Uncategorized", project: project
user_documentation = FactoryGirl.create :document_category, name: "User documentation"
FactoryGirl.create_list :document, 2, :category => uncategorized, :project => project
FactoryGirl.create_list :document, 2, category: uncategorized, project: project
expect(DocumentCategory.find_by_name(uncategorized.name).objects_count).to eql 2
expect(DocumentCategory.find_by_name(user_documentation.name).objects_count).to eql 0
@ -51,14 +51,14 @@ describe DocumentCategory do
end
it "should file the categorizations under the option name :enumeration_doc_categories" do
expect(DocumentCategory.new.option_name).to eql :enumeration_doc_categories
expect(DocumentCategory.new.option_name).to eql :enumeration_doc_categories
end
it "should only allow one category to be the default-category" do
old_default = FactoryGirl.create :document_category, :name => "old default", :project => project, :is_default => true
old_default = FactoryGirl.create :document_category, name: "old default", project: project, is_default: true
expect{
new_default = FactoryGirl.create :document_category, :name => "new default", :project => project, :is_default => true
FactoryGirl.create :document_category, name: "new default", project: project, is_default: true
old_default.reload
}.to change{old_default.is_default?}.from(true).to(false)
@ -66,6 +66,3 @@ describe DocumentCategory do
end
end

@ -33,7 +33,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
describe DocumentObserver do
let(:user) { FactoryGirl.create(:user, firstname: 'Test', lastname: "User", :mail => 'test@test.com') }
let(:user) { FactoryGirl.create(:user, firstname: 'Test', lastname: "User", mail: 'test@test.com') }
let(:project) { FactoryGirl.create(:project, name: "TestProject")}
let(:mail) do

@ -33,7 +33,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
describe Document do
let(:documentation_category) { FactoryGirl.create :document_category, :name => 'User documentation'}
let(:documentation_category) { FactoryGirl.create :document_category, name: 'User documentation'}
let(:project) { FactoryGirl.create :project}
let(:user) { FactoryGirl.create(:user)}
let(:admin) { FactoryGirl.create(:admin)}
@ -76,7 +76,7 @@ describe Document do
end
it "should set a default-category, if none is given" do
default_category = FactoryGirl.create :document_category, :name => 'Technical documentation', :is_default => true
default_category = FactoryGirl.create :document_category, name: 'Technical documentation', is_default: true
document = Document.new(project: project, title: "New Document")
expect(document.category).to eql default_category
expect{
@ -102,9 +102,11 @@ describe Document do
end
describe "acts as event" do
let(:now) { Time.now }
let(:document) { FactoryGirl.build(:document,
created_on: now) }
let(:now) { Time.zone.now }
let(:document) {
FactoryGirl.build(:document,
created_on: now)
}
it { expect(document.event_datetime).to eq(now) }
end

@ -33,32 +33,46 @@ require 'spec_helper'
describe DocumentsController do
describe "routing" do
it { expect(get('/projects/567/documents')).to route_to(:controller => 'documents',
:action => 'index',
:project_id => '567' ) }
it {
expect(get('/projects/567/documents')).to route_to(controller: 'documents',
action: 'index',
project_id: '567' )
}
it { expect(get('/projects/567/documents/new')).to route_to(:controller => 'documents',
:action => 'new',
:project_id => '567' ) }
it {
expect(get('/projects/567/documents/new')).to route_to(controller: 'documents',
action: 'new',
project_id: '567' )
}
it { expect(get('/documents/22')).to route_to(:controller => 'documents',
:action => 'show',
:id => '22') }
it {
expect(get('/documents/22')).to route_to(controller: 'documents',
action: 'show',
id: '22')
}
it { expect(get('/documents/22/edit')).to route_to(:controller => 'documents',
:action => 'edit',
:id => '22') }
it {
expect(get('/documents/22/edit')).to route_to(controller: 'documents',
action: 'edit',
id: '22')
}
it { expect(post('/projects/567/documents')).to route_to(:controller => 'documents',
:action => 'create',
:project_id => '567') }
it {
expect(post('/projects/567/documents')).to route_to(controller: 'documents',
action: 'create',
project_id: '567')
}
it { expect(put('/documents/567')).to route_to(:controller => 'documents',
:action => 'update',
:id => '567') }
it {
expect(put('/documents/567')).to route_to(controller: 'documents',
action: 'update',
id: '567')
}
it { expect(delete('/documents/567')).to route_to(:controller => 'documents',
:action => 'destroy',
:id => '567') }
it {
expect(delete('/documents/567')).to route_to(controller: 'documents',
action: 'destroy',
id: '567')
}
end
end

Loading…
Cancel
Save