dailycred 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +7 -1
- data/dailycred.gemspec +2 -2
- data/dummy/.gitignore +3 -2
- data/dummy/Gemfile +14 -29
- data/dummy/README.rdoc +15 -248
- data/dummy/Rakefile +0 -1
- data/dummy/app/assets/javascripts/application.js +2 -1
- data/dummy/app/controllers/application_controller.rb +3 -14
- data/dummy/app/views/layouts/application.html.erb +2 -6
- data/dummy/bin/bundle +3 -0
- data/dummy/bin/rails +4 -0
- data/dummy/bin/rake +4 -0
- data/dummy/config/application.rb +2 -42
- data/dummy/config/boot.rb +0 -2
- data/dummy/config/environment.rb +2 -2
- data/dummy/config/environments/development.rb +9 -19
- data/dummy/config/environments/production.rb +40 -27
- data/dummy/config/environments/test.rb +12 -13
- data/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/dummy/config/initializers/inflections.rb +6 -5
- data/dummy/config/initializers/omniauth.rb +8 -4
- data/dummy/config/initializers/secret_token.rb +6 -1
- data/dummy/config/initializers/session_store.rb +1 -6
- data/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/dummy/config/locales/en.yml +20 -2
- data/dummy/config/routes.rb +15 -26
- data/dummy/db/migrate/{20121218124721_create_users.rb → 20130417131939_create_users.rb} +2 -2
- data/dummy/db/schema.rb +8 -20
- data/dummy/public/404.html +2 -1
- data/dummy/public/422.html +1 -1
- data/dummy/public/500.html +2 -1
- data/dummy/public/robots.txt +1 -1
- data/dummy/test/models/.keep +0 -0
- data/dummy/test/test_helper.rb +11 -58
- data/dummy/vendor/assets/javascripts/.keep +0 -0
- data/dummy/vendor/assets/stylesheets/.keep +0 -0
- data/lib/dailycred/client.rb +1 -0
- data/lib/dailycred/version.rb +1 -1
- data/lib/dailycred.rb +0 -1
- data/spec/helper_spec.rb +0 -2
- metadata +24 -44
- data/dummy/Guardfile +0 -31
- data/dummy/app/assets/javascripts/posts.js.coffee +0 -3
- data/dummy/app/assets/stylesheets/posts.css.scss +0 -3
- data/dummy/app/assets/stylesheets/scaffolds.css.scss +0 -69
- data/dummy/app/controllers/posts_controller.rb +0 -86
- data/dummy/app/helpers/posts_helper.rb +0 -2
- data/dummy/app/models/post.rb +0 -3
- data/dummy/app/views/posts/_form.html.erb +0 -21
- data/dummy/app/views/posts/edit.html.erb +0 -6
- data/dummy/app/views/posts/index.html.erb +0 -23
- data/dummy/app/views/posts/new.html.erb +0 -5
- data/dummy/app/views/posts/show.html.erb +0 -10
- data/dummy/db/migrate/20120926012555_create_posts.rb +0 -9
- data/dummy/db/migrate/20121002192037_update_users_2.rb +0 -70
- data/dummy/db/migrate/20121108192739_add_column_to_posts.rb +0 -5
- data/dummy/db/migrate/20121218205329_change_created_column.rb +0 -5
- data/dummy/script/rails +0 -6
- data/dummy/test/fixtures/posts.yml +0 -7
- data/dummy/test/fixtures/users.yml +0 -3
- data/dummy/test/functional/posts_controller_test.rb +0 -51
- data/dummy/test/performance/browsing_test.rb +0 -12
- data/dummy/test/unit/helpers/posts_helper_test.rb +0 -4
- data/dummy/test/unit/post_test.rb +0 -7
- data/dummy/test/unit/user_test.rb +0 -77
- data/lib/omniauth/strategies/dailycred.rb +0 -81
- data/spec/omniauth/strategies/dailycred_spec.rb +0 -70
- /data/dummy/app/{mailers/.gitkeep → controllers/concerns/.keep} +0 -0
- /data/dummy/app/{models/.gitkeep → mailers/.keep} +0 -0
- /data/dummy/{lib/assets/.gitkeep → app/models/.keep} +0 -0
- /data/dummy/{lib/tasks/.gitkeep → app/models/concerns/.keep} +0 -0
- /data/dummy/{log/.gitkeep → lib/assets/.keep} +0 -0
- /data/dummy/{test/fixtures/.gitkeep → lib/tasks/.keep} +0 -0
- /data/dummy/{test/functional/.gitkeep → log/.keep} +0 -0
- /data/dummy/test/{integration/.gitkeep → controllers/.keep} +0 -0
- /data/dummy/test/{unit/.gitkeep → fixtures/.keep} +0 -0
- /data/dummy/{vendor/assets/javascripts/.gitkeep → test/helpers/.keep} +0 -0
- /data/dummy/{vendor/assets/stylesheets/.gitkeep → test/integration/.keep} +0 -0
- /data/dummy/{vendor/plugins/.gitkeep → test/mailers/.keep} +0 -0
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dailycred
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hank Stoever
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: omniauth_dailycred
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ! '>='
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -75,29 +75,22 @@ files:
|
|
75
75
|
- docs/lib/user/user.html
|
76
76
|
- dummy/.gitignore
|
77
77
|
- dummy/Gemfile
|
78
|
-
- dummy/Guardfile
|
79
78
|
- dummy/README.rdoc
|
80
79
|
- dummy/Rakefile
|
81
80
|
- dummy/app/assets/images/rails.png
|
82
81
|
- dummy/app/assets/javascripts/application.js
|
83
|
-
- dummy/app/assets/javascripts/posts.js.coffee
|
84
82
|
- dummy/app/assets/stylesheets/application.css
|
85
|
-
- dummy/app/assets/stylesheets/posts.css.scss
|
86
|
-
- dummy/app/assets/stylesheets/scaffolds.css.scss
|
87
83
|
- dummy/app/controllers/application_controller.rb
|
88
|
-
- dummy/app/controllers/
|
84
|
+
- dummy/app/controllers/concerns/.keep
|
89
85
|
- dummy/app/helpers/application_helper.rb
|
90
|
-
- dummy/app/
|
91
|
-
- dummy/app/
|
92
|
-
- dummy/app/models/.
|
93
|
-
- dummy/app/models/post.rb
|
86
|
+
- dummy/app/mailers/.keep
|
87
|
+
- dummy/app/models/.keep
|
88
|
+
- dummy/app/models/concerns/.keep
|
94
89
|
- dummy/app/models/user.rb
|
95
90
|
- dummy/app/views/layouts/application.html.erb
|
96
|
-
- dummy/
|
97
|
-
- dummy/
|
98
|
-
- dummy/
|
99
|
-
- dummy/app/views/posts/new.html.erb
|
100
|
-
- dummy/app/views/posts/show.html.erb
|
91
|
+
- dummy/bin/bundle
|
92
|
+
- dummy/bin/rails
|
93
|
+
- dummy/bin/rake
|
101
94
|
- dummy/config.ru
|
102
95
|
- dummy/config/application.rb
|
103
96
|
- dummy/config/boot.rb
|
@@ -107,6 +100,7 @@ files:
|
|
107
100
|
- dummy/config/environments/production.rb
|
108
101
|
- dummy/config/environments/test.rb
|
109
102
|
- dummy/config/initializers/backtrace_silencers.rb
|
103
|
+
- dummy/config/initializers/filter_parameter_logging.rb
|
110
104
|
- dummy/config/initializers/inflections.rb
|
111
105
|
- dummy/config/initializers/mime_types.rb
|
112
106
|
- dummy/config/initializers/omniauth.rb
|
@@ -115,37 +109,26 @@ files:
|
|
115
109
|
- dummy/config/initializers/wrap_parameters.rb
|
116
110
|
- dummy/config/locales/en.yml
|
117
111
|
- dummy/config/routes.rb
|
118
|
-
- dummy/db/migrate/
|
119
|
-
- dummy/db/migrate/20121002192037_update_users_2.rb
|
120
|
-
- dummy/db/migrate/20121108192739_add_column_to_posts.rb
|
121
|
-
- dummy/db/migrate/20121218124721_create_users.rb
|
122
|
-
- dummy/db/migrate/20121218205329_change_created_column.rb
|
112
|
+
- dummy/db/migrate/20130417131939_create_users.rb
|
123
113
|
- dummy/db/schema.rb
|
124
114
|
- dummy/db/seeds.rb
|
125
|
-
- dummy/lib/assets/.
|
126
|
-
- dummy/lib/tasks/.
|
127
|
-
- dummy/log/.
|
115
|
+
- dummy/lib/assets/.keep
|
116
|
+
- dummy/lib/tasks/.keep
|
117
|
+
- dummy/log/.keep
|
128
118
|
- dummy/public/404.html
|
129
119
|
- dummy/public/422.html
|
130
120
|
- dummy/public/500.html
|
131
121
|
- dummy/public/favicon.ico
|
132
122
|
- dummy/public/robots.txt
|
133
|
-
- dummy/
|
134
|
-
- dummy/test/fixtures/.
|
135
|
-
- dummy/test/
|
136
|
-
- dummy/test/
|
137
|
-
- dummy/test/
|
138
|
-
- dummy/test/
|
139
|
-
- dummy/test/integration/.gitkeep
|
140
|
-
- dummy/test/performance/browsing_test.rb
|
123
|
+
- dummy/test/controllers/.keep
|
124
|
+
- dummy/test/fixtures/.keep
|
125
|
+
- dummy/test/helpers/.keep
|
126
|
+
- dummy/test/integration/.keep
|
127
|
+
- dummy/test/mailers/.keep
|
128
|
+
- dummy/test/models/.keep
|
141
129
|
- dummy/test/test_helper.rb
|
142
|
-
- dummy/
|
143
|
-
- dummy/
|
144
|
-
- dummy/test/unit/post_test.rb
|
145
|
-
- dummy/test/unit/user_test.rb
|
146
|
-
- dummy/vendor/assets/javascripts/.gitkeep
|
147
|
-
- dummy/vendor/assets/stylesheets/.gitkeep
|
148
|
-
- dummy/vendor/plugins/.gitkeep
|
130
|
+
- dummy/vendor/assets/javascripts/.keep
|
131
|
+
- dummy/vendor/assets/stylesheets/.keep
|
149
132
|
- lib/dailycred.rb
|
150
133
|
- lib/dailycred/acts_as_dailycred.rb
|
151
134
|
- lib/dailycred/client.rb
|
@@ -163,10 +146,8 @@ files:
|
|
163
146
|
- lib/generators/templates/omniauth.rb
|
164
147
|
- lib/generators/templates/sessions_controller.rb
|
165
148
|
- lib/generators/templates/user.rb
|
166
|
-
- lib/omniauth/strategies/dailycred.rb
|
167
149
|
- script/download_info.rb
|
168
150
|
- spec/helper_spec.rb
|
169
|
-
- spec/omniauth/strategies/dailycred_spec.rb
|
170
151
|
- spec/support/dailycred_spec.rb
|
171
152
|
- spec/support/shared_examples.rb
|
172
153
|
- test/generator_test.rb
|
@@ -196,7 +177,6 @@ specification_version: 4
|
|
196
177
|
summary: ''
|
197
178
|
test_files:
|
198
179
|
- spec/helper_spec.rb
|
199
|
-
- spec/omniauth/strategies/dailycred_spec.rb
|
200
180
|
- spec/support/dailycred_spec.rb
|
201
181
|
- spec/support/shared_examples.rb
|
202
182
|
- test/generator_test.rb
|
data/dummy/Guardfile
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
|
4
|
-
guard :test do
|
5
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
6
|
-
watch(%r{^test/.+_test\.rb$})
|
7
|
-
watch('test/test_helper.rb') { "test" }
|
8
|
-
watch(%r{/test\/unit\/(.+)_test.rb/})
|
9
|
-
watch('../lib/dailycred/acts_as_dailycred.rb') { "test/unit/user_test.rb"}
|
10
|
-
Dir[File.expand_path('../../lib/dailycred/*.rb', __FILE__)].each do |f|
|
11
|
-
watch(f) {"test/unit/user_test.rb"}
|
12
|
-
end
|
13
|
-
|
14
|
-
# Rails example
|
15
|
-
watch(%r{^app/models/(.+)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
|
16
|
-
watch(%r{^app/controllers/(.+)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
|
17
|
-
watch(%r{^app/views/.+\.rb$}) { "test/integration" }
|
18
|
-
watch('app/controllers/application_controller.rb') { ["test/functional", "test/integration"] }
|
19
|
-
end
|
20
|
-
|
21
|
-
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
|
22
|
-
watch('config/application.rb')
|
23
|
-
watch('config/environment.rb')
|
24
|
-
watch('config/environments/test.rb')
|
25
|
-
watch(%r{^config/initializers/.+\.rb$})
|
26
|
-
watch('Gemfile')
|
27
|
-
watch('Gemfile.lock')
|
28
|
-
watch('spec/spec_helper.rb') { :rspec }
|
29
|
-
watch('test/test_helper.rb') { :test_unit }
|
30
|
-
watch(%r{features/support/}) { :cucumber }
|
31
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
background-color: #fff;
|
3
|
-
color: #333;
|
4
|
-
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
-
font-size: 13px;
|
6
|
-
line-height: 18px;
|
7
|
-
}
|
8
|
-
|
9
|
-
p, ol, ul, td {
|
10
|
-
font-family: verdana, arial, helvetica, sans-serif;
|
11
|
-
font-size: 13px;
|
12
|
-
line-height: 18px;
|
13
|
-
}
|
14
|
-
|
15
|
-
pre {
|
16
|
-
background-color: #eee;
|
17
|
-
padding: 10px;
|
18
|
-
font-size: 11px;
|
19
|
-
}
|
20
|
-
|
21
|
-
a {
|
22
|
-
color: #000;
|
23
|
-
&:visited {
|
24
|
-
color: #666;
|
25
|
-
}
|
26
|
-
&:hover {
|
27
|
-
color: #fff;
|
28
|
-
background-color: #000;
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
div {
|
33
|
-
&.field, &.actions {
|
34
|
-
margin-bottom: 10px;
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
#notice {
|
39
|
-
color: green;
|
40
|
-
}
|
41
|
-
|
42
|
-
.field_with_errors {
|
43
|
-
padding: 2px;
|
44
|
-
background-color: red;
|
45
|
-
display: table;
|
46
|
-
}
|
47
|
-
|
48
|
-
#error_explanation {
|
49
|
-
width: 450px;
|
50
|
-
border: 2px solid red;
|
51
|
-
padding: 7px;
|
52
|
-
padding-bottom: 0;
|
53
|
-
margin-bottom: 20px;
|
54
|
-
background-color: #f0f0f0;
|
55
|
-
h2 {
|
56
|
-
text-align: left;
|
57
|
-
font-weight: bold;
|
58
|
-
padding: 5px 5px 5px 15px;
|
59
|
-
font-size: 12px;
|
60
|
-
margin: -7px;
|
61
|
-
margin-bottom: 0px;
|
62
|
-
background-color: #c00;
|
63
|
-
color: #fff;
|
64
|
-
}
|
65
|
-
ul li {
|
66
|
-
font-size: 12px;
|
67
|
-
list-style: square;
|
68
|
-
}
|
69
|
-
}
|
@@ -1,86 +0,0 @@
|
|
1
|
-
class PostsController < ApplicationController
|
2
|
-
before_filter :authenticate
|
3
|
-
# GET /posts
|
4
|
-
# GET /posts.json
|
5
|
-
|
6
|
-
def index
|
7
|
-
@posts = Post.all
|
8
|
-
ap current_user.created.utc
|
9
|
-
|
10
|
-
respond_to do |format|
|
11
|
-
format.html # index.html.erb
|
12
|
-
format.json { render json: @posts }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
# GET /posts/1
|
17
|
-
# GET /posts/1.json
|
18
|
-
def show
|
19
|
-
@post = Post.find(params[:id])
|
20
|
-
|
21
|
-
respond_to do |format|
|
22
|
-
format.html # show.html.erb
|
23
|
-
format.json { render json: @post }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# GET /posts/new
|
28
|
-
# GET /posts/new.json
|
29
|
-
def new
|
30
|
-
@post = Post.new
|
31
|
-
|
32
|
-
respond_to do |format|
|
33
|
-
format.html # new.html.erb
|
34
|
-
format.json { render json: @post }
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# GET /posts/1/edit
|
39
|
-
def edit
|
40
|
-
@post = Post.find(params[:id])
|
41
|
-
end
|
42
|
-
|
43
|
-
# POST /posts
|
44
|
-
# POST /posts.json
|
45
|
-
def create
|
46
|
-
@post = Post.new(params[:post])
|
47
|
-
|
48
|
-
respond_to do |format|
|
49
|
-
if @post.save
|
50
|
-
format.html { redirect_to @post, notice: 'Post was successfully created.' }
|
51
|
-
format.json { render json: @post, status: :created, location: @post }
|
52
|
-
else
|
53
|
-
format.html { render action: "new" }
|
54
|
-
format.json { render json: @post.errors, status: :unprocessable_entity }
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# PUT /posts/1
|
60
|
-
# PUT /posts/1.json
|
61
|
-
def update
|
62
|
-
@post = Post.find(params[:id])
|
63
|
-
|
64
|
-
respond_to do |format|
|
65
|
-
if @post.update_attributes(params[:post])
|
66
|
-
format.html { redirect_to @post, notice: 'Post was successfully updated.' }
|
67
|
-
format.json { head :no_content }
|
68
|
-
else
|
69
|
-
format.html { render action: "edit" }
|
70
|
-
format.json { render json: @post.errors, status: :unprocessable_entity }
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
# DELETE /posts/1
|
76
|
-
# DELETE /posts/1.json
|
77
|
-
def destroy
|
78
|
-
@post = Post.find(params[:id])
|
79
|
-
@post.destroy
|
80
|
-
|
81
|
-
respond_to do |format|
|
82
|
-
format.html { redirect_to posts_url }
|
83
|
-
format.json { head :no_content }
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
data/dummy/app/models/post.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
<%= form_for(@post) do |f| %>
|
2
|
-
<% if @post.errors.any? %>
|
3
|
-
<div id="error_explanation">
|
4
|
-
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
|
5
|
-
|
6
|
-
<ul>
|
7
|
-
<% @post.errors.full_messages.each do |msg| %>
|
8
|
-
<li><%= msg %></li>
|
9
|
-
<% end %>
|
10
|
-
</ul>
|
11
|
-
</div>
|
12
|
-
<% end %>
|
13
|
-
|
14
|
-
<div class="field">
|
15
|
-
<%= f.label :title %><br />
|
16
|
-
<%= f.text_field :title %>
|
17
|
-
</div>
|
18
|
-
<div class="actions">
|
19
|
-
<%= f.submit %>
|
20
|
-
</div>
|
21
|
-
<% end %>
|
@@ -1,23 +0,0 @@
|
|
1
|
-
<h1>Listing posts</h1>
|
2
|
-
|
3
|
-
<table>
|
4
|
-
<tr>
|
5
|
-
<th>Title</th>
|
6
|
-
<th></th>
|
7
|
-
<th></th>
|
8
|
-
<th></th>
|
9
|
-
</tr>
|
10
|
-
|
11
|
-
<% @posts.each do |post| %>
|
12
|
-
<tr>
|
13
|
-
<td><%= post.title %></td>
|
14
|
-
<td><%= link_to 'Show', post %></td>
|
15
|
-
<td><%= link_to 'Edit', edit_post_path(post) %></td>
|
16
|
-
<td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
17
|
-
</tr>
|
18
|
-
<% end %>
|
19
|
-
</table>
|
20
|
-
|
21
|
-
<br />
|
22
|
-
|
23
|
-
<%= link_to 'New Post', new_post_path %>
|
@@ -1,70 +0,0 @@
|
|
1
|
-
class UpdateUsers2 < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
if !table_exists? :users
|
4
|
-
create_table :users do |t|
|
5
|
-
t.string :provider
|
6
|
-
t.string :uid
|
7
|
-
t.string :email
|
8
|
-
t.integer :created
|
9
|
-
t.string :username
|
10
|
-
t.boolean :verified
|
11
|
-
t.boolean :admin
|
12
|
-
t.string :referred_by
|
13
|
-
t.string :token
|
14
|
-
t.text :facebook
|
15
|
-
t.text :tags
|
16
|
-
t.text :referred
|
17
|
-
t.text :google
|
18
|
-
t.text :twitter
|
19
|
-
t.text :github
|
20
|
-
t.text :access_tokens
|
21
|
-
t.boolean :subscribed
|
22
|
-
t.string :display
|
23
|
-
|
24
|
-
t.timestamps
|
25
|
-
end
|
26
|
-
else
|
27
|
-
safe_column :users, :provider, :string
|
28
|
-
safe_column :users, :uid, :string
|
29
|
-
safe_column :users, :email, :string
|
30
|
-
safe_column :users, :created, :integer
|
31
|
-
safe_column :users, :username, :string
|
32
|
-
safe_column :users, :verified, :booleanied
|
33
|
-
safe_column :users, :admin, :boolean
|
34
|
-
safe_column :users, :referred, :string
|
35
|
-
safe_column :users, :token, :string
|
36
|
-
safe_column :users, :facebook, :text
|
37
|
-
safe_column :users, :tags, :text
|
38
|
-
safe_column :users, :referred, :text
|
39
|
-
safe_column :users, :google, :text
|
40
|
-
safe_column :users, :twitter, :text
|
41
|
-
safe_column :users, :github, :text
|
42
|
-
safe_column :users, :access_tokens, :text
|
43
|
-
safe_column :users, :display, :string
|
44
|
-
safe_column :users, :subscribed, :boolean
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.down
|
49
|
-
drop_table :users
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
def table_exists? table
|
55
|
-
ActiveRecord::Base.connection.table_exists?(table.to_s)
|
56
|
-
end
|
57
|
-
|
58
|
-
def column_exists?(table, column)
|
59
|
-
begin
|
60
|
-
ActiveRecord::Base.connection.columns(table.to_s).map(&:name).include?(column.to_s)
|
61
|
-
rescue NoMethodError #actual_columns is empty and it doesn't respond to the map method
|
62
|
-
false
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def safe_column table, name, type
|
67
|
-
add_column table.to_sym, name.to_sym, type.to_sym unless column_exists? table, name
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
data/dummy/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class PostsControllerTest < ActionController::TestCase
|
4
|
-
setup do
|
5
|
-
@post = posts(:one)
|
6
|
-
@user = users(:basic)
|
7
|
-
@controller.stubs(:current_user).returns(@user)
|
8
|
-
end
|
9
|
-
|
10
|
-
test "should get index" do
|
11
|
-
get :index
|
12
|
-
assert_response :success
|
13
|
-
assert_not_nil assigns(:posts)
|
14
|
-
end
|
15
|
-
|
16
|
-
test "should get new" do
|
17
|
-
get :new
|
18
|
-
assert_response :success
|
19
|
-
end
|
20
|
-
|
21
|
-
test "should create post" do
|
22
|
-
assert_difference('Post.count') do
|
23
|
-
post :create, post: { title: @post.title }
|
24
|
-
end
|
25
|
-
|
26
|
-
assert_redirected_to post_path(assigns(:post))
|
27
|
-
end
|
28
|
-
|
29
|
-
test "should show post" do
|
30
|
-
get :show, id: @post
|
31
|
-
assert_response :success
|
32
|
-
end
|
33
|
-
|
34
|
-
test "should get edit" do
|
35
|
-
get :edit, id: @post
|
36
|
-
assert_response :success
|
37
|
-
end
|
38
|
-
|
39
|
-
test "should update post" do
|
40
|
-
put :update, id: @post, post: { title: @post.title }
|
41
|
-
assert_redirected_to post_path(assigns(:post))
|
42
|
-
end
|
43
|
-
|
44
|
-
test "should destroy post" do
|
45
|
-
assert_difference('Post.count', -1) do
|
46
|
-
delete :destroy, id: @post
|
47
|
-
end
|
48
|
-
|
49
|
-
assert_redirected_to posts_path
|
50
|
-
end
|
51
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'rails/performance_test_help'
|
3
|
-
|
4
|
-
class BrowsingTest < ActionDispatch::PerformanceTest
|
5
|
-
# Refer to the documentation for all available options
|
6
|
-
# self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
|
7
|
-
# :output => 'tmp/performance', :formats => [:flat] }
|
8
|
-
|
9
|
-
def test_homepage
|
10
|
-
get '/'
|
11
|
-
end
|
12
|
-
end
|