Commit d42c029
Changed files (8)
app
admin
controllers
models
views
resources
spec
controllers
models
app/admin/links.rb
@@ -0,0 +1,3 @@
+ActiveAdmin.register Link do
+
+end
app/admin/resources.rb
@@ -1,3 +0,0 @@
-ActiveAdmin.register Resource do
-
-end
app/controllers/resources_controller.rb
@@ -1,5 +0,0 @@
-class ResourcesController < ApplicationController
- def index
- @resources = Resource.all
- end
-end
app/models/resource.rb
@@ -1,3 +0,0 @@
-class Resource < ActiveRecord::Base
- attr_accessible :title, :link, :description
-end
\ No newline at end of file
app/views/resources/index.html.erb
@@ -1,21 +0,0 @@
-<div class="row resources">
- <div class="span12">
- <h1>Resources</h1>
- <table class="table">
- <thead>
- <tr>
- <th>Name</th>
- <th>Status</th>
- </tr>
- </thead>
- <tbody>
- <% @resources.each do |resource| %>
- <tr>
- <td><%= link_to resource.title, resource.link %></td>
- <td><%= resource.description %></td>
- </tr>
- <% end %>
- </tbody>
- </table>
- </div>
-</div>
spec/controllers/links_controller_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe LinksController do
+ describe :index do
+ it "should load each resource" do
+ link = Link.create!(title: 'Facebook', url: "http://www.facebook.com", description: "Everyone posts stuff on FB")
+ get :index
+ assigns(:links).should include(link)
+ end
+ end
+end
spec/controllers/resources_controller_spec.rb
@@ -1,11 +0,0 @@
-require 'spec_helper'
-
-describe ResourcesController do
- describe :index do
- it "should load each resource" do
- resource = Resource.create!(title: 'Facebook', link: "http://www.facebook.com", description: "Everyone posts stuff on FB")
- get :index
- assigns(:resources).should include(resource)
- end
- end
-end
spec/models/resource_spec.rb → spec/models/link_spec.rb
@@ -1,10 +1,11 @@
require 'spec_helper'
-describe Resource do
+describe Link do
describe :attributes do
- subject { Resource.new }
+ subject { Link.new }
+ it { should respond_to :url }
it { should respond_to :title }
- it { should respond_to :link }
it { should respond_to :description }
+ it { should respond_to :thumbnail_url }
end
end