Skip to content

Commit

Permalink
Controller specs items_spec_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
anupnivargi committed Jan 5, 2010
1 parent e58992d commit 85d862c
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/controllers/admin/audios_controller.rb
Expand Up @@ -19,7 +19,7 @@ class Admin::AudiosController < Admin::ApplicationController
#
# This function is linked to an url and called by an AJAX request.
def get_audio_progress
@current_object=Audio.find(params[:id])
@current_object = Audio.find(params[:id])
if params[:check] && params[:check] == 'true'
render :text => @current_object.state
elsif params[:status]
Expand All @@ -37,4 +37,4 @@ def download
@audio = Audio.find(params[:id])
send_file(RAILS_ROOT+"/public"+@audio.audio.url.split("?")[0], :disposition => 'inline', :stream => false)
end
end
end
30 changes: 30 additions & 0 deletions spec/controllers/audios_controller_spec.rb
@@ -0,0 +1,30 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
#require File.expand_path(File.dirname(__FILE__) + '/../controllers/items_controller_spec_helper')
describe Admin::AudiosController do
#include ItemsControllerSpecHelper
controller_name 'admin/audios'
def object
Audio
end

def valid_params
{
"associated_workspaces"=>["1"],
"title"=>"hello",
"description"=>"world",
"audio" => url_to_attachment_file('audio.mp3'),
"keywords_field"=>[]
}
end

def invalid_params
{
"associated_workspaces"=>["1"],
"audio" => url_to_attachment_file('empty_file.txt'),
"description"=>"world",
"title"=>"hello",
"keywords_field"=>[]
}
end

end
2 changes: 0 additions & 2 deletions spec/controllers/images_controller_spec.rb
@@ -1,7 +1,5 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../controllers/items_controller_spec_helper')
#require "#{RAILS_ROOT}/vendor/engines/acts_as_container/lib/url_helpers"
#require "#{RAILS_ROOT}/vendor/engines/acts_as_item/lib/url_helpers"
describe Admin::ImagesController do
controller_name 'admin/images'
include ItemsControllerSpecHelper
Expand Down
31 changes: 31 additions & 0 deletions spec/controllers/videos_controller_spec.rb
@@ -0,0 +1,31 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
#require File.expand_path(File.dirname(__FILE__) + '/../controllers/items_controller_spec_helper')
describe Admin::VideosController do
controller_name 'admin/videos'
#include ItemsControllerSpecHelper

def object
Video
end

def valid_params
{
"associated_workspaces"=>["1"],
"title"=>"hello",
"description"=>"world",
"video" => url_to_attachment_file('video.flv'),
"keywords_field"=>[]
}
end

def invalid_params
{
"associated_workspaces"=>["1"],
"video" => url_to_attachment_file('empty_file.txt'),
"description"=>"world",
"title"=>"hello",
"keywords_field"=>[]
}
end

end
2 changes: 1 addition & 1 deletion spec/models/folder_spec.rb
Expand Up @@ -4,7 +4,7 @@

describe Folder do
fixtures :folders, :items_folders
#include AuthorizableSpecHelper
include AuthorizableSpecHelper
include ContainersSpecHelper

def container
Expand Down
4 changes: 2 additions & 2 deletions spec/models/user_spec.rb
Expand Up @@ -45,8 +45,8 @@
require File.expand_path(File.dirname(__FILE__) + '/authorizable_spec_helper')

describe User do
#include AuthorizedSpecHelper
#include AuthorizableSpecHelper
include AuthorizedSpecHelper
include AuthorizableSpecHelper
fixtures :roles, :permissions,:permissions_roles, :users, :workspaces, :users_containers, :items_workspaces

def object
Expand Down
2 changes: 1 addition & 1 deletion spec/models/website_spec.rb
Expand Up @@ -4,7 +4,7 @@

describe Website do
fixtures :websites, :items_websites
#include AuthorizableSpecHelper
include AuthorizableSpecHelper
include ContainersSpecHelper

def container
Expand Down
2 changes: 1 addition & 1 deletion spec/models/workspace_spec.rb
Expand Up @@ -24,7 +24,7 @@

describe Workspace do
fixtures :workspaces, :items_workspaces
#include AuthorizableSpecHelper
include AuthorizableSpecHelper
include ContainersSpecHelper

def container
Expand Down

0 comments on commit 85d862c

Please sign in to comment.