stuffer 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/.gitignore +19 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +68 -0
  5. data/Rakefile +1 -0
  6. data/lib/stuffer.rb +138 -0
  7. data/lib/stuffer/version.rb +3 -0
  8. data/lib/teststuff/.gitignore +15 -0
  9. data/lib/teststuff/.rspec +2 -0
  10. data/lib/teststuff/Gemfile +49 -0
  11. data/lib/teststuff/README.rdoc +261 -0
  12. data/lib/teststuff/Rakefile +7 -0
  13. data/lib/teststuff/app/assets/images/rails.png +0 -0
  14. data/lib/teststuff/app/assets/javascripts/application.js +15 -0
  15. data/lib/teststuff/app/assets/javascripts/users.js.coffee +3 -0
  16. data/lib/teststuff/app/assets/stylesheets/application.css +13 -0
  17. data/lib/teststuff/app/assets/stylesheets/scaffolds.css.scss +69 -0
  18. data/lib/teststuff/app/assets/stylesheets/users.css.scss +3 -0
  19. data/lib/teststuff/app/controllers/application_controller.rb +3 -0
  20. data/lib/teststuff/app/controllers/info_controller.rb +14 -0
  21. data/lib/teststuff/app/controllers/users_controller.rb +85 -0
  22. data/lib/teststuff/app/helpers/application_helper.rb +2 -0
  23. data/lib/teststuff/app/helpers/users_helper.rb +2 -0
  24. data/lib/teststuff/app/mailers/.gitkeep +0 -0
  25. data/lib/teststuff/app/models/.gitkeep +0 -0
  26. data/lib/teststuff/app/models/info.rb +5 -0
  27. data/lib/teststuff/app/models/user.rb +5 -0
  28. data/lib/teststuff/app/views/layouts/application.html.erb +14 -0
  29. data/lib/teststuff/app/views/users/_form.html.erb +39 -0
  30. data/lib/teststuff/app/views/users/edit.html.erb +6 -0
  31. data/lib/teststuff/app/views/users/index.html.erb +25 -0
  32. data/lib/teststuff/app/views/users/new.html.erb +5 -0
  33. data/lib/teststuff/app/views/users/show.html.erb +15 -0
  34. data/lib/teststuff/config.ru +4 -0
  35. data/lib/teststuff/config/application.rb +62 -0
  36. data/lib/teststuff/config/boot.rb +6 -0
  37. data/lib/teststuff/config/database.yml +25 -0
  38. data/lib/teststuff/config/environment.rb +5 -0
  39. data/lib/teststuff/config/environments/development.rb +37 -0
  40. data/lib/teststuff/config/environments/production.rb +67 -0
  41. data/lib/teststuff/config/environments/test.rb +37 -0
  42. data/lib/teststuff/config/initializers/backtrace_silencers.rb +7 -0
  43. data/lib/teststuff/config/initializers/inflections.rb +15 -0
  44. data/lib/teststuff/config/initializers/mime_types.rb +5 -0
  45. data/lib/teststuff/config/initializers/secret_token.rb +7 -0
  46. data/lib/teststuff/config/initializers/session_store.rb +8 -0
  47. data/lib/teststuff/config/initializers/wrap_parameters.rb +14 -0
  48. data/lib/teststuff/config/locales/en.yml +5 -0
  49. data/lib/teststuff/config/routes.rb +61 -0
  50. data/lib/teststuff/db/migrate/20130606172155_create_users.rb +10 -0
  51. data/lib/teststuff/db/migrate/20130606184452_add_number_to_user.rb +5 -0
  52. data/lib/teststuff/db/migrate/20130606185910_add_stuffed_to_user.rb +5 -0
  53. data/lib/teststuff/db/migrate/20130606200443_add_food_to_user.rb +5 -0
  54. data/lib/teststuff/db/migrate/20130607120716_create_infos.rb +10 -0
  55. data/lib/teststuff/db/migrate/20130607122425_add_user_to_info.rb +5 -0
  56. data/lib/teststuff/db/schema.rb +34 -0
  57. data/lib/teststuff/db/seeds.rb +7 -0
  58. data/lib/teststuff/lib/assets/.gitkeep +0 -0
  59. data/lib/teststuff/lib/tasks/.gitkeep +0 -0
  60. data/lib/teststuff/log/.gitkeep +0 -0
  61. data/lib/teststuff/public/404.html +26 -0
  62. data/lib/teststuff/public/422.html +26 -0
  63. data/lib/teststuff/public/500.html +25 -0
  64. data/lib/teststuff/public/favicon.ico +0 -0
  65. data/lib/teststuff/public/index.html +241 -0
  66. data/lib/teststuff/public/robots.txt +5 -0
  67. data/lib/teststuff/script/rails +6 -0
  68. data/lib/teststuff/spec/controllers/users_controller_spec.rb +160 -0
  69. data/lib/teststuff/spec/factories/infos.rb +8 -0
  70. data/lib/teststuff/spec/factories/users.rb +11 -0
  71. data/lib/teststuff/spec/features/stuffer_spec.rb +94 -0
  72. data/lib/teststuff/spec/helpers/users_helper_spec.rb +15 -0
  73. data/lib/teststuff/spec/models/info_spec.rb +5 -0
  74. data/lib/teststuff/spec/models/user_spec.rb +5 -0
  75. data/lib/teststuff/spec/requests/users_spec.rb +11 -0
  76. data/lib/teststuff/spec/routing/users_routing_spec.rb +35 -0
  77. data/lib/teststuff/spec/spec_helper.rb +41 -0
  78. data/lib/teststuff/spec/views/users/edit.html.erb_spec.rb +20 -0
  79. data/lib/teststuff/spec/views/users/index.html.erb_spec.rb +23 -0
  80. data/lib/teststuff/spec/views/users/new.html.erb_spec.rb +20 -0
  81. data/lib/teststuff/spec/views/users/show.html.erb_spec.rb +17 -0
  82. data/lib/teststuff/vendor/assets/javascripts/.gitkeep +0 -0
  83. data/lib/teststuff/vendor/assets/stylesheets/.gitkeep +0 -0
  84. data/lib/teststuff/vendor/plugins/.gitkeep +0 -0
  85. data/stuffer.gemspec +30 -0
  86. metadata +283 -0
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Teststuff::Application.load_tasks
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,69 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the Users controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,14 @@
1
+ class InfoController < ApplicationController
2
+
3
+ def new
4
+ @info = Info.new
5
+ end
6
+
7
+ def create
8
+ @info = Info.new(params[:info])
9
+ end
10
+
11
+
12
+
13
+
14
+ end
@@ -0,0 +1,85 @@
1
+ class UsersController < ApplicationController
2
+ # GET /users
3
+ # GET /users.json
4
+ def index
5
+ @users = User.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @users }
10
+ end
11
+ end
12
+
13
+ # GET /users/1
14
+ # GET /users/1.json
15
+ def show
16
+ @user = User.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @user }
21
+ end
22
+ end
23
+
24
+ # GET /users/new
25
+ # GET /users/new.json
26
+ def new
27
+ @user = User.new
28
+ @info = @user.build_info
29
+
30
+ respond_to do |format|
31
+ format.html # new.html.erb
32
+ format.json { render json: @user }
33
+ end
34
+ end
35
+
36
+ # GET /users/1/edit
37
+ def edit
38
+ @user = User.find(params[:id])
39
+ end
40
+
41
+ # POST /users
42
+ # POST /users.json
43
+ def create
44
+ @user = User.new(params[:user])
45
+ # @info = @user.build_info(params[:info_attributes])
46
+
47
+ respond_to do |format|
48
+ if @user.save
49
+ format.html { redirect_to @user, notice: 'User was successfully created.' }
50
+ format.json { render json: @user, status: :created, location: @user }
51
+ else
52
+ format.html { render action: "new" }
53
+ format.json { render json: @user.errors, status: :unprocessable_entity }
54
+ end
55
+ end
56
+ end
57
+
58
+ # PUT /users/1
59
+ # PUT /users/1.json
60
+ def update
61
+ @user = User.find(params[:id])
62
+
63
+ respond_to do |format|
64
+ if @user.update_attributes(params[:user])
65
+ format.html { redirect_to @user, notice: 'User was successfully updated.' }
66
+ format.json { head :no_content }
67
+ else
68
+ format.html { render action: "edit" }
69
+ format.json { render json: @user.errors, status: :unprocessable_entity }
70
+ end
71
+ end
72
+ end
73
+
74
+ # DELETE /users/1
75
+ # DELETE /users/1.json
76
+ def destroy
77
+ @user = User.find(params[:id])
78
+ @user.destroy
79
+
80
+ respond_to do |format|
81
+ format.html { redirect_to users_url }
82
+ format.json { head :no_content }
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module UsersHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ class Info < ActiveRecord::Base
2
+ attr_accessible :wage, :wife, :user_id
3
+
4
+ belongs_to :user
5
+ end
@@ -0,0 +1,5 @@
1
+ class User < ActiveRecord::Base
2
+ attr_accessible :email, :name, :number, :stuffed, :food, :info_attributes
3
+ has_one :info
4
+ accepts_nested_attributes_for :info
5
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Teststuff</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,39 @@
1
+ <%= simple_form_for(@user) do |f| %>
2
+ <% if @user.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @user.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 'fuck you capy' %><br />
16
+ <%= f.text_field :name %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :email %><br />
20
+ <%= f.text_field :email %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.input :number, collection: 18..60 %>
24
+ </div>
25
+ <div class="field">
26
+ <%= f.input :stuffed %>
27
+ </div>
28
+ <div class="field">
29
+ <%= f.input :food, collection: ['toast', 'bacon', 'cucumber'], as: :radio_buttons %>
30
+ </div>
31
+ <%= f.simple_fields_for :info do |p| %>
32
+ <div class="field">
33
+ <%= p.input :wage %>
34
+ </div>
35
+ <% end %>
36
+ <div class="actions">
37
+ <%= f.submit %>
38
+ </div>
39
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @user %> |
6
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,25 @@
1
+ <h1>Listing users</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Name</th>
6
+ <th>Email</th>
7
+ <th></th>
8
+ <th></th>
9
+ <th></th>
10
+ </tr>
11
+
12
+ <% @users.each do |user| %>
13
+ <tr>
14
+ <td><%= user.name %></td>
15
+ <td><%= user.email %></td>
16
+ <td><%= link_to 'Show', user %></td>
17
+ <td><%= link_to 'Edit', edit_user_path(user) %></td>
18
+ <td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %></td>
19
+ </tr>
20
+ <% end %>
21
+ </table>
22
+
23
+ <br />
24
+
25
+ <%= link_to 'New User', new_user_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,15 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Name:</b>
5
+ <%= @user.name %>
6
+ </p>
7
+
8
+ <p>
9
+ <b>Email:</b>
10
+ <%= @user.email %>
11
+ </p>
12
+
13
+
14
+ <%= link_to 'Edit', edit_user_path(@user) %> |
15
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Teststuff::Application
@@ -0,0 +1,62 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ if defined?(Bundler)
6
+ # If you precompile assets before deploying to production, use this line
7
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
8
+ # If you want your assets lazily compiled in production, use this line
9
+ # Bundler.require(:default, :assets, Rails.env)
10
+ end
11
+
12
+ module Teststuff
13
+ class Application < Rails::Application
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration should go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded.
17
+
18
+ # Custom directories with classes and modules you want to be autoloadable.
19
+ # config.autoload_paths += %W(#{config.root}/extras)
20
+
21
+ # Only load the plugins named here, in the order given (default is alphabetical).
22
+ # :all can be used as a placeholder for all plugins not explicitly named.
23
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24
+
25
+ # Activate observers that should always be running.
26
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27
+
28
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30
+ # config.time_zone = 'Central Time (US & Canada)'
31
+
32
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
+ # config.i18n.default_locale = :de
35
+
36
+ # Configure the default encoding used in templates for Ruby 1.9.
37
+ config.encoding = "utf-8"
38
+
39
+ # Configure sensitive parameters which will be filtered from the log file.
40
+ config.filter_parameters += [:password]
41
+
42
+ # Enable escaping HTML in JSON.
43
+ config.active_support.escape_html_entities_in_json = true
44
+
45
+ # Use SQL instead of Active Record's schema dumper when creating the database.
46
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
47
+ # like if you have constraints or database-specific column types
48
+ # config.active_record.schema_format = :sql
49
+
50
+ # Enforce whitelist mode for mass assignment.
51
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
52
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
53
+ # parameters by using an attr_accessible or attr_protected declaration.
54
+ config.active_record.whitelist_attributes = true
55
+
56
+ # Enable the asset pipeline
57
+ config.assets.enabled = true
58
+
59
+ # Version of your assets, change this if you want to expire all your assets
60
+ config.assets.version = '1.0'
61
+ end
62
+ end