Packages controller added

This commit is contained in:
Christoph Haas 2013-07-27 01:23:28 +02:00
parent f28c637d10
commit c2a695aec0
15 changed files with 110 additions and 1 deletions

View file

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View file

@ -0,0 +1,3 @@
// Place all the styles related to the packages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View file

@ -0,0 +1,14 @@
class PackagesController < ApplicationController
def index
@packages = Package.order('name').first(20)
end
def with_screenshots
end
def without_screenshots
end
def moderate
end
end

View file

@ -0,0 +1,2 @@
module PackagesHelper
end

2
app/models/package.rb Normal file
View file

@ -0,0 +1,2 @@
class Package < ActiveRecord::Base
end

View file

@ -0,0 +1,10 @@
<h1>Packages#index</h1>
<p>Find me in app/views/packages/index.html.erb</p>
<ul>
<% @packages.each do |package| %>
<li>
<%= package.name %> <i>(<%= package.description %>)</i>
</li>
<% end %>
</ul>

View file

@ -0,0 +1,2 @@
<h1>Packages#moderate</h1>
<p>Find me in app/views/packages/moderate.html.erb</p>

View file

@ -0,0 +1,2 @@
<h1>Packages#with_screenshots</h1>
<p>Find me in app/views/packages/with_screenshots.html.erb</p>

View file

@ -0,0 +1,2 @@
<h1>Packages#without_screenshots</h1>
<p>Find me in app/views/packages/without_screenshots.html.erb</p>

View file

@ -1,9 +1,16 @@
Debshots::Application.routes.draw do Debshots::Application.routes.draw do
#get "packages/index"
get "packages" => "packages#index"
get "packages/with_screenshots"
get "packages/without_screenshots"
get "packages/moderate"
get "welcome/index"
# The priority is based upon order of creation: first created -> highest priority. # The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes". # See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root" # You can have the root of your site routed with "root"
# root 'welcome#index' # root 'welcome#index'
root to: "welcome#index"
# Example of regular route: # Example of regular route:
# get 'products/:id' => 'catalog#view' # get 'products/:id' => 'catalog#view'
@ -39,7 +46,7 @@ Debshots::Application.routes.draw do
# get 'recent', on: :collection # get 'recent', on: :collection
# end # end
# end # end
# Example resource route with concerns: # Example resource route with concerns:
# concern :toggleable do # concern :toggleable do
# post 'toggle' # post 'toggle'

View file

@ -0,0 +1,24 @@
require 'test_helper'
class PackagesControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
end
test "should get with_screenshots" do
get :with_screenshots
assert_response :success
end
test "should get without_screenshots" do
get :without_screenshots
assert_response :success
end
test "should get moderate" do
get :moderate
assert_response :success
end
end

23
test/fixtures/packages.yml vendored Normal file
View file

@ -0,0 +1,23 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
name: MyText
description: MyString
long_description: MyString
section: MyString
maintainer: MyString
maintainer_email: MyString
homepage: MyString
version: MyString
origin: MyString
two:
name: MyText
description: MyString
long_description: MyString
section: MyString
maintainer: MyString
maintainer_email: MyString
homepage: MyString
version: MyString
origin: MyString

View file

@ -0,0 +1,4 @@
require 'test_helper'
class PackagesHelperTest < ActionView::TestCase
end

View file

@ -0,0 +1,4 @@
require 'test_helper'
class WelcomeHelperTest < ActionView::TestCase
end

View file

@ -0,0 +1,7 @@
require 'test_helper'
class PackageTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end