# gem 'unicorn'
# Use Capistrano for deployment
-# gem 'capistrano', group: :development
+gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
+
+group :development, :test do
+ gem "rspec-rails"
+end
+
+group :test do
+ gem "factory_girl_rails"
+ gem "cucumber-rails", :require => false
+ gem "capybara"
+ gem "database_cleaner"
+ gem "launchy"
+end
\ No newline at end of file
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
+ addressable (2.3.5)
arel (4.0.1)
atomic (1.1.14)
builder (3.1.4)
+ capistrano (3.0.1)
+ i18n
+ rake (>= 10.0.0)
+ sshkit (>= 0.0.23)
+ capybara (2.2.0)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ xpath (~> 2.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
+ cucumber (1.3.10)
+ builder (>= 2.1.2)
+ diff-lcs (>= 1.1.3)
+ gherkin (~> 2.12)
+ multi_json (>= 1.7.5, < 2.0)
+ multi_test (>= 0.0.2)
+ cucumber-rails (1.4.0)
+ capybara (>= 1.1.2)
+ cucumber (>= 1.2.0)
+ nokogiri (>= 1.5.0)
+ rails (>= 3.0.0)
+ database_cleaner (1.2.0)
+ diff-lcs (1.2.5)
erubis (2.7.0)
execjs (2.0.2)
+ factory_girl (4.3.0)
+ activesupport (>= 3.0.0)
+ factory_girl_rails (4.3.0)
+ factory_girl (~> 4.3.0)
+ railties (>= 3.0.0)
+ gherkin (2.12.2)
+ multi_json (~> 1.3)
hike (1.2.3)
i18n (0.6.9)
jbuilder (1.5.3)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
+ launchy (2.4.2)
+ addressable (~> 2.3)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
+ mini_portile (0.5.2)
minitest (4.7.5)
multi_json (1.8.2)
+ multi_test (0.0.3)
+ net-scp (1.1.2)
+ net-ssh (>= 2.6.5)
+ net-ssh (2.7.0)
+ nokogiri (1.6.1)
+ mini_portile (~> 0.5.0)
pg (0.17.1)
polyglot (0.3.3)
rack (1.5.2)
rake (10.1.1)
rdoc (3.12.2)
json (~> 1.4)
+ rspec-core (2.14.7)
+ rspec-expectations (2.14.4)
+ diff-lcs (>= 1.1.3, < 2.0)
+ rspec-mocks (2.14.4)
+ rspec-rails (2.14.1)
+ actionpack (>= 3.0)
+ activemodel (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec-core (~> 2.14.0)
+ rspec-expectations (~> 2.14.0)
+ rspec-mocks (~> 2.14.0)
sass (3.2.13)
sass-rails (4.0.1)
railties (>= 4.0.0, < 5.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
+ sshkit (1.3.0)
+ net-scp (>= 1.1.2)
+ net-ssh
+ term-ansicolor
+ term-ansicolor (1.2.2)
+ tins (~> 0.8)
thor (0.18.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
+ tins (0.13.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
uglifier (2.4.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
+ xpath (2.0.0)
+ nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
+ capistrano
+ capybara
coffee-rails (~> 4.0.0)
+ cucumber-rails
+ database_cleaner
+ factory_girl_rails
jbuilder (~> 1.2)
jquery-rails
+ launchy
pg
rails (= 4.0.2)
+ rspec-rails
sass-rails (~> 4.0.0)
sdoc
turbolinks
--- /dev/null
+class FeedItem < ActiveRecord::Base
+ validates_presence_of :feed_name, :title, :description
+ validates_uniqueness_of :title, :scope => :feed_name
+ validate :feed_name_must_be_legal
+
+ def FeedItem.valid_feed_name?(feed_name)
+ Rack::Utils::escape(feed_name) == feed_name and
+ Rack::Utils::unescape(feed_name) == feed_name and
+ feed_name != 'index' and
+ feed_name != 'show' and
+ feed_name != 'update' and
+ feed_name != 'action'
+ end
+
+ private
+
+ def feed_name_must_be_legal
+ unless FeedItem.valid_feed_name?(feed_name)
+ errors.add(:feed_name, 'is invalid')
+ end
+ end
+end
--- /dev/null
+class CreateFeedItems < ActiveRecord::Migration
+ def change
+ create_table :feed_items do |t|
+ t.string :feed_name
+ t.string :title
+ t.string :description
+
+ t.timestamps
+ end
+ add_index :feed_items, :feed_name
+ end
+end
--- /dev/null
+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended that you check this file into your version control system.
+
+ActiveRecord::Schema.define(version: 20140104143920) do
+
+ # These are extensions that must be enabled in order to support this database
+ enable_extension "plpgsql"
+
+ create_table "feed_items", force: true do |t|
+ t.string "feed_name"
+ t.string "title"
+ t.string "description"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "feed_items", ["feed_name"], name: "index_feed_items_on_feed_name", using: :btree
+
+end
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
+
+FeedItem.delete_all
+(1..20).each do |item_number|
+ ('a'..'j').each do |feed_name|
+ FeedItem.create(:feed_name => "feed-#{feed_name}",
+ :title => "feed-#{feed_name}-item-" + sprintf("%02d", item_number),
+ :description => "Feed #{feed_name}, Item #{item_number} has a description")
+ end
+end
\ No newline at end of file
--- /dev/null
+require 'spec_helper'
+
+describe FeedItem do
+ pending "add some examples to (or delete) #{__FILE__}"
+end