Skip to content

Commit 446e60b

Browse files
committed
added theater model
1 parent 193b3d7 commit 446e60b

File tree

10 files changed

+148
-25
lines changed

10 files changed

+148
-25
lines changed

wetube-frontend/.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--color

wetube-frontend/Gemfile

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
11
source 'https://rubygems.org'
22

33
gem 'rails', '3.2.13'
4+
gem 'jquery-rails'
5+
gem 'wetube'
6+
gem 'hashie'
7+
gem 'rest-client'
48

5-
# Bundle edge Rails instead:
6-
# gem 'rails', :git => 'git://github.com/rails/rails.git'
7-
8-
gem 'sqlite3'
9-
9+
group :test, :development do
10+
gem 'sqlite3'
11+
end
1012

11-
# Gems used only for assets and not required
12-
# in production environments by default.
1313
group :assets do
1414
gem 'sass-rails', '~> 3.2.3'
1515
gem 'coffee-rails', '~> 3.2.1'
1616

17-
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
18-
# gem 'therubyracer', :platforms => :ruby
19-
2017
gem 'uglifier', '>= 1.0.3'
2118
end
2219

23-
gem 'jquery-rails'
24-
25-
# To use ActiveModel has_secure_password
26-
# gem 'bcrypt-ruby', '~> 3.0.0'
27-
28-
# To use Jbuilder templates for JSON
29-
# gem 'jbuilder'
20+
group :test do
21+
gem 'rspec-rails'
22+
gem 'simplecov'
23+
gem 'vcr'
24+
end
3025

31-
# Use unicorn as the app server
32-
# gem 'unicorn'
3326

34-
# Deploy with Capistrano
35-
# gem 'capistrano'
3627

37-
# To use debugger
38-
# gem 'debugger'

wetube-frontend/Gemfile.lock

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ GEM
3737
coffee-script-source
3838
execjs
3939
coffee-script-source (1.6.2)
40+
diff-lcs (1.2.4)
4041
erubis (2.7.0)
4142
execjs (1.4.0)
4243
multi_json (~> 1.0)
44+
hashie (2.0.5)
4345
hike (1.2.3)
4446
i18n (0.6.1)
4547
journey (1.0.4)
@@ -78,11 +80,28 @@ GEM
7880
rake (10.0.4)
7981
rdoc (3.12.2)
8082
json (~> 1.4)
83+
rest-client (1.6.7)
84+
mime-types (>= 1.16)
85+
rspec-core (2.13.1)
86+
rspec-expectations (2.13.0)
87+
diff-lcs (>= 1.1.3, < 2.0)
88+
rspec-mocks (2.13.1)
89+
rspec-rails (2.13.2)
90+
actionpack (>= 3.0)
91+
activesupport (>= 3.0)
92+
railties (>= 3.0)
93+
rspec-core (~> 2.13.0)
94+
rspec-expectations (~> 2.13.0)
95+
rspec-mocks (~> 2.13.0)
8196
sass (3.2.9)
8297
sass-rails (3.2.6)
8398
railties (~> 3.2.0)
8499
sass (>= 3.1.10)
85100
tilt (~> 1.3)
101+
simplecov (0.7.1)
102+
multi_json (~> 1.0)
103+
simplecov-html (~> 0.7.1)
104+
simplecov-html (0.7.1)
86105
sprockets (2.2.2)
87106
hike (~> 1.2)
88107
multi_json (~> 1.0)
@@ -98,14 +117,22 @@ GEM
98117
uglifier (2.1.1)
99118
execjs (>= 0.3.0)
100119
multi_json (~> 1.0, >= 1.0.2)
120+
vcr (2.5.0)
121+
wetube (0.0.1)
101122

102123
PLATFORMS
103124
ruby
104125

105126
DEPENDENCIES
106127
coffee-rails (~> 3.2.1)
128+
hashie
107129
jquery-rails
108130
rails (= 3.2.13)
131+
rest-client
132+
rspec-rails
109133
sass-rails (~> 3.2.3)
134+
simplecov
110135
sqlite3
111136
uglifier (>= 1.0.3)
137+
vcr
138+
wetube

wetube-frontend/app/assets/javascripts/theatre.js renamed to wetube-frontend/app/assets/javascripts/theater.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ $(function() {
2727
var value = options.value
2828
console.log(value);
2929

30-
s
31-
3230
jQuery.each(data,function(index, element) {
3331
var source = template.html();
3432
var feedItemTemplate = Handlebars.compile(source);

wetube-frontend/app/models/theater.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Theater < ActiveRecord::Base
2+
attr_accessible :name, :genre
3+
4+
before_create :initialize_theater
5+
6+
7+
def initialize_theater
8+
conversation_id, playlist_id = Wetube::Theater.create
9+
self.conversation_id = conversation_id
10+
self.playlist_id = playlist_id
11+
end
12+
13+
end

wetube-frontend/config/application.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,12 @@ class Application < Rails::Application
5858

5959
# Version of your assets, change this if you want to expire all your assets
6060
config.assets.version = '1.0'
61+
62+
#rspec
63+
config.generators do |g|
64+
g.test_framework :rspec, :fixture => false
65+
g.view_specs false
66+
g.helper_specs false
67+
end
6168
end
6269
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class CreateTheaters < ActiveRecord::Migration
2+
def change
3+
create_table :theaters do |t|
4+
t.integer :conversation_id
5+
t.integer :playlist_id
6+
t.string :name
7+
t.string :genre
8+
t.boolean :private, :default => false
9+
10+
t.timestamps
11+
end
12+
end
13+
end

wetube-frontend/db/schema.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# encoding: UTF-8
2+
# This file is auto-generated from the current state of the database. Instead
3+
# of editing this file, please use the migrations feature of Active Record to
4+
# incrementally modify your database, and then regenerate this schema definition.
5+
#
6+
# Note that this schema.rb definition is the authoritative source for your
7+
# database schema. If you need to create the application database on another
8+
# system, you should be using db:schema:load, not running all the migrations
9+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
10+
# you'll amass, the slower it'll run and the greater likelihood for issues).
11+
#
12+
# It's strongly recommended to check this file into your version control system.
13+
14+
ActiveRecord::Schema.define(:version => 20130615202651) do
15+
16+
create_table "theaters", :force => true do |t|
17+
t.integer "conversation_id"
18+
t.integer "playlist_id"
19+
t.string "name"
20+
t.string "genre"
21+
t.boolean "private", :default => false
22+
t.datetime "created_at", :null => false
23+
t.datetime "updated_at", :null => false
24+
end
25+
26+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require 'spec_helper'
2+
3+
describe Theater do
4+
it "is a valid theater" do
5+
theater = Theater.new(
6+
:name => 'james blakeness',
7+
:genre => 'music videos')
8+
theater.save
9+
expect(theatre).to be_valid
10+
end
11+
end

wetube-frontend/spec/spec_helper.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This file is copied to spec/ when you run 'rails generate rspec:install'
2+
ENV["RAILS_ENV"] ||= 'test'
3+
require File.expand_path("../../config/environment", __FILE__)
4+
require 'rspec/rails'
5+
require 'rspec/autorun'
6+
7+
# Requires supporting ruby files with custom matchers and macros, etc,
8+
# in spec/support/ and its subdirectories.
9+
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
10+
11+
RSpec.configure do |config|
12+
# ## Mock Framework
13+
#
14+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
15+
#
16+
# config.mock_with :mocha
17+
# config.mock_with :flexmock
18+
# config.mock_with :rr
19+
20+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
22+
23+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
24+
# examples within a transaction, remove the following line or assign false
25+
# instead of true.
26+
config.use_transactional_fixtures = true
27+
28+
# If true, the base class of anonymous controllers will be inferred
29+
# automatically. This will be the default behavior in future versions of
30+
# rspec-rails.
31+
config.infer_base_class_for_anonymous_controllers = false
32+
33+
# Run specs in random order to surface order dependencies. If you find an
34+
# order dependency and want to debug it, you can fix the order by providing
35+
# the seed, which is printed after each run.
36+
# --seed 1234
37+
config.order = "random"
38+
end

0 commit comments

Comments
 (0)