+
diff --git a/harshilp/rails/DojoSecrets/app/views/shared/_errors.html.erb b/harshilp/rails/DojoSecrets/app/views/shared/_errors.html.erb
new file mode 100644
index 0000000..eb1355e
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/app/views/shared/_errors.html.erb
@@ -0,0 +1,5 @@
+ <% if flash[type] %>
+ <% flash[type].each do |e| %>
+
<%= e %>
+ <% end %>
+ <% end %>
\ No newline at end of file
diff --git a/harshilp/rails/DojoSecrets/app/views/users/edit.html.erb b/harshilp/rails/DojoSecrets/app/views/users/edit.html.erb
new file mode 100644
index 0000000..985e84a
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/app/views/users/edit.html.erb
@@ -0,0 +1,23 @@
+Back
+
Update User
+
+
Change Password
+
+
+<%= link_to 'Delete User', delete_user_path(@user.id), data: {confirm: "Are you sure?", method:'delete'} %>
\ No newline at end of file
diff --git a/harshilp/rails/DojoSecrets/app/views/users/new.html.erb b/harshilp/rails/DojoSecrets/app/views/users/new.html.erb
new file mode 100644
index 0000000..aa6d6cb
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/app/views/users/new.html.erb
@@ -0,0 +1,11 @@
+
+ <%= link_to 'Delete', delete_secret_path(secret.id), data: {confirm: "Put your secret to bed?", method:'delete'} %>
+ <% end %>
+
+
+
Secrets liked:
+ <% @user.secrets_liked.reject{ |s| @user.secrets.include? s }.reverse.each do |secret| %>
+
<%= secret.likes.count %> - <%= secret.content %>
+ <% end %>
+
diff --git a/harshilp/rails/DojoSecrets/bin/bundle b/harshilp/rails/DojoSecrets/bin/bundle
new file mode 100644
index 0000000..66e9889
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/bin/bundle
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+load Gem.bin_path('bundler', 'bundle')
diff --git a/harshilp/rails/DojoSecrets/bin/rails b/harshilp/rails/DojoSecrets/bin/rails
new file mode 100644
index 0000000..0138d79
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/bin/rails
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path('../spring', __FILE__)
+rescue LoadError => e
+ raise unless e.message.include?('spring')
+end
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require_relative '../config/boot'
+require 'rails/commands'
diff --git a/harshilp/rails/DojoSecrets/bin/rake b/harshilp/rails/DojoSecrets/bin/rake
new file mode 100644
index 0000000..d87d5f5
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/bin/rake
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path('../spring', __FILE__)
+rescue LoadError => e
+ raise unless e.message.include?('spring')
+end
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run
diff --git a/harshilp/rails/DojoSecrets/bin/setup b/harshilp/rails/DojoSecrets/bin/setup
new file mode 100644
index 0000000..acdb2c1
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/bin/setup
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+Dir.chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file:
+
+ puts "== Installing dependencies =="
+ system "gem install bundler --conservative"
+ system "bundle check || bundle install"
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?("config/database.yml")
+ # system "cp config/database.yml.sample config/database.yml"
+ # end
+
+ puts "\n== Preparing database =="
+ system "bin/rake db:setup"
+
+ puts "\n== Removing old logs and tempfiles =="
+ system "rm -f log/*"
+ system "rm -rf tmp/cache"
+
+ puts "\n== Restarting application server =="
+ system "touch tmp/restart.txt"
+end
diff --git a/harshilp/rails/DojoSecrets/bin/spring b/harshilp/rails/DojoSecrets/bin/spring
new file mode 100644
index 0000000..fb2ec2e
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/bin/spring
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+
+# This file loads spring without using Bundler, in order to be fast.
+# It gets overwritten when you run the `spring binstub` command.
+
+unless defined?(Spring)
+ require 'rubygems'
+ require 'bundler'
+
+ lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
+ spring = lockfile.specs.detect { |spec| spec.name == "spring" }
+ if spring
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
+ gem 'spring', spring.version
+ require 'spring/binstub'
+ end
+end
diff --git a/harshilp/rails/DojoSecrets/config.ru b/harshilp/rails/DojoSecrets/config.ru
new file mode 100644
index 0000000..bd83b25
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Rails.application
diff --git a/harshilp/rails/DojoSecrets/config/application.rb b/harshilp/rails/DojoSecrets/config/application.rb
new file mode 100644
index 0000000..7b88c7a
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/application.rb
@@ -0,0 +1,35 @@
+require File.expand_path('../boot', __FILE__)
+
+require "rails"
+# Pick the frameworks you want:
+require "active_model/railtie"
+require "active_job/railtie"
+require "active_record/railtie"
+require "action_controller/railtie"
+require "action_mailer/railtie"
+require "action_view/railtie"
+require "sprockets/railtie"
+# require "rails/test_unit/railtie"
+
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
+
+module DojoSecrets
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # Do not swallow errors in after_commit/after_rollback callbacks.
+ config.active_record.raise_in_transactional_callbacks = true
+ end
+end
diff --git a/harshilp/rails/DojoSecrets/config/boot.rb b/harshilp/rails/DojoSecrets/config/boot.rb
new file mode 100644
index 0000000..6b750f0
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/boot.rb
@@ -0,0 +1,3 @@
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' # Set up gems listed in the Gemfile.
diff --git a/harshilp/rails/DojoSecrets/config/database.yml b/harshilp/rails/DojoSecrets/config/database.yml
new file mode 100644
index 0000000..06981ca
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/database.yml
@@ -0,0 +1,85 @@
+# PostgreSQL. Versions 8.2 and up are supported.
+#
+# Install the pg driver:
+# gem install pg
+# On OS X with Homebrew:
+# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
+# On OS X with MacPorts:
+# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
+# On Windows:
+# gem install pg
+# Choose the win32 build.
+# Install PostgreSQL and put its /bin directory on your path.
+#
+# Configure Using Gemfile
+# gem 'pg'
+#
+default: &default
+ adapter: postgresql
+ encoding: unicode
+ # For details on connection pooling, see rails configuration guide
+ # http://guides.rubyonrails.org/configuring.html#database-pooling
+ pool: 5
+
+development:
+ <<: *default
+ database: DojoSecrets_development
+
+ # The specified database role being used to connect to postgres.
+ # To create additional roles in postgres see `$ createuser --help`.
+ # When left blank, postgres will use the default role. This is
+ # the same name as the operating system user that initialized the database.
+ #username: DojoSecrets
+
+ # The password associated with the postgres role (username).
+ #password:
+
+ # Connect on a TCP socket. Omitted by default since the client uses a
+ # domain socket that doesn't need configuration. Windows does not have
+ # domain sockets, so uncomment these lines.
+ #host: localhost
+
+ # The TCP port the server listens on. Defaults to 5432.
+ # If your server runs on a different port number, change accordingly.
+ #port: 5432
+
+ # Schema search path. The server defaults to $user,public
+ #schema_search_path: myapp,sharedapp,public
+
+ # Minimum log levels, in increasing order:
+ # debug5, debug4, debug3, debug2, debug1,
+ # log, notice, warning, error, fatal, and panic
+ # Defaults to warning.
+ #min_messages: notice
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ <<: *default
+ database: DojoSecrets_test
+
+# As with config/secrets.yml, you never want to store sensitive information,
+# like your database password, in your source code. If your source code is
+# ever seen by anyone, they now have access to your database.
+#
+# Instead, provide the password as a unix environment variable when you boot
+# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
+# for a full rundown on how to provide these environment variables in a
+# production deployment.
+#
+# On Heroku and other platform providers, you may have a full connection URL
+# available as an environment variable. For example:
+#
+# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
+#
+# You can use this database configuration with:
+#
+# production:
+# url: <%= ENV['DATABASE_URL'] %>
+#
+production:
+ <<: *default
+ database: DojoSecrets_production
+ username: DojoSecrets
+ password: <%= ENV['DOJOSECRETS_DATABASE_PASSWORD'] %>
diff --git a/harshilp/rails/DojoSecrets/config/environment.rb b/harshilp/rails/DojoSecrets/config/environment.rb
new file mode 100644
index 0000000..ee8d90d
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the Rails application.
+require File.expand_path('../application', __FILE__)
+
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/harshilp/rails/DojoSecrets/config/environments/development.rb b/harshilp/rails/DojoSecrets/config/environments/development.rb
new file mode 100644
index 0000000..45b1759
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/environments/development.rb
@@ -0,0 +1,41 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.cache_classes = false
+
+ # Do not eager load code on boot.
+ config.eager_load = false
+ config.reload_classes_only_on_change = false
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send.
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger.
+ config.active_support.deprecation = :log
+
+ # Raise an error on page load if there are pending migrations.
+ config.active_record.migration_error = :page_load
+
+ # Debug mode disables concatenation and preprocessing of assets.
+ # This option may cause significant delays in view rendering with a large
+ # number of complex assets.
+ config.assets.debug = true
+
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
+ config.assets.digest = true
+
+ # Adds additional error checking when serving assets at runtime.
+ # Checks for improperly declared sprockets dependencies.
+ # Raises helpful error messages.
+ config.assets.raise_runtime_errors = true
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
+end
diff --git a/harshilp/rails/DojoSecrets/config/environments/production.rb b/harshilp/rails/DojoSecrets/config/environments/production.rb
new file mode 100644
index 0000000..5c1b32e
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/environments/production.rb
@@ -0,0 +1,79 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Code is not reloaded between requests.
+ config.cache_classes = true
+
+ # Eager load code on boot. This eager loads most of Rails and
+ # your application in memory, allowing both threaded web servers
+ # and those relying on copy on write to perform better.
+ # Rake tasks automatically ignore this option for performance.
+ config.eager_load = true
+
+ # Full error reports are disabled and caching is turned on.
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
+ # Add `rack-cache` to your Gemfile before enabling this.
+ # For large-scale production use, consider using a caching reverse proxy like
+ # NGINX, varnish or squid.
+ # config.action_dispatch.rack_cache = true
+
+ # Disable serving static files from the `/public` folder by default since
+ # Apache or NGINX already handles this.
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
+
+ # Compress JavaScripts and CSS.
+ config.assets.js_compressor = :uglifier
+ # config.assets.css_compressor = :sass
+
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
+ config.assets.compile = false
+
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
+ config.assets.digest = true
+
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
+
+ # Specifies the header that your server uses for sending files.
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
+
+ # Use the lowest log level to ensure availability of diagnostic information
+ # when problems arise.
+ config.log_level = :debug
+
+ # Prepend all log lines with the following tags.
+ # config.log_tags = [ :subdomain, :uuid ]
+
+ # Use a different logger for distributed setups.
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
+
+ # Use a different cache store in production.
+ # config.cache_store = :mem_cache_store
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.action_controller.asset_host = 'http://assets.example.com'
+
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners.
+ config.active_support.deprecation = :notify
+
+ # Use default logging formatter so that PID and timestamp are not suppressed.
+ config.log_formatter = ::Logger::Formatter.new
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+end
diff --git a/harshilp/rails/DojoSecrets/config/environments/test.rb b/harshilp/rails/DojoSecrets/config/environments/test.rb
new file mode 100644
index 0000000..1c19f08
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/environments/test.rb
@@ -0,0 +1,42 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
+
+ # Do not eager load code on boot. This avoids loading your whole application
+ # just for the purpose of running a single test. If you are using a tool that
+ # preloads Rails for running tests, you may have to set it to true.
+ config.eager_load = false
+
+ # Configure static file server for tests with Cache-Control for performance.
+ config.serve_static_files = true
+ config.static_cache_control = 'public, max-age=3600'
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Raise exceptions instead of rendering exception templates.
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Randomize the order test cases are executed.
+ config.active_support.test_order = :random
+
+ # Print deprecation notices to the stderr.
+ config.active_support.deprecation = :stderr
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
+end
diff --git a/harshilp/rails/DojoSecrets/config/initializers/assets.rb b/harshilp/rails/DojoSecrets/config/initializers/assets.rb
new file mode 100644
index 0000000..01ef3e6
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/initializers/assets.rb
@@ -0,0 +1,11 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = '1.0'
+
+# Add additional assets to the asset load path
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
+# Rails.application.config.assets.precompile += %w( search.js )
diff --git a/harshilp/rails/DojoSecrets/config/initializers/backtrace_silencers.rb b/harshilp/rails/DojoSecrets/config/initializers/backtrace_silencers.rb
new file mode 100644
index 0000000..59385cd
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/initializers/backtrace_silencers.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
diff --git a/harshilp/rails/DojoSecrets/config/initializers/cookies_serializer.rb b/harshilp/rails/DojoSecrets/config/initializers/cookies_serializer.rb
new file mode 100644
index 0000000..7f70458
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/initializers/cookies_serializer.rb
@@ -0,0 +1,3 @@
+# Be sure to restart your server when you modify this file.
+
+Rails.application.config.action_dispatch.cookies_serializer = :json
diff --git a/harshilp/rails/DojoSecrets/config/initializers/filter_parameter_logging.rb b/harshilp/rails/DojoSecrets/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 0000000..4a994e1
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,4 @@
+# Be sure to restart your server when you modify this file.
+
+# Configure sensitive parameters which will be filtered from the log file.
+Rails.application.config.filter_parameters += [:password]
diff --git a/harshilp/rails/DojoSecrets/config/initializers/inflections.rb b/harshilp/rails/DojoSecrets/config/initializers/inflections.rb
new file mode 100644
index 0000000..ac033bf
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/initializers/inflections.rb
@@ -0,0 +1,16 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.plural /^(ox)$/i, '\1en'
+# inflect.singular /^(ox)en/i, '\1'
+# inflect.irregular 'person', 'people'
+# inflect.uncountable %w( fish sheep )
+# end
+
+# These inflection rules are supported but not enabled by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.acronym 'RESTful'
+# end
diff --git a/harshilp/rails/DojoSecrets/config/initializers/mime_types.rb b/harshilp/rails/DojoSecrets/config/initializers/mime_types.rb
new file mode 100644
index 0000000..dc18996
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/initializers/mime_types.rb
@@ -0,0 +1,4 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
diff --git a/harshilp/rails/DojoSecrets/config/initializers/rails_footnotes.rb b/harshilp/rails/DojoSecrets/config/initializers/rails_footnotes.rb
new file mode 100644
index 0000000..9a15363
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/initializers/rails_footnotes.rb
@@ -0,0 +1,27 @@
+defined?(Footnotes) && Footnotes.setup do |f|
+ # Whether or not to enable footnotes
+ f.enabled = Rails.env.development?
+ # You can also use a lambda / proc to conditionally toggle footnotes
+ # Example :
+ # f.enabled = -> { User.current.admin? }
+ # Beware of thread-safety though, Footnotes.enabled is NOT thread safe
+ # and should not be modified anywhere else.
+
+ # Only toggle some notes :
+ # f.notes = [:session, :cookies, :params, :filters, :routes, :env, :queries, :log]
+
+ # Change the prefix :
+ # f.prefix = 'mvim://open?url=file://%s&line=%d&column=%d'
+
+ # Disable style :
+ # f.no_style = true
+
+ # Lock notes to top right :
+ # f.lock_top_right = true
+
+ # Change font size :
+ # f.font_size = '11px'
+
+ # Allow to open multiple notes :
+ # f.multiple_notes = true
+end
diff --git a/harshilp/rails/DojoSecrets/config/initializers/session_store.rb b/harshilp/rails/DojoSecrets/config/initializers/session_store.rb
new file mode 100644
index 0000000..745fa7c
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/initializers/session_store.rb
@@ -0,0 +1,3 @@
+# Be sure to restart your server when you modify this file.
+
+Rails.application.config.session_store :cookie_store, key: '_DojoSecrets_session'
diff --git a/harshilp/rails/DojoSecrets/config/initializers/wrap_parameters.rb b/harshilp/rails/DojoSecrets/config/initializers/wrap_parameters.rb
new file mode 100644
index 0000000..33725e9
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/initializers/wrap_parameters.rb
@@ -0,0 +1,14 @@
+# Be sure to restart your server when you modify this file.
+
+# This file contains settings for ActionController::ParamsWrapper which
+# is enabled by default.
+
+# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
+ActiveSupport.on_load(:action_controller) do
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
+end
+
+# To enable root element in JSON for ActiveRecord objects.
+# ActiveSupport.on_load(:active_record) do
+# self.include_root_in_json = true
+# end
diff --git a/harshilp/rails/DojoSecrets/config/locales/en.yml b/harshilp/rails/DojoSecrets/config/locales/en.yml
new file mode 100644
index 0000000..0653957
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/locales/en.yml
@@ -0,0 +1,23 @@
+# Files in the config/locales directory are used for internationalization
+# and are automatically loaded by Rails. If you want to use locales other
+# than English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t 'hello'
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t('hello') %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# To learn more, please read the Rails Internationalization guide
+# available at http://guides.rubyonrails.org/i18n.html.
+
+en:
+ hello: "Hello world"
diff --git a/harshilp/rails/DojoSecrets/config/routes.rb b/harshilp/rails/DojoSecrets/config/routes.rb
new file mode 100644
index 0000000..024beb5
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/routes.rb
@@ -0,0 +1,73 @@
+Rails.application.routes.draw do
+ root to: 'sessions#new'
+ get 'likes/:id' => 'likes#create', as: 'create_like'
+ delete 'likes/:id' => 'likes#destroy', as: 'delete_like'
+ get 'secrets' => 'secrets#index', as: 'secrets'
+ delete 'secrets/:id' => 'secrets#destroy', as: 'delete_secret'
+ post 'secrets/:id' => 'secrets#create', as: 'create_secret'
+ get 'sessions/new' => 'sessions#new', as: 'login'
+ post 'sessions' => 'sessions#create', as: 'create_session'
+ get 'users/new' => 'users#new', as: 'new_user'
+ post 'users/create' => 'users#create', as: 'create_user'
+ get 'users/:id' => 'users#show', as: 'show_user'
+ get 'users/edit'
+ delete 'sessions' => 'sessions#destroy', as: 'logout'
+ delete 'users/:id' => 'users#destroy', as: 'delete_user'
+ get 'users/:id/edit' => 'users#edit', as: 'edit_user'
+ put 'users/:id' => 'users#update', as: 'update_user'
+
+ # The priority is based upon order of creation: first created -> highest priority.
+ # See how all your routes lay out with "rake routes".
+
+ # You can have the root of your site routed with "root"
+ # root 'welcome#index'
+
+ # Example of regular route:
+ # get 'products/:id' => 'catalog#view'
+
+ # Example of named route that can be invoked with purchase_url(id: product.id)
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
+
+ # Example resource route (maps HTTP verbs to controller actions automatically):
+ # resources :products
+
+ # Example resource route with options:
+ # resources :products do
+ # member do
+ # get 'short'
+ # post 'toggle'
+ # end
+ #
+ # collection do
+ # get 'sold'
+ # end
+ # end
+
+ # Example resource route with sub-resources:
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
+
+ # Example resource route with more complex sub-resources:
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get 'recent', on: :collection
+ # end
+ # end
+
+ # Example resource route with concerns:
+ # concern :toggleable do
+ # post 'toggle'
+ # end
+ # resources :posts, concerns: :toggleable
+ # resources :photos, concerns: :toggleable
+
+ # Example resource route within a namespace:
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
+ # end
+end
diff --git a/harshilp/rails/DojoSecrets/config/secrets.yml b/harshilp/rails/DojoSecrets/config/secrets.yml
new file mode 100644
index 0000000..4321617
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/config/secrets.yml
@@ -0,0 +1,22 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key is used for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+# You can use `rake secret` to generate a secure secret key.
+
+# Make sure the secrets in this file are kept private
+# if you're sharing your code publicly.
+
+development:
+ secret_key_base: 7c16f109e6404a833eef909380bb5c3d92c8043f3f886721683e671a945d8126b60046aeed0612b6f4366458094ea631ad47b839016a446615f3f5840e6aea1f
+
+test:
+ secret_key_base: aa86ce6e1e59b58ef63194350b9be1ae23c6251ceb494c3701f794899421fb36569c626643620a9fb1130646035ff75746fda78b9ecc2a7a83bcc1acde1f810f
+
+# Do not keep production secrets in the repository,
+# instead read values from the environment.
+production:
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
diff --git a/harshilp/rails/DojoSecrets/db/migrate/20171210060616_create_users.rb b/harshilp/rails/DojoSecrets/db/migrate/20171210060616_create_users.rb
new file mode 100644
index 0000000..c9fe2c1
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/db/migrate/20171210060616_create_users.rb
@@ -0,0 +1,11 @@
+class CreateUsers < ActiveRecord::Migration
+ def change
+ create_table :users do |t|
+ t.string :name
+ t.string :email
+ t.string :password_digest
+
+ t.timestamps null: false
+ end
+ end
+end
diff --git a/harshilp/rails/DojoSecrets/db/migrate/20171212033208_create_secrets.rb b/harshilp/rails/DojoSecrets/db/migrate/20171212033208_create_secrets.rb
new file mode 100644
index 0000000..a222699
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/db/migrate/20171212033208_create_secrets.rb
@@ -0,0 +1,10 @@
+class CreateSecrets < ActiveRecord::Migration
+ def change
+ create_table :secrets do |t|
+ t.string :content
+ t.references :user, index: true, foreign_key: true
+
+ t.timestamps null: false
+ end
+ end
+end
diff --git a/harshilp/rails/DojoSecrets/db/migrate/20171212033224_create_likes.rb b/harshilp/rails/DojoSecrets/db/migrate/20171212033224_create_likes.rb
new file mode 100644
index 0000000..8b847a8
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/db/migrate/20171212033224_create_likes.rb
@@ -0,0 +1,10 @@
+class CreateLikes < ActiveRecord::Migration
+ def change
+ create_table :likes do |t|
+ t.references :secret, index: true, foreign_key: true
+ t.references :user, index: true, foreign_key: true
+
+ t.timestamps null: false
+ end
+ end
+end
diff --git a/harshilp/rails/DojoSecrets/db/schema.rb b/harshilp/rails/DojoSecrets/db/schema.rb
new file mode 100644
index 0000000..bf2e294
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/db/schema.rb
@@ -0,0 +1,49 @@
+# 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: 20171212033224) do
+
+ # These are extensions that must be enabled in order to support this database
+ enable_extension "plpgsql"
+
+ create_table "likes", force: :cascade do |t|
+ t.integer "secret_id"
+ t.integer "user_id"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "likes", ["secret_id"], name: "index_likes_on_secret_id", using: :btree
+ add_index "likes", ["user_id"], name: "index_likes_on_user_id", using: :btree
+
+ create_table "secrets", force: :cascade do |t|
+ t.string "content"
+ t.integer "user_id"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "secrets", ["user_id"], name: "index_secrets_on_user_id", using: :btree
+
+ create_table "users", force: :cascade do |t|
+ t.string "name"
+ t.string "email"
+ t.string "password_digest"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_foreign_key "likes", "secrets"
+ add_foreign_key "likes", "users"
+ add_foreign_key "secrets", "users"
+end
diff --git a/harshilp/rails/DojoSecrets/db/seeds.rb b/harshilp/rails/DojoSecrets/db/seeds.rb
new file mode 100644
index 0000000..4edb1e8
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/db/seeds.rb
@@ -0,0 +1,7 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#
+# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
+# Mayor.create(name: 'Emanuel', city: cities.first)
diff --git a/harshilp/rails/DojoSecrets/lib/assets/.keep b/harshilp/rails/DojoSecrets/lib/assets/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails/DojoSecrets/lib/tasks/.keep b/harshilp/rails/DojoSecrets/lib/tasks/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails/DojoSecrets/log/.keep b/harshilp/rails/DojoSecrets/log/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails/DojoSecrets/public/404.html b/harshilp/rails/DojoSecrets/public/404.html
new file mode 100644
index 0000000..b612547
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/public/404.html
@@ -0,0 +1,67 @@
+
+
+
+ The page you were looking for doesn't exist (404)
+
+
+
+
+
+
+
+
+
The page you were looking for doesn't exist.
+
You may have mistyped the address or the page may have moved.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/harshilp/rails/DojoSecrets/public/422.html b/harshilp/rails/DojoSecrets/public/422.html
new file mode 100644
index 0000000..a21f82b
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/public/422.html
@@ -0,0 +1,67 @@
+
+
+
+ The change you wanted was rejected (422)
+
+
+
+
+
+
+
+
+
The change you wanted was rejected.
+
Maybe you tried to change something you didn't have access to.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/harshilp/rails/DojoSecrets/public/500.html b/harshilp/rails/DojoSecrets/public/500.html
new file mode 100644
index 0000000..061abc5
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/public/500.html
@@ -0,0 +1,66 @@
+
+
+
+ We're sorry, but something went wrong (500)
+
+
+
+
+
+
+
+
+
We're sorry, but something went wrong.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/harshilp/rails/DojoSecrets/public/favicon.ico b/harshilp/rails/DojoSecrets/public/favicon.ico
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails/DojoSecrets/public/robots.txt b/harshilp/rails/DojoSecrets/public/robots.txt
new file mode 100644
index 0000000..3c9c7c0
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/public/robots.txt
@@ -0,0 +1,5 @@
+# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
+#
+# To ban all spiders from the entire site uncomment the next two lines:
+# User-agent: *
+# Disallow: /
diff --git a/harshilp/rails/DojoSecrets/spec/controllers/likes_controller_spec.rb b/harshilp/rails/DojoSecrets/spec/controllers/likes_controller_spec.rb
new file mode 100644
index 0000000..311c13f
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/controllers/likes_controller_spec.rb
@@ -0,0 +1,28 @@
+require 'rails_helper'
+RSpec.describe LikesController, type: :controller do
+ before do
+ @user = create(:user)
+ @secret = create(:secret, user: @user)
+ @like = create(:like, secret: @secret, user: @user)
+ end
+ context "when not logged in " do
+ before do
+ session[:user_id] = nil
+ end
+ it "cannot create a like" do
+ get :create, id: @user
+ expect(response).to redirect_to(login_path)
+ end
+ it "cannot destroy a like" do
+ get :destroy, id: @user
+ expect(response).to redirect_to(login_path)
+ end
+ end
+ context "when signed in as the wrong user" do
+ it "shouldn't be able to destroy a like" do
+ session[:user_id] = 10
+ get :destroy, id: @secret
+ expect(response).to redirect_to(show_user_path(10))
+ end
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails/DojoSecrets/spec/controllers/secrets_controller_spec.rb b/harshilp/rails/DojoSecrets/spec/controllers/secrets_controller_spec.rb
new file mode 100644
index 0000000..a47d221
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/controllers/secrets_controller_spec.rb
@@ -0,0 +1,31 @@
+require 'rails_helper'
+RSpec.describe SecretsController, type: :controller do
+ before do
+ @user = create(:user)
+ @secret = create(:secret, user: @user)
+ end
+ context "when not logged in" do
+ before do
+ session[:user_id] = nil
+ end
+ it "cannot access index" do
+ get :index, id: @user
+ expect(response).to redirect_to(login_path)
+ end
+ it "cannot access create" do
+ get :create, id: @user
+ expect(response).to redirect_to(login_path)
+ end
+ it "cannot access destroy" do
+ get :destroy, id: @user
+ expect(response).to redirect_to(login_path)
+ end
+ end
+ context "when signed in as the wrong user" do
+ it "cannot destroy another user's secret" do
+ session[:user_id] = 10
+ get :destroy, id: @secret
+ expect(response).to redirect_to(show_user_path(10))
+ end
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails/DojoSecrets/spec/controllers/users_controller_spec.rb b/harshilp/rails/DojoSecrets/spec/controllers/users_controller_spec.rb
new file mode 100644
index 0000000..97073da
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/controllers/users_controller_spec.rb
@@ -0,0 +1,48 @@
+require 'rails_helper'
+RSpec.describe UsersController, type: :controller do
+ before do
+ @user = create(:user)
+ end
+ context "when not logged in" do
+ before do
+ session[:user_id] = nil
+ end
+ it "cannot access show" do
+ get :show, id: @user
+ expect(response).to redirect_to(login_path)
+ end
+ it "cannot access edit" do
+ get :edit, id: @user
+ expect(response).to redirect_to(login_path)
+ end
+ it "cannot access update" do
+ get :update, id: @user
+ expect(response).to redirect_to(login_path)
+ end
+ it "cannot access destroy" do
+ get :destroy, id: @user
+ expect(response).to redirect_to(login_path)
+ end
+ end
+ context "when signed in as the wrong user" do
+ before do
+ session[:user_id] = 1
+ end
+ it "cannot access profile page another user" do
+ get :show, id: 2
+ expect(response).to redirect_to(show_user_path(1))
+ end
+ it "cannot access the edit page of another user" do
+ get :edit, id: 2
+ expect(response).to redirect_to(show_user_path(1))
+ end
+ it "cannot update another user" do
+ get :update, id: 2
+ expect(response).to redirect_to(show_user_path(1))
+ end
+ it "cannot destroy another user" do
+ get :destroy, id: 2
+ expect(response).to redirect_to(show_user_path(1))
+ end
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails/DojoSecrets/spec/factories/likes.rb b/harshilp/rails/DojoSecrets/spec/factories/likes.rb
new file mode 100644
index 0000000..56765c9
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/factories/likes.rb
@@ -0,0 +1,6 @@
+FactoryBot.define do
+ factory :like do
+ secret nil
+ user nil
+ end
+end
diff --git a/harshilp/rails/DojoSecrets/spec/factories/secrets.rb b/harshilp/rails/DojoSecrets/spec/factories/secrets.rb
new file mode 100644
index 0000000..3896b63
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/factories/secrets.rb
@@ -0,0 +1,6 @@
+FactoryBot.define do
+ factory :secret do
+ content "I like kitties"
+ user nil
+ end
+end
diff --git a/harshilp/rails/DojoSecrets/spec/factories/users.rb b/harshilp/rails/DojoSecrets/spec/factories/users.rb
new file mode 100644
index 0000000..66613a1
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/factories/users.rb
@@ -0,0 +1,8 @@
+FactoryBot.define do
+ factory :user do
+ name "Harshil Patel"
+ email "harshilp@uw.edu"
+ password "password"
+ password_confirmation "password"
+ end
+end
diff --git a/harshilp/rails/DojoSecrets/spec/features/auth_spec.rb b/harshilp/rails/DojoSecrets/spec/features/auth_spec.rb
new file mode 100644
index 0000000..4e98b49
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/features/auth_spec.rb
@@ -0,0 +1,59 @@
+require 'rails_helper'
+feature 'authentication feature' do
+ before (:each) do
+ @user = create(:user)
+ end
+ feature "user attempts to sign-in" do
+ scenario 'visits sign-in page with email and password fields' do
+ visit login_path
+ expect(page).to have_field('email')
+ expect(page).to have_field('password')
+ end
+ scenario 'logs in user if email/password is valid' do
+ log_in
+ expect(current_path).to eq(show_user_path(@user.id))
+ expect(page).to have_content("Welcome, #{@user.name}")
+ end
+ scenario 'does not sign in user if email is not valid' do
+ log_in email: 'asdf@asdf.asdf'
+ expect(current_path).to eq(login_path)
+ expect(page).to have_content("Invalid email/password")
+ end
+ scenario 'does not sign in user if password is invalid' do
+ log_in password: 'notpassword'
+ expect(current_path).to eq(login_path)
+ expect(page).to have_content("Invalid email/password")
+ end
+ end
+ feature "user attempts to log out" do
+ scenario 'displays "Log Out" button when user is logged on' do
+ log_in
+ expect(page).to have_button("Log Out")
+ end
+ scenario 'logs out user and redirects to login page' do
+ log_in
+ click_on 'Log Out'
+ expect(current_path).to eq(login_path)
+ end
+ end
+ feature "user attempts to access unauthorized content" do
+ scenario 'redirects to login when accessing secrets without login' do
+ visit secrets_path
+ expect(current_path).to eq(login_path)
+ end
+ scenario 'redirects to login when accessing user page without login' do
+ visit show_user_path(1)
+ expect(current_path).to eq(login_path)
+ end
+ scenario 'redirects to login when accessing edit user page without login' do
+ visit edit_user_path(1)
+ expect(current_path).to eq(login_path)
+ end
+ end
+ feature 'user can still access authorized pages' do
+ scenario 'user may access register page' do
+ visit new_user_path
+ expect(current_path).to eq(new_user_path)
+ end
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails/DojoSecrets/spec/features/like_features_spec.rb b/harshilp/rails/DojoSecrets/spec/features/like_features_spec.rb
new file mode 100644
index 0000000..1a81964
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/features/like_features_spec.rb
@@ -0,0 +1,37 @@
+require 'rails_helper'
+feature 'Like Features' do
+ before (:each) do
+ @user = create(:user)
+ @secret = create(:secret, user: @user)
+ log_in
+ end
+ feature 'secret has not been liked' do
+ scenario "displays like button if you haven't liked secret" do
+ visit secrets_path
+ expect(page).to have_content('Like')
+ end
+ scenario "like count updated correctly" do
+ visit secrets_path
+ click_on 'Like'
+ expect(page).to have_content('1 -')
+ end
+ scenario "liking will update like count, like button not visible" do
+ visit secrets_path
+ click_on 'Like'
+ expect(page).to_not have_content('Like')
+ end
+ end
+ feature "secret has been liked" do
+ scenario "unlike button is visible" do
+ visit secrets_path
+ click_on 'Like'
+ expect(page).to have_content('Unlike')
+ end
+ scenario "unliking will update like count" do
+ visit secrets_path
+ click_on 'Like'
+ click_on 'Unlike'
+ expect(page).to have_content('0 -')
+ end
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails/DojoSecrets/spec/features/secret_feature_spec.rb b/harshilp/rails/DojoSecrets/spec/features/secret_feature_spec.rb
new file mode 100644
index 0000000..7286952
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/features/secret_feature_spec.rb
@@ -0,0 +1,38 @@
+require 'rails_helper'
+feature "secret features" do
+ before (:each) do
+ @user = create(:user)
+ @userTsu = create(:user, email: 'userTsu@tsu.com')
+ @secret = create(:secret, user: @user)
+ @secretTsu = create(:secret, content: "I'm scared of the dark", user: @userTsu)
+ log_in
+ end
+ feature "Users personal secret page" do
+ scenario "shouldn't see other user's secrets" do
+ expect(page).to_not have_content(@secretTsu.content)
+ end
+ scenario "create a new secret" do
+ fill_in 'content', with: 'Space kitties!'
+ click_on 'Create'
+ expect(page).to have_content("Space kitties!")
+ expect(current_path).to eq(show_user_path(@user.id))
+ end
+ scenario "destroy secret from profile page, redirects to user profile page" do
+ click_on 'Delete'
+ expect(page).to_not have_content('I like kitties')
+ end
+ end
+ feature "Secret Dashboard" do
+ scenario "displays everyone's secrets" do
+ visit secrets_path
+ expect(page).to have_content('I like kitties')
+ expect(page).to have_content("I'm scared of the dark")
+ end
+ scenario "destroy secret from index page, redirects to user profile page" do
+ visit secrets_path
+ click_on 'Delete'
+ expect(current_path).to eq(show_user_path(@user.id))
+ expect(page).to_not have_content('I like kitties')
+ end
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails/DojoSecrets/spec/features/user_features_spec.rb b/harshilp/rails/DojoSecrets/spec/features/user_features_spec.rb
new file mode 100644
index 0000000..6ffe575
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/features/user_features_spec.rb
@@ -0,0 +1,34 @@
+require 'rails_helper'
+feature 'User features' do
+ feature "user sign-up" do
+ before (:each) do
+ visit new_user_path
+ end
+ scenario 'visits sign-up page' do
+ expect(page).to have_field('name')
+ expect(page).to have_field('email')
+ expect(page).to have_field('password')
+ expect(page).to have_field('password_confirmation')
+ end
+ scenario "redirects back to register and shows validations for blank fields" do
+ click_button 'Register'
+ expect(page).to have_content("can't be blank")
+ expect(current_path).to eq(new_user_path)
+ end
+ scenario "redirects back to register and shows validations for email in use" do
+ create(:user)
+ register
+ expect(current_path).to eq(new_user_path)
+ expect(page).to have_content('Email has already been taken')
+ end
+ scenario "redirects back to register and shows validations for passwords not matching" do
+ register password_confirmation: 'notpassword'
+ expect(current_path).to eq(new_user_path)
+ expect(page).to have_content("Password confirmation doesn't match Password")
+ end
+ scenario "with proper inputs, create user, log them in and redirect to index" do
+ register
+ expect(page).to have_content("Welcome, Harshil Patel")
+ end
+ end
+end
diff --git a/harshilp/rails/DojoSecrets/spec/features/user_settings_spec.rb b/harshilp/rails/DojoSecrets/spec/features/user_settings_spec.rb
new file mode 100644
index 0000000..ae0c274
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/features/user_settings_spec.rb
@@ -0,0 +1,43 @@
+require 'rails_helper'
+feature 'User features' do
+ before (:each) do
+ @user = create(:user)
+ log_in
+ click_on 'Edit Profile'
+ end
+ feature "User Settings Dashboard" do
+ scenario "visit users edit page" do
+ expect(current_path).to eq(edit_user_path(@user.id))
+ end
+ scenario "inputs filled out correctly" do
+ expect(find_field('name').value).to eq('Harshil Patel')
+ expect(find_field('email').value).to eq('harshilp@uw.edu')
+ end
+ scenario "incorrectly updates information" do
+ fill_in 'name', with: ''
+ fill_in 'oldPassword_update', with: 'password'
+ click_button 'Update'
+ expect(current_path).to eq(edit_user_path(@user.id))
+ expect(page).to have_content("Name can't be blank")
+ end
+ scenario "correctly updates information" do
+ fill_in 'name', with: 'Qwerty'
+ fill_in 'oldPassword_update', with: 'password'
+ click_button 'Update'
+ expect(page).to have_content("Welcome, Qwerty")
+ end
+ scenario "correctly changes password" do
+ fill_in 'password', with: 'password1'
+ fill_in 'password_confirmation', with: 'password1'
+ fill_in 'oldPassword_change', with: 'password'
+ click_button 'Change'
+ click_button 'Log Out'
+ log_in password: 'password1'
+ expect(page).to have_content("Welcome, Harshil Patel")
+ end
+ scenario "destroys user and redirects to registration page" do
+ click_on 'Delete'
+ expect(current_path).to eq(new_user_path)
+ end
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails/DojoSecrets/spec/helpers/likes_helper_spec.rb b/harshilp/rails/DojoSecrets/spec/helpers/likes_helper_spec.rb
new file mode 100644
index 0000000..7d0d338
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/helpers/likes_helper_spec.rb
@@ -0,0 +1,14 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the LikesHelper. For example:
+#
+# describe LikesHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe LikesHelper, type: :helper do
+end
diff --git a/harshilp/rails/DojoSecrets/spec/helpers/secrets_helper_spec.rb b/harshilp/rails/DojoSecrets/spec/helpers/secrets_helper_spec.rb
new file mode 100644
index 0000000..50de9e0
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/helpers/secrets_helper_spec.rb
@@ -0,0 +1,14 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the SecretsHelper. For example:
+#
+# describe SecretsHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe SecretsHelper, type: :helper do
+end
diff --git a/harshilp/rails/DojoSecrets/spec/helpers/sessions_helper_spec.rb b/harshilp/rails/DojoSecrets/spec/helpers/sessions_helper_spec.rb
new file mode 100644
index 0000000..38c13fc
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/helpers/sessions_helper_spec.rb
@@ -0,0 +1,14 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the SessionsHelper. For example:
+#
+# describe SessionsHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe SessionsHelper, type: :helper do
+end
diff --git a/harshilp/rails/DojoSecrets/spec/helpers/users_helper_spec.rb b/harshilp/rails/DojoSecrets/spec/helpers/users_helper_spec.rb
new file mode 100644
index 0000000..890768c
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/helpers/users_helper_spec.rb
@@ -0,0 +1,14 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the UsersHelper. For example:
+#
+# describe UsersHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe UsersHelper, type: :helper do
+end
diff --git a/harshilp/rails/DojoSecrets/spec/models/like_spec.rb b/harshilp/rails/DojoSecrets/spec/models/like_spec.rb
new file mode 100644
index 0000000..d733808
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/models/like_spec.rb
@@ -0,0 +1,17 @@
+require 'rails_helper'
+
+RSpec.describe Like, type: :model do
+ describe 'relationships' do
+ before do
+ @user = create(:user)
+ @secret = create(:secret, user: @user)
+ @like = create(:like, user: @user, secret: @secret)
+ end
+ it 'belongs to a user' do
+ expect(@like.user).to eq(@user)
+ end
+ it 'belongs to a secret' do
+ expect(@like.secret).to eq(@secret)
+ end
+ end
+end
diff --git a/harshilp/rails/DojoSecrets/spec/models/secret_spec.rb b/harshilp/rails/DojoSecrets/spec/models/secret_spec.rb
new file mode 100644
index 0000000..dbc7a61
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/models/secret_spec.rb
@@ -0,0 +1,23 @@
+require 'rails_helper'
+
+RSpec.describe Secret, type: :model do
+ it 'requires content' do
+ expect(build(:secret, content: "")).to be_invalid
+ end
+ context 'relationships' do
+ before do
+ @user = create(:user)
+ @secret = create(:secret, user: @user)
+ @like = create(:like, user: @user, secret: @secret)
+ end
+ it 'belongs to a user' do
+ expect(@secret.user).to eq(@user)
+ end
+ it 'has likes' do
+ expect(@secret.likes).to include(@like)
+ end
+ it 'has users through likes table' do
+ expect(@secret.users).to include(@user)
+ end
+ end
+end
diff --git a/harshilp/rails/DojoSecrets/spec/models/user_spec.rb b/harshilp/rails/DojoSecrets/spec/models/user_spec.rb
new file mode 100644
index 0000000..35ca09d
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/models/user_spec.rb
@@ -0,0 +1,54 @@
+require 'rails_helper'
+RSpec.describe User, type: :model do
+ context "with valid attributes" do
+ it "should save" do
+ expect(build(:user)).to be_valid
+ end
+ it 'automatically encrypts the password into the password_digest attribute' do
+ expect(build(:user).password_digest.present?).to eq(true)
+ end
+ it 'email as lowercase' do
+ expect(create(:user, email: 'EMAIL@GMAIL.COM').email).to eq('email@gmail.com')
+ end
+ end
+ context "with invalid attributes should not save if" do
+ it 'name is blank' do
+ expect(build(:user, name: '')).to be_invalid
+ end
+ it 'email is blank' do
+ expect(build(:user, email: '')).to be_invalid
+ end
+ it 'email format is wrong' do
+ emails = %w[@ user@ @example.com]
+ emails.each do |email|
+ expect(build(:user, email: email)).to be_invalid
+ end
+ end
+ it 'email is not unique' do
+ create(:user)
+ expect(build(:user)).to be_invalid
+ end
+ it 'password is blank' do
+ expect(build(:user, password: '')).to be_invalid
+ end
+ it "password doesn't match password_confirmation" do
+ expect(build(:user, password_confirmation: 'notpassword')).to be_invalid
+ end
+ end
+ context 'relationships' do
+ before do
+ @user = create(:user)
+ @secret = create(:secret, user: @user)
+ @like = create(:like, secret: @secret, user: @user)
+ end
+ it 'has secrets' do
+ expect(@user.secrets).to include(@secret)
+ end
+ it 'has likes' do
+ expect(@user.likes).to include(@like)
+ end
+ it "has secrets through likes table" do
+ expect(@user.secrets_liked).to include(@secret)
+ end
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails/DojoSecrets/spec/rails_helper.rb b/harshilp/rails/DojoSecrets/spec/rails_helper.rb
new file mode 100644
index 0000000..c136077
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/rails_helper.rb
@@ -0,0 +1,58 @@
+# This file is copied to spec/ when you run 'rails generate rspec:install'
+require 'spec_helper'
+require 'factory_bot_rails'
+ENV['RAILS_ENV'] ||= 'test'
+require File.expand_path('../../config/environment', __FILE__)
+# Prevent database truncation if the environment is production
+abort("The Rails environment is running in production mode!") if Rails.env.production?
+require 'rspec/rails'
+# Add additional requires below this line. Rails is not loaded until this point!
+
+# Requires supporting ruby files with custom matchers and macros, etc, in
+# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
+# run as spec files by default. This means that files in spec/support that end
+# in _spec.rb will both be required and run as specs, causing the specs to be
+# run twice. It is recommended that you do not name files matching this glob to
+# end with _spec.rb. You can configure this pattern with the --pattern
+# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
+#
+# The following line is provided for convenience purposes. It has the downside
+# of increasing the boot-up time by auto-requiring all files in the support
+# directory. Alternatively, in the individual `*_spec.rb` files, manually
+# require only the support files necessary.
+#
+# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
+
+# Checks for pending migrations and applies them before tests are run.
+# If you are not using ActiveRecord, you can remove this line.
+ActiveRecord::Migration.maintain_test_schema!
+
+RSpec.configure do |config|
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+ config.include FactoryBot::Syntax::Methods
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+
+ # RSpec Rails can automatically mix in different behaviours to your tests
+ # based on their file location, for example enabling you to call `get` and
+ # `post` in specs under `spec/controllers`.
+ #
+ # You can disable this behaviour by removing the line below, and instead
+ # explicitly tag your specs with their type, e.g.:
+ #
+ # RSpec.describe UsersController, :type => :controller do
+ # # ...
+ # end
+ #
+ # The different available types are documented in the features, such as in
+ # https://relishapp.com/rspec/rspec-rails/docs
+ config.infer_spec_type_from_file_location!
+
+ # Filter lines from Rails gems in backtraces.
+ config.filter_rails_from_backtrace!
+ # arbitrary gems may also be filtered via:
+ # config.filter_gems_from_backtrace("gem name")
+end
diff --git a/harshilp/rails/DojoSecrets/spec/spec_helper.rb b/harshilp/rails/DojoSecrets/spec/spec_helper.rb
new file mode 100644
index 0000000..66511e1
--- /dev/null
+++ b/harshilp/rails/DojoSecrets/spec/spec_helper.rb
@@ -0,0 +1,115 @@
+# This file was generated by the `rails generate rspec:install` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# The generated `.rspec` file contains `--require spec_helper` which will cause
+# this file to always be loaded, without a need to explicitly require it in any
+# files.
+#
+# Given that it is always loaded, you are encouraged to keep this file as
+# light-weight as possible. Requiring heavyweight dependencies from this file
+# will add to the boot time of your test suite on EVERY test run, even for an
+# individual file that may not need all of that loaded. Instead, consider making
+# a separate helper file that requires the additional dependencies and performs
+# the additional setup, and require it from the spec files that actually need
+# it.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+
+def log_in email: "harshilp@uw.edu", password: "password"
+ visit login_path unless current_path == login_path
+ fill_in 'email', with: email
+ fill_in 'password', with: password
+ click_button 'Log In'
+end
+
+def register name: 'Harshil Patel', email: "harshilp@uw.edu", password: "password", password_confirmation: "password"
+ visit new_user_path unless current_path == new_user_path
+ fill_in 'name', with: name
+ fill_in 'email', with: email
+ fill_in 'password', with: password
+ fill_in 'password_confirmation', with: password_confirmation
+ click_button 'Register'
+end
+
+
+
+RSpec.configure do |config|
+ # rspec-expectations config goes here. You can use an alternate
+ # assertion/expectation library such as wrong or the stdlib/minitest
+ # assertions if you prefer.
+ config.expect_with :rspec do |expectations|
+ # This option will default to `true` in RSpec 4. It makes the `description`
+ # and `failure_message` of custom matchers include text for helper methods
+ # defined using `chain`, e.g.:
+ # be_bigger_than(2).and_smaller_than(4).description
+ # # => "be bigger than 2 and smaller than 4"
+ # ...rather than:
+ # # => "be bigger than 2"
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
+ end
+
+ # rspec-mocks config goes here. You can use an alternate test double
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
+ config.mock_with :rspec do |mocks|
+ # Prevents you from mocking or stubbing a method that does not exist on
+ # a real object. This is generally recommended, and will default to
+ # `true` in RSpec 4.
+ mocks.verify_partial_doubles = true
+ end
+
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
+ # have no way to turn it off -- the option exists only for backwards
+ # compatibility in RSpec 3). It causes shared context metadata to be
+ # inherited by the metadata hash of host groups and examples, rather than
+ # triggering implicit auto-inclusion in groups with matching metadata.
+ config.shared_context_metadata_behavior = :apply_to_host_groups
+
+# The settings below are suggested to provide a good initial experience
+# with RSpec, but feel free to customize to your heart's content.
+=begin
+ # This allows you to limit a spec run to individual examples or groups
+ # you care about by tagging them with `:focus` metadata. When nothing
+ # is tagged with `:focus`, all examples get run. RSpec also provides
+ # aliases for `it`, `describe`, and `context` that include `:focus`
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
+ config.filter_run_when_matching :focus
+
+ # Allows RSpec to persist some state between runs in order to support
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
+ # you configure your source control system to ignore this file.
+ config.example_status_persistence_file_path = "spec/examples.txt"
+
+ # Limits the available syntax to the non-monkey patched syntax that is
+ # recommended. For more details, see:
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
+ config.disable_monkey_patching!
+
+ # Many RSpec users commonly either run the entire suite or an individual
+ # file, and it's useful to allow more verbose output when running an
+ # individual spec file.
+ if config.files_to_run.one?
+ # Use the documentation formatter for detailed output,
+ # unless a formatter has already been configured
+ # (e.g. via a command-line flag).
+ config.default_formatter = "doc"
+ end
+
+ # Print the 10 slowest examples and example groups at the
+ # end of the spec run, to help surface which specs are running
+ # particularly slow.
+ config.profile_examples = 10
+
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = :random
+
+ # Seed global randomization in this process using the `--seed` CLI option.
+ # Setting this allows you to use `--seed` to deterministically reproduce
+ # test failures related to randomization by passing the same `--seed` value
+ # as the one that triggered the failure.
+ Kernel.srand config.seed
+=end
+end
diff --git a/harshilp/rails/DojoSecrets/vendor/assets/javascripts/.keep b/harshilp/rails/DojoSecrets/vendor/assets/javascripts/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails/DojoSecrets/vendor/assets/stylesheets/.keep b/harshilp/rails/DojoSecrets/vendor/assets/stylesheets/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/factoryTesting/.gitignore b/harshilp/rails_tdd/factoryTesting/.gitignore
new file mode 100644
index 0000000..050c9d9
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/.gitignore
@@ -0,0 +1,17 @@
+# See https://help.github.com/articles/ignoring-files for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile '~/.gitignore_global'
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore the default SQLite database.
+/db/*.sqlite3
+/db/*.sqlite3-journal
+
+# Ignore all logfiles and tempfiles.
+/log/*
+!/log/.keep
+/tmp
diff --git a/harshilp/rails_tdd/factoryTesting/.rspec b/harshilp/rails_tdd/factoryTesting/.rspec
new file mode 100644
index 0000000..c99d2e7
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/.rspec
@@ -0,0 +1 @@
+--require spec_helper
diff --git a/harshilp/rails_tdd/factoryTesting/Gemfile b/harshilp/rails_tdd/factoryTesting/Gemfile
new file mode 100644
index 0000000..cfe733c
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/Gemfile
@@ -0,0 +1,50 @@
+source 'https://rubygems.org'
+
+
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
+gem 'rails', '4.2.7'
+# Use sqlite3 as the database for Active Record
+gem 'sqlite3'
+# Use SCSS for stylesheets
+gem 'sass-rails', '~> 5.0'
+# Use Uglifier as compressor for JavaScript assets
+gem 'uglifier', '>= 1.3.0'
+# Use CoffeeScript for .coffee assets and views
+gem 'coffee-rails', '~> 4.1.0'
+# See https://github.com/rails/execjs#readme for more supported runtimes
+# gem 'therubyracer', platforms: :ruby
+
+# Use jquery as the JavaScript library
+gem 'jquery-rails'
+# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
+gem 'turbolinks'
+# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
+gem 'jbuilder', '~> 2.0'
+# bundle exec rake doc:rails generates the API under doc/api.
+gem 'sdoc', '~> 0.4.0', group: :doc
+
+# Use ActiveModel has_secure_password
+# gem 'bcrypt', '~> 3.1.7'
+
+# Use Unicorn as the app server
+# gem 'unicorn'
+
+# Use Capistrano for deployment
+# gem 'capistrano-rails', group: :development
+
+group :development, :test do
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
+ gem 'rspec-rails'
+ gem 'factory_girl_rails'
+ gem 'capybara'
+ gem 'byebug'
+end
+
+group :development do
+ # Access an IRB console on exception pages or by using <%= console %> in views
+ gem 'web-console', '~> 2.0'
+
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
+ gem 'spring'
+end
+
diff --git a/harshilp/rails_tdd/factoryTesting/Gemfile.lock b/harshilp/rails_tdd/factoryTesting/Gemfile.lock
new file mode 100644
index 0000000..ae46d10
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/Gemfile.lock
@@ -0,0 +1,208 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (4.2.7)
+ actionpack (= 4.2.7)
+ actionview (= 4.2.7)
+ activejob (= 4.2.7)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ actionpack (4.2.7)
+ actionview (= 4.2.7)
+ activesupport (= 4.2.7)
+ rack (~> 1.6)
+ rack-test (~> 0.6.2)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (4.2.7)
+ activesupport (= 4.2.7)
+ builder (~> 3.1)
+ erubis (~> 2.7.0)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ activejob (4.2.7)
+ activesupport (= 4.2.7)
+ globalid (>= 0.3.0)
+ activemodel (4.2.7)
+ activesupport (= 4.2.7)
+ builder (~> 3.1)
+ activerecord (4.2.7)
+ activemodel (= 4.2.7)
+ activesupport (= 4.2.7)
+ arel (~> 6.0)
+ activesupport (4.2.7)
+ i18n (~> 0.7)
+ json (~> 1.7, >= 1.7.7)
+ minitest (~> 5.1)
+ thread_safe (~> 0.3, >= 0.3.4)
+ tzinfo (~> 1.1)
+ addressable (2.5.2)
+ public_suffix (>= 2.0.2, < 4.0)
+ arel (6.0.4)
+ binding_of_caller (0.7.3)
+ debug_inspector (>= 0.0.1)
+ builder (3.2.3)
+ byebug (9.1.0)
+ capybara (2.16.1)
+ addressable
+ mini_mime (>= 0.1.3)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ xpath (~> 2.0)
+ coffee-rails (4.1.1)
+ coffee-script (>= 2.2.0)
+ railties (>= 4.0.0, < 5.1.x)
+ coffee-script (2.4.1)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.12.2)
+ concurrent-ruby (1.0.5)
+ crass (1.0.3)
+ debug_inspector (0.0.3)
+ diff-lcs (1.3)
+ erubis (2.7.0)
+ execjs (2.7.0)
+ factory_girl (4.9.0)
+ activesupport (>= 3.0.0)
+ factory_girl_rails (4.9.0)
+ factory_girl (~> 4.9.0)
+ railties (>= 3.0.0)
+ ffi (1.9.18)
+ globalid (0.4.1)
+ activesupport (>= 4.2.0)
+ i18n (0.9.1)
+ concurrent-ruby (~> 1.0)
+ jbuilder (2.7.0)
+ activesupport (>= 4.2.0)
+ multi_json (>= 1.2)
+ jquery-rails (4.3.1)
+ rails-dom-testing (>= 1, < 3)
+ railties (>= 4.2.0)
+ thor (>= 0.14, < 2.0)
+ json (1.8.6)
+ loofah (2.1.1)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.5.9)
+ mail (2.7.0)
+ mini_mime (>= 0.1.1)
+ mini_mime (1.0.0)
+ mini_portile2 (2.3.0)
+ minitest (5.10.3)
+ multi_json (1.12.2)
+ nokogiri (1.8.1)
+ mini_portile2 (~> 2.3.0)
+ public_suffix (3.0.1)
+ rack (1.6.8)
+ rack-test (0.6.3)
+ rack (>= 1.0)
+ rails (4.2.7)
+ actionmailer (= 4.2.7)
+ actionpack (= 4.2.7)
+ actionview (= 4.2.7)
+ activejob (= 4.2.7)
+ activemodel (= 4.2.7)
+ activerecord (= 4.2.7)
+ activesupport (= 4.2.7)
+ bundler (>= 1.3.0, < 2.0)
+ railties (= 4.2.7)
+ sprockets-rails
+ rails-deprecated_sanitizer (1.0.3)
+ activesupport (>= 4.2.0.alpha)
+ rails-dom-testing (1.0.8)
+ activesupport (>= 4.2.0.beta, < 5.0)
+ nokogiri (~> 1.6)
+ rails-deprecated_sanitizer (>= 1.0.1)
+ rails-html-sanitizer (1.0.3)
+ loofah (~> 2.0)
+ railties (4.2.7)
+ actionpack (= 4.2.7)
+ activesupport (= 4.2.7)
+ rake (>= 0.8.7)
+ thor (>= 0.18.1, < 2.0)
+ rake (12.3.0)
+ rb-fsevent (0.10.2)
+ rb-inotify (0.9.10)
+ ffi (>= 0.5.0, < 2)
+ rdoc (4.3.0)
+ rspec-core (3.7.0)
+ rspec-support (~> 3.7.0)
+ rspec-expectations (3.7.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.7.0)
+ rspec-mocks (3.7.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.7.0)
+ rspec-rails (3.7.2)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec-core (~> 3.7.0)
+ rspec-expectations (~> 3.7.0)
+ rspec-mocks (~> 3.7.0)
+ rspec-support (~> 3.7.0)
+ rspec-support (3.7.0)
+ sass (3.5.3)
+ sass-listen (~> 4.0.0)
+ sass-listen (4.0.0)
+ rb-fsevent (~> 0.9, >= 0.9.4)
+ rb-inotify (~> 0.9, >= 0.9.7)
+ sass-rails (5.0.7)
+ railties (>= 4.0.0, < 6)
+ sass (~> 3.1)
+ sprockets (>= 2.8, < 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+ tilt (>= 1.1, < 3)
+ sdoc (0.4.2)
+ json (~> 1.7, >= 1.7.7)
+ rdoc (~> 4.0)
+ spring (2.0.2)
+ activesupport (>= 4.2)
+ sprockets (3.7.1)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.2.1)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
+ sqlite3 (1.3.13)
+ thor (0.20.0)
+ thread_safe (0.3.6)
+ tilt (2.0.8)
+ turbolinks (5.0.1)
+ turbolinks-source (~> 5)
+ turbolinks-source (5.0.3)
+ tzinfo (1.2.4)
+ thread_safe (~> 0.1)
+ uglifier (4.0.1)
+ execjs (>= 0.3.0, < 3)
+ web-console (2.3.0)
+ activemodel (>= 4.0)
+ binding_of_caller (>= 0.7.2)
+ railties (>= 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+ xpath (2.1.0)
+ nokogiri (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ byebug
+ capybara
+ coffee-rails (~> 4.1.0)
+ factory_girl_rails
+ jbuilder (~> 2.0)
+ jquery-rails
+ rails (= 4.2.7)
+ rspec-rails
+ sass-rails (~> 5.0)
+ sdoc (~> 0.4.0)
+ spring
+ sqlite3
+ turbolinks
+ uglifier (>= 1.3.0)
+ web-console (~> 2.0)
+
+BUNDLED WITH
+ 1.16.0
diff --git a/harshilp/rails_tdd/factoryTesting/README.rdoc b/harshilp/rails_tdd/factoryTesting/README.rdoc
new file mode 100644
index 0000000..dd4e97e
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/README.rdoc
@@ -0,0 +1,28 @@
+== README
+
+This README would normally document whatever steps are necessary to get the
+application up and running.
+
+Things you may want to cover:
+
+* Ruby version
+
+* System dependencies
+
+* Configuration
+
+* Database creation
+
+* Database initialization
+
+* How to run the test suite
+
+* Services (job queues, cache servers, search engines, etc.)
+
+* Deployment instructions
+
+* ...
+
+
+Please feel free to use a different markup language if you do not plan to run
+rake doc:app.
diff --git a/harshilp/rails_tdd/factoryTesting/Rakefile b/harshilp/rails_tdd/factoryTesting/Rakefile
new file mode 100644
index 0000000..ba6b733
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/Rakefile
@@ -0,0 +1,6 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+Rails.application.load_tasks
diff --git a/harshilp/rails_tdd/factoryTesting/app/assets/images/.keep b/harshilp/rails_tdd/factoryTesting/app/assets/images/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/factoryTesting/app/assets/javascripts/application.js b/harshilp/rails_tdd/factoryTesting/app/assets/javascripts/application.js
new file mode 100644
index 0000000..e07c5a8
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/app/assets/javascripts/application.js
@@ -0,0 +1,16 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// compiled file.
+//
+// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
+// about supported directives.
+//
+//= require jquery
+//= require jquery_ujs
+//= require turbolinks
+//= require_tree .
diff --git a/harshilp/rails_tdd/factoryTesting/app/assets/javascripts/users.coffee b/harshilp/rails_tdd/factoryTesting/app/assets/javascripts/users.coffee
new file mode 100644
index 0000000..24f83d1
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/app/assets/javascripts/users.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/harshilp/rails_tdd/factoryTesting/app/assets/stylesheets/application.css b/harshilp/rails_tdd/factoryTesting/app/assets/stylesheets/application.css
new file mode 100644
index 0000000..f9cd5b3
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/app/assets/stylesheets/application.css
@@ -0,0 +1,15 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
+ * compiled file so the styles you add here take precedence over styles defined in any styles
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
+ * file per style scope.
+ *
+ *= require_tree .
+ *= require_self
+ */
diff --git a/harshilp/rails_tdd/factoryTesting/app/assets/stylesheets/users.scss b/harshilp/rails_tdd/factoryTesting/app/assets/stylesheets/users.scss
new file mode 100644
index 0000000..31a2eac
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/app/assets/stylesheets/users.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Users controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/harshilp/rails_tdd/factoryTesting/app/controllers/application_controller.rb b/harshilp/rails_tdd/factoryTesting/app/controllers/application_controller.rb
new file mode 100644
index 0000000..d83690e
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/app/controllers/application_controller.rb
@@ -0,0 +1,5 @@
+class ApplicationController < ActionController::Base
+ # Prevent CSRF attacks by raising an exception.
+ # For APIs, you may want to use :null_session instead.
+ protect_from_forgery with: :exception
+end
diff --git a/harshilp/rails_tdd/factoryTesting/app/controllers/concerns/.keep b/harshilp/rails_tdd/factoryTesting/app/controllers/concerns/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/factoryTesting/app/controllers/users_controller.rb b/harshilp/rails_tdd/factoryTesting/app/controllers/users_controller.rb
new file mode 100644
index 0000000..10c58ca
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/app/controllers/users_controller.rb
@@ -0,0 +1,16 @@
+class UsersController < ApplicationController
+ def new
+ end
+ def create
+ @user = User.new(params.require(:user).permit(:first_name, :last_name, :email))
+ if @user.save
+ flash[:notice] = ["Welcome, #{@user.first_name}"]
+ redirect_to user_path(@user.id)
+ else
+ flash[:errors] = @user.errors.full_messages
+ redirect_to new_user_path
+ end
+ end
+ def show
+ end
+end
diff --git a/harshilp/rails_tdd/factoryTesting/app/helpers/application_helper.rb b/harshilp/rails_tdd/factoryTesting/app/helpers/application_helper.rb
new file mode 100644
index 0000000..de6be79
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/harshilp/rails_tdd/factoryTesting/app/helpers/users_helper.rb b/harshilp/rails_tdd/factoryTesting/app/helpers/users_helper.rb
new file mode 100644
index 0000000..2310a24
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/app/helpers/users_helper.rb
@@ -0,0 +1,2 @@
+module UsersHelper
+end
diff --git a/harshilp/rails_tdd/factoryTesting/app/mailers/.keep b/harshilp/rails_tdd/factoryTesting/app/mailers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/factoryTesting/app/models/.keep b/harshilp/rails_tdd/factoryTesting/app/models/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/factoryTesting/app/models/concerns/.keep b/harshilp/rails_tdd/factoryTesting/app/models/concerns/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/factoryTesting/app/models/user.rb b/harshilp/rails_tdd/factoryTesting/app/models/user.rb
new file mode 100644
index 0000000..d7dcd84
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/app/models/user.rb
@@ -0,0 +1,5 @@
+class User < ActiveRecord::Base
+ EMAIL_REGEX = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]+)\z/i
+ validates :first_name, :last_name, :email, presence: true
+ validates :email, uniqueness: { case_sensitive: false }, format: {with: EMAIL_REGEX}
+end
diff --git a/harshilp/rails_tdd/factoryTesting/app/views/layouts/application.html.erb b/harshilp/rails_tdd/factoryTesting/app/views/layouts/application.html.erb
new file mode 100644
index 0000000..d8abd91
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/app/views/layouts/application.html.erb
@@ -0,0 +1,14 @@
+
+
+
+ FactoryTesting
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
+ <%= csrf_meta_tags %>
+
+
+
+<%= yield %>
+
+
+
diff --git a/harshilp/rails_tdd/factoryTesting/app/views/users/new.html.erb b/harshilp/rails_tdd/factoryTesting/app/views/users/new.html.erb
new file mode 100644
index 0000000..7b41d96
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/app/views/users/new.html.erb
@@ -0,0 +1,16 @@
+
Create new User
+
\ No newline at end of file
diff --git a/harshilp/rails_tdd/factoryTesting/app/views/users/show.html.erb b/harshilp/rails_tdd/factoryTesting/app/views/users/show.html.erb
new file mode 100644
index 0000000..2db23d1
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/app/views/users/show.html.erb
@@ -0,0 +1,5 @@
+<% if flash[:notice] %>
+ <% flash[:notice].each do |note| %>
+
<%= note %>
+ <% end %>
+<% end %>
\ No newline at end of file
diff --git a/harshilp/rails_tdd/factoryTesting/bin/bundle b/harshilp/rails_tdd/factoryTesting/bin/bundle
new file mode 100644
index 0000000..66e9889
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/bin/bundle
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+load Gem.bin_path('bundler', 'bundle')
diff --git a/harshilp/rails_tdd/factoryTesting/bin/rails b/harshilp/rails_tdd/factoryTesting/bin/rails
new file mode 100644
index 0000000..0138d79
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/bin/rails
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path('../spring', __FILE__)
+rescue LoadError => e
+ raise unless e.message.include?('spring')
+end
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require_relative '../config/boot'
+require 'rails/commands'
diff --git a/harshilp/rails_tdd/factoryTesting/bin/rake b/harshilp/rails_tdd/factoryTesting/bin/rake
new file mode 100644
index 0000000..d87d5f5
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/bin/rake
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path('../spring', __FILE__)
+rescue LoadError => e
+ raise unless e.message.include?('spring')
+end
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run
diff --git a/harshilp/rails_tdd/factoryTesting/bin/setup b/harshilp/rails_tdd/factoryTesting/bin/setup
new file mode 100644
index 0000000..acdb2c1
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/bin/setup
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+Dir.chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file:
+
+ puts "== Installing dependencies =="
+ system "gem install bundler --conservative"
+ system "bundle check || bundle install"
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?("config/database.yml")
+ # system "cp config/database.yml.sample config/database.yml"
+ # end
+
+ puts "\n== Preparing database =="
+ system "bin/rake db:setup"
+
+ puts "\n== Removing old logs and tempfiles =="
+ system "rm -f log/*"
+ system "rm -rf tmp/cache"
+
+ puts "\n== Restarting application server =="
+ system "touch tmp/restart.txt"
+end
diff --git a/harshilp/rails_tdd/factoryTesting/bin/spring b/harshilp/rails_tdd/factoryTesting/bin/spring
new file mode 100644
index 0000000..fb2ec2e
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/bin/spring
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+
+# This file loads spring without using Bundler, in order to be fast.
+# It gets overwritten when you run the `spring binstub` command.
+
+unless defined?(Spring)
+ require 'rubygems'
+ require 'bundler'
+
+ lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
+ spring = lockfile.specs.detect { |spec| spec.name == "spring" }
+ if spring
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
+ gem 'spring', spring.version
+ require 'spring/binstub'
+ end
+end
diff --git a/harshilp/rails_tdd/factoryTesting/config.ru b/harshilp/rails_tdd/factoryTesting/config.ru
new file mode 100644
index 0000000..bd83b25
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Rails.application
diff --git a/harshilp/rails_tdd/factoryTesting/config/application.rb b/harshilp/rails_tdd/factoryTesting/config/application.rb
new file mode 100644
index 0000000..72d9de6
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/application.rb
@@ -0,0 +1,35 @@
+require File.expand_path('../boot', __FILE__)
+
+require "rails"
+# Pick the frameworks you want:
+require "active_model/railtie"
+require "active_job/railtie"
+require "active_record/railtie"
+require "action_controller/railtie"
+require "action_mailer/railtie"
+require "action_view/railtie"
+require "sprockets/railtie"
+# require "rails/test_unit/railtie"
+
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
+
+module FactoryTesting
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # Do not swallow errors in after_commit/after_rollback callbacks.
+ config.active_record.raise_in_transactional_callbacks = true
+ end
+end
diff --git a/harshilp/rails_tdd/factoryTesting/config/boot.rb b/harshilp/rails_tdd/factoryTesting/config/boot.rb
new file mode 100644
index 0000000..6b750f0
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/boot.rb
@@ -0,0 +1,3 @@
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' # Set up gems listed in the Gemfile.
diff --git a/harshilp/rails_tdd/factoryTesting/config/database.yml b/harshilp/rails_tdd/factoryTesting/config/database.yml
new file mode 100644
index 0000000..1c1a37c
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/database.yml
@@ -0,0 +1,25 @@
+# SQLite version 3.x
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem 'sqlite3'
+#
+default: &default
+ adapter: sqlite3
+ pool: 5
+ timeout: 5000
+
+development:
+ <<: *default
+ database: db/development.sqlite3
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ <<: *default
+ database: db/test.sqlite3
+
+production:
+ <<: *default
+ database: db/production.sqlite3
diff --git a/harshilp/rails_tdd/factoryTesting/config/environment.rb b/harshilp/rails_tdd/factoryTesting/config/environment.rb
new file mode 100644
index 0000000..ee8d90d
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the Rails application.
+require File.expand_path('../application', __FILE__)
+
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/harshilp/rails_tdd/factoryTesting/config/environments/development.rb b/harshilp/rails_tdd/factoryTesting/config/environments/development.rb
new file mode 100644
index 0000000..b55e214
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/environments/development.rb
@@ -0,0 +1,41 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.cache_classes = false
+
+ # Do not eager load code on boot.
+ config.eager_load = false
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send.
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger.
+ config.active_support.deprecation = :log
+
+ # Raise an error on page load if there are pending migrations.
+ config.active_record.migration_error = :page_load
+
+ # Debug mode disables concatenation and preprocessing of assets.
+ # This option may cause significant delays in view rendering with a large
+ # number of complex assets.
+ config.assets.debug = true
+
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
+ config.assets.digest = true
+
+ # Adds additional error checking when serving assets at runtime.
+ # Checks for improperly declared sprockets dependencies.
+ # Raises helpful error messages.
+ config.assets.raise_runtime_errors = true
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
+end
diff --git a/harshilp/rails_tdd/factoryTesting/config/environments/production.rb b/harshilp/rails_tdd/factoryTesting/config/environments/production.rb
new file mode 100644
index 0000000..5c1b32e
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/environments/production.rb
@@ -0,0 +1,79 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Code is not reloaded between requests.
+ config.cache_classes = true
+
+ # Eager load code on boot. This eager loads most of Rails and
+ # your application in memory, allowing both threaded web servers
+ # and those relying on copy on write to perform better.
+ # Rake tasks automatically ignore this option for performance.
+ config.eager_load = true
+
+ # Full error reports are disabled and caching is turned on.
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
+ # Add `rack-cache` to your Gemfile before enabling this.
+ # For large-scale production use, consider using a caching reverse proxy like
+ # NGINX, varnish or squid.
+ # config.action_dispatch.rack_cache = true
+
+ # Disable serving static files from the `/public` folder by default since
+ # Apache or NGINX already handles this.
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
+
+ # Compress JavaScripts and CSS.
+ config.assets.js_compressor = :uglifier
+ # config.assets.css_compressor = :sass
+
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
+ config.assets.compile = false
+
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
+ config.assets.digest = true
+
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
+
+ # Specifies the header that your server uses for sending files.
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
+
+ # Use the lowest log level to ensure availability of diagnostic information
+ # when problems arise.
+ config.log_level = :debug
+
+ # Prepend all log lines with the following tags.
+ # config.log_tags = [ :subdomain, :uuid ]
+
+ # Use a different logger for distributed setups.
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
+
+ # Use a different cache store in production.
+ # config.cache_store = :mem_cache_store
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.action_controller.asset_host = 'http://assets.example.com'
+
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners.
+ config.active_support.deprecation = :notify
+
+ # Use default logging formatter so that PID and timestamp are not suppressed.
+ config.log_formatter = ::Logger::Formatter.new
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+end
diff --git a/harshilp/rails_tdd/factoryTesting/config/environments/test.rb b/harshilp/rails_tdd/factoryTesting/config/environments/test.rb
new file mode 100644
index 0000000..1c19f08
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/environments/test.rb
@@ -0,0 +1,42 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
+
+ # Do not eager load code on boot. This avoids loading your whole application
+ # just for the purpose of running a single test. If you are using a tool that
+ # preloads Rails for running tests, you may have to set it to true.
+ config.eager_load = false
+
+ # Configure static file server for tests with Cache-Control for performance.
+ config.serve_static_files = true
+ config.static_cache_control = 'public, max-age=3600'
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Raise exceptions instead of rendering exception templates.
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Randomize the order test cases are executed.
+ config.active_support.test_order = :random
+
+ # Print deprecation notices to the stderr.
+ config.active_support.deprecation = :stderr
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
+end
diff --git a/harshilp/rails_tdd/factoryTesting/config/initializers/assets.rb b/harshilp/rails_tdd/factoryTesting/config/initializers/assets.rb
new file mode 100644
index 0000000..01ef3e6
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/initializers/assets.rb
@@ -0,0 +1,11 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = '1.0'
+
+# Add additional assets to the asset load path
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
+# Rails.application.config.assets.precompile += %w( search.js )
diff --git a/harshilp/rails_tdd/factoryTesting/config/initializers/backtrace_silencers.rb b/harshilp/rails_tdd/factoryTesting/config/initializers/backtrace_silencers.rb
new file mode 100644
index 0000000..59385cd
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/initializers/backtrace_silencers.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
diff --git a/harshilp/rails_tdd/factoryTesting/config/initializers/cookies_serializer.rb b/harshilp/rails_tdd/factoryTesting/config/initializers/cookies_serializer.rb
new file mode 100644
index 0000000..7f70458
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/initializers/cookies_serializer.rb
@@ -0,0 +1,3 @@
+# Be sure to restart your server when you modify this file.
+
+Rails.application.config.action_dispatch.cookies_serializer = :json
diff --git a/harshilp/rails_tdd/factoryTesting/config/initializers/filter_parameter_logging.rb b/harshilp/rails_tdd/factoryTesting/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 0000000..4a994e1
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,4 @@
+# Be sure to restart your server when you modify this file.
+
+# Configure sensitive parameters which will be filtered from the log file.
+Rails.application.config.filter_parameters += [:password]
diff --git a/harshilp/rails_tdd/factoryTesting/config/initializers/inflections.rb b/harshilp/rails_tdd/factoryTesting/config/initializers/inflections.rb
new file mode 100644
index 0000000..ac033bf
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/initializers/inflections.rb
@@ -0,0 +1,16 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.plural /^(ox)$/i, '\1en'
+# inflect.singular /^(ox)en/i, '\1'
+# inflect.irregular 'person', 'people'
+# inflect.uncountable %w( fish sheep )
+# end
+
+# These inflection rules are supported but not enabled by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.acronym 'RESTful'
+# end
diff --git a/harshilp/rails_tdd/factoryTesting/config/initializers/mime_types.rb b/harshilp/rails_tdd/factoryTesting/config/initializers/mime_types.rb
new file mode 100644
index 0000000..dc18996
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/initializers/mime_types.rb
@@ -0,0 +1,4 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
diff --git a/harshilp/rails_tdd/factoryTesting/config/initializers/session_store.rb b/harshilp/rails_tdd/factoryTesting/config/initializers/session_store.rb
new file mode 100644
index 0000000..8c47de7
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/initializers/session_store.rb
@@ -0,0 +1,3 @@
+# Be sure to restart your server when you modify this file.
+
+Rails.application.config.session_store :cookie_store, key: '_factoryTesting_session'
diff --git a/harshilp/rails_tdd/factoryTesting/config/initializers/wrap_parameters.rb b/harshilp/rails_tdd/factoryTesting/config/initializers/wrap_parameters.rb
new file mode 100644
index 0000000..33725e9
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/initializers/wrap_parameters.rb
@@ -0,0 +1,14 @@
+# Be sure to restart your server when you modify this file.
+
+# This file contains settings for ActionController::ParamsWrapper which
+# is enabled by default.
+
+# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
+ActiveSupport.on_load(:action_controller) do
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
+end
+
+# To enable root element in JSON for ActiveRecord objects.
+# ActiveSupport.on_load(:active_record) do
+# self.include_root_in_json = true
+# end
diff --git a/harshilp/rails_tdd/factoryTesting/config/locales/en.yml b/harshilp/rails_tdd/factoryTesting/config/locales/en.yml
new file mode 100644
index 0000000..0653957
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/locales/en.yml
@@ -0,0 +1,23 @@
+# Files in the config/locales directory are used for internationalization
+# and are automatically loaded by Rails. If you want to use locales other
+# than English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t 'hello'
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t('hello') %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# To learn more, please read the Rails Internationalization guide
+# available at http://guides.rubyonrails.org/i18n.html.
+
+en:
+ hello: "Hello world"
diff --git a/harshilp/rails_tdd/factoryTesting/config/routes.rb b/harshilp/rails_tdd/factoryTesting/config/routes.rb
new file mode 100644
index 0000000..3cfaf1c
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/routes.rb
@@ -0,0 +1,57 @@
+Rails.application.routes.draw do
+ resources :users
+ # The priority is based upon order of creation: first created -> highest priority.
+ # See how all your routes lay out with "rake routes".
+
+ # You can have the root of your site routed with "root"
+ # root 'welcome#index'
+
+ # Example of regular route:
+ # get 'products/:id' => 'catalog#view'
+
+ # Example of named route that can be invoked with purchase_url(id: product.id)
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
+
+ # Example resource route (maps HTTP verbs to controller actions automatically):
+ # resources :products
+
+ # Example resource route with options:
+ # resources :products do
+ # member do
+ # get 'short'
+ # post 'toggle'
+ # end
+ #
+ # collection do
+ # get 'sold'
+ # end
+ # end
+
+ # Example resource route with sub-resources:
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
+
+ # Example resource route with more complex sub-resources:
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get 'recent', on: :collection
+ # end
+ # end
+
+ # Example resource route with concerns:
+ # concern :toggleable do
+ # post 'toggle'
+ # end
+ # resources :posts, concerns: :toggleable
+ # resources :photos, concerns: :toggleable
+
+ # Example resource route within a namespace:
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
+ # end
+end
diff --git a/harshilp/rails_tdd/factoryTesting/config/secrets.yml b/harshilp/rails_tdd/factoryTesting/config/secrets.yml
new file mode 100644
index 0000000..0ddb735
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/config/secrets.yml
@@ -0,0 +1,22 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key is used for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+# You can use `rake secret` to generate a secure secret key.
+
+# Make sure the secrets in this file are kept private
+# if you're sharing your code publicly.
+
+development:
+ secret_key_base: d746e808377faad80ec2dd88c50d06aa693c59597667f48d5d3eccb565a902de17d821b9ae94c7aca8809a67d70ba66c45e734cba845fa949acb298db52b8e54
+
+test:
+ secret_key_base: 34f89020b2d7990563c27e60cefe72f6c55a95121c9c7ef49757e59bf4d5d70f28ddca7cc0c7366d09f267074d27ec8ee70ae9e2ba622e4c9434df46165addfd
+
+# Do not keep production secrets in the repository,
+# instead read values from the environment.
+production:
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
diff --git a/harshilp/rails_tdd/factoryTesting/db/migrate/20171207192818_create_users.rb b/harshilp/rails_tdd/factoryTesting/db/migrate/20171207192818_create_users.rb
new file mode 100644
index 0000000..cc285fe
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/db/migrate/20171207192818_create_users.rb
@@ -0,0 +1,11 @@
+class CreateUsers < ActiveRecord::Migration
+ def change
+ create_table :users do |t|
+ t.string :first_name
+ t.string :last_name
+ t.string :email
+
+ t.timestamps null: false
+ end
+ end
+end
diff --git a/harshilp/rails_tdd/factoryTesting/db/schema.rb b/harshilp/rails_tdd/factoryTesting/db/schema.rb
new file mode 100644
index 0000000..eebcb0d
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/db/schema.rb
@@ -0,0 +1,24 @@
+# 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: 20171207192818) do
+
+ create_table "users", force: :cascade do |t|
+ t.string "first_name"
+ t.string "last_name"
+ t.string "email"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+end
diff --git a/harshilp/rails_tdd/factoryTesting/db/seeds.rb b/harshilp/rails_tdd/factoryTesting/db/seeds.rb
new file mode 100644
index 0000000..4edb1e8
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/db/seeds.rb
@@ -0,0 +1,7 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#
+# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
+# Mayor.create(name: 'Emanuel', city: cities.first)
diff --git a/harshilp/rails_tdd/factoryTesting/lib/assets/.keep b/harshilp/rails_tdd/factoryTesting/lib/assets/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/factoryTesting/lib/tasks/.keep b/harshilp/rails_tdd/factoryTesting/lib/tasks/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/factoryTesting/log/.keep b/harshilp/rails_tdd/factoryTesting/log/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/factoryTesting/public/404.html b/harshilp/rails_tdd/factoryTesting/public/404.html
new file mode 100644
index 0000000..b612547
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/public/404.html
@@ -0,0 +1,67 @@
+
+
+
+ The page you were looking for doesn't exist (404)
+
+
+
+
+
+
+
+
+
The page you were looking for doesn't exist.
+
You may have mistyped the address or the page may have moved.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/harshilp/rails_tdd/factoryTesting/public/422.html b/harshilp/rails_tdd/factoryTesting/public/422.html
new file mode 100644
index 0000000..a21f82b
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/public/422.html
@@ -0,0 +1,67 @@
+
+
+
+ The change you wanted was rejected (422)
+
+
+
+
+
+
+
+
+
The change you wanted was rejected.
+
Maybe you tried to change something you didn't have access to.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/harshilp/rails_tdd/factoryTesting/public/500.html b/harshilp/rails_tdd/factoryTesting/public/500.html
new file mode 100644
index 0000000..061abc5
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/public/500.html
@@ -0,0 +1,66 @@
+
+
+
+ We're sorry, but something went wrong (500)
+
+
+
+
+
+
+
+
+
We're sorry, but something went wrong.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/harshilp/rails_tdd/factoryTesting/public/favicon.ico b/harshilp/rails_tdd/factoryTesting/public/favicon.ico
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/factoryTesting/public/robots.txt b/harshilp/rails_tdd/factoryTesting/public/robots.txt
new file mode 100644
index 0000000..3c9c7c0
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/public/robots.txt
@@ -0,0 +1,5 @@
+# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
+#
+# To ban all spiders from the entire site uncomment the next two lines:
+# User-agent: *
+# Disallow: /
diff --git a/harshilp/rails_tdd/factoryTesting/spec/controllers/users_controller_spec.rb b/harshilp/rails_tdd/factoryTesting/spec/controllers/users_controller_spec.rb
new file mode 100644
index 0000000..0a86999
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/spec/controllers/users_controller_spec.rb
@@ -0,0 +1,12 @@
+require 'rails_helper'
+
+RSpec.describe UsersController, type: :controller do
+
+ describe "GET #new" do
+ it "returns http success" do
+ get :new
+ expect(response).to have_http_status(:success)
+ end
+ end
+
+end
diff --git a/harshilp/rails_tdd/factoryTesting/spec/factories/users.rb b/harshilp/rails_tdd/factoryTesting/spec/factories/users.rb
new file mode 100644
index 0000000..640cdcf
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/spec/factories/users.rb
@@ -0,0 +1,7 @@
+FactoryGirl.define do
+ factory :user do
+ first_name "John"
+ last_name "Doe"
+ email "john@doe.com"
+ end
+end
diff --git a/harshilp/rails_tdd/factoryTesting/spec/features/register_user_spec.rb b/harshilp/rails_tdd/factoryTesting/spec/features/register_user_spec.rb
new file mode 100644
index 0000000..f03cc77
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/spec/features/register_user_spec.rb
@@ -0,0 +1,37 @@
+require 'rails_helper'
+feature "User creates an account" do
+ before(:each) do
+ visit new_user_path
+ end
+ scenario "successfully creates a new user account" do
+ fill_in "user_first_name", with: "shane"
+ fill_in "user_last_name", with: "chang"
+ fill_in "user_email", with: "schang@codingdojo.com"
+ click_button "Create User"
+ expect(page).to have_content "Welcome, shane"
+ # We'll be redirecting to the user show page is user succesfully created
+ expect(page).to have_current_path(user_path(User.last))
+ end
+ scenario "unsuccessfully creates a new user account" do
+ click_button "Create User"
+ expect(current_path).to eq(new_user_path)
+ end
+ scenario "doesn't fill out first name field" do
+ fill_in "user_last_name", with: "shane"
+ fill_in "user_email", with: "schang@codingdojo.com"
+ click_button "Create User"
+ expect(page).to have_content "First name can't be blank"
+ end
+ scenario "doesn't fill out last name field" do
+ fill_in "user_first_name", with: "shane"
+ fill_in "user_email", with: "schang@codingdojo.com"
+ click_button "Create User"
+ expect(page).to have_content "Last name can't be blank"
+ end
+ scenario "doesn't fill out email field" do
+ fill_in "user_first_name", with: "shane"
+ fill_in "user_last_name", with: "chang"
+ click_button "Create User"
+ expect(page).to have_content "Email can't be blank"
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails_tdd/factoryTesting/spec/helpers/users_helper_spec.rb b/harshilp/rails_tdd/factoryTesting/spec/helpers/users_helper_spec.rb
new file mode 100644
index 0000000..b2e3444
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/spec/helpers/users_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the UsersHelper. For example:
+#
+# describe UsersHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe UsersHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/harshilp/rails_tdd/factoryTesting/spec/models/user_spec.rb b/harshilp/rails_tdd/factoryTesting/spec/models/user_spec.rb
new file mode 100644
index 0000000..3045cf0
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/spec/models/user_spec.rb
@@ -0,0 +1,23 @@
+require 'rails_helper'
+RSpec.describe User, type: :model do
+ context "With valid attributes" do
+ it "should save" do
+ expect(build(:user)).to be_valid
+ end
+ end
+ context "With invalid attributes" do
+ it "should not save if first_name field is blank" do
+ expect(build(:user, first_name: "")).to be_invalid
+ end
+ it "should not save if last_name field is blank" do
+ expect(build(:user, last_name: "")).to be_invalid
+ end
+ it "should not save if email already exists" do
+ create(:user)
+ expect(build(:user)).to be_invalid
+ end
+ it "should not save if invalid email format" do
+ expect(build(:user, email: "invalidEmail")).to be_invalid
+ end
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails_tdd/factoryTesting/spec/rails_helper.rb b/harshilp/rails_tdd/factoryTesting/spec/rails_helper.rb
new file mode 100644
index 0000000..70c1534
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/spec/rails_helper.rb
@@ -0,0 +1,58 @@
+# This file is copied to spec/ when you run 'rails generate rspec:install'
+require 'spec_helper'
+require 'factory_girl_rails'
+ENV['RAILS_ENV'] ||= 'test'
+require File.expand_path('../../config/environment', __FILE__)
+# Prevent database truncation if the environment is production
+abort("The Rails environment is running in production mode!") if Rails.env.production?
+require 'rspec/rails'
+# Add additional requires below this line. Rails is not loaded until this point!
+
+# Requires supporting ruby files with custom matchers and macros, etc, in
+# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
+# run as spec files by default. This means that files in spec/support that end
+# in _spec.rb will both be required and run as specs, causing the specs to be
+# run twice. It is recommended that you do not name files matching this glob to
+# end with _spec.rb. You can configure this pattern with the --pattern
+# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
+#
+# The following line is provided for convenience purposes. It has the downside
+# of increasing the boot-up time by auto-requiring all files in the support
+# directory. Alternatively, in the individual `*_spec.rb` files, manually
+# require only the support files necessary.
+#
+# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
+
+# Checks for pending migrations and applies them before tests are run.
+# If you are not using ActiveRecord, you can remove this line.
+ActiveRecord::Migration.maintain_test_schema!
+
+RSpec.configure do |config|
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+ config.include FactoryGirl::Syntax::Methods
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+
+ # RSpec Rails can automatically mix in different behaviours to your tests
+ # based on their file location, for example enabling you to call `get` and
+ # `post` in specs under `spec/controllers`.
+ #
+ # You can disable this behaviour by removing the line below, and instead
+ # explicitly tag your specs with their type, e.g.:
+ #
+ # RSpec.describe UsersController, :type => :controller do
+ # # ...
+ # end
+ #
+ # The different available types are documented in the features, such as in
+ # https://relishapp.com/rspec/rspec-rails/docs
+ config.infer_spec_type_from_file_location!
+
+ # Filter lines from Rails gems in backtraces.
+ config.filter_rails_from_backtrace!
+ # arbitrary gems may also be filtered via:
+ # config.filter_gems_from_backtrace("gem name")
+end
diff --git a/harshilp/rails_tdd/factoryTesting/spec/spec_helper.rb b/harshilp/rails_tdd/factoryTesting/spec/spec_helper.rb
new file mode 100644
index 0000000..ce33d66
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/spec/spec_helper.rb
@@ -0,0 +1,96 @@
+# This file was generated by the `rails generate rspec:install` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# The generated `.rspec` file contains `--require spec_helper` which will cause
+# this file to always be loaded, without a need to explicitly require it in any
+# files.
+#
+# Given that it is always loaded, you are encouraged to keep this file as
+# light-weight as possible. Requiring heavyweight dependencies from this file
+# will add to the boot time of your test suite on EVERY test run, even for an
+# individual file that may not need all of that loaded. Instead, consider making
+# a separate helper file that requires the additional dependencies and performs
+# the additional setup, and require it from the spec files that actually need
+# it.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+RSpec.configure do |config|
+ # rspec-expectations config goes here. You can use an alternate
+ # assertion/expectation library such as wrong or the stdlib/minitest
+ # assertions if you prefer.
+ config.expect_with :rspec do |expectations|
+ # This option will default to `true` in RSpec 4. It makes the `description`
+ # and `failure_message` of custom matchers include text for helper methods
+ # defined using `chain`, e.g.:
+ # be_bigger_than(2).and_smaller_than(4).description
+ # # => "be bigger than 2 and smaller than 4"
+ # ...rather than:
+ # # => "be bigger than 2"
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
+ end
+
+ # rspec-mocks config goes here. You can use an alternate test double
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
+ config.mock_with :rspec do |mocks|
+ # Prevents you from mocking or stubbing a method that does not exist on
+ # a real object. This is generally recommended, and will default to
+ # `true` in RSpec 4.
+ mocks.verify_partial_doubles = true
+ end
+
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
+ # have no way to turn it off -- the option exists only for backwards
+ # compatibility in RSpec 3). It causes shared context metadata to be
+ # inherited by the metadata hash of host groups and examples, rather than
+ # triggering implicit auto-inclusion in groups with matching metadata.
+ config.shared_context_metadata_behavior = :apply_to_host_groups
+
+# The settings below are suggested to provide a good initial experience
+# with RSpec, but feel free to customize to your heart's content.
+=begin
+ # This allows you to limit a spec run to individual examples or groups
+ # you care about by tagging them with `:focus` metadata. When nothing
+ # is tagged with `:focus`, all examples get run. RSpec also provides
+ # aliases for `it`, `describe`, and `context` that include `:focus`
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
+ config.filter_run_when_matching :focus
+
+ # Allows RSpec to persist some state between runs in order to support
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
+ # you configure your source control system to ignore this file.
+ config.example_status_persistence_file_path = "spec/examples.txt"
+
+ # Limits the available syntax to the non-monkey patched syntax that is
+ # recommended. For more details, see:
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
+ config.disable_monkey_patching!
+
+ # Many RSpec users commonly either run the entire suite or an individual
+ # file, and it's useful to allow more verbose output when running an
+ # individual spec file.
+ if config.files_to_run.one?
+ # Use the documentation formatter for detailed output,
+ # unless a formatter has already been configured
+ # (e.g. via a command-line flag).
+ config.default_formatter = "doc"
+ end
+
+ # Print the 10 slowest examples and example groups at the
+ # end of the spec run, to help surface which specs are running
+ # particularly slow.
+ config.profile_examples = 10
+
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = :random
+
+ # Seed global randomization in this process using the `--seed` CLI option.
+ # Setting this allows you to use `--seed` to deterministically reproduce
+ # test failures related to randomization by passing the same `--seed` value
+ # as the one that triggered the failure.
+ Kernel.srand config.seed
+=end
+end
diff --git a/harshilp/rails_tdd/factoryTesting/spec/views/users/new.html.erb_spec.rb b/harshilp/rails_tdd/factoryTesting/spec/views/users/new.html.erb_spec.rb
new file mode 100644
index 0000000..47b47d3
--- /dev/null
+++ b/harshilp/rails_tdd/factoryTesting/spec/views/users/new.html.erb_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe "users/new.html.erb", type: :view do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/harshilp/rails_tdd/factoryTesting/vendor/assets/javascripts/.keep b/harshilp/rails_tdd/factoryTesting/vendor/assets/javascripts/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/factoryTesting/vendor/assets/stylesheets/.keep b/harshilp/rails_tdd/factoryTesting/vendor/assets/stylesheets/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/.gitignore b/harshilp/rails_tdd/modelSpec/.gitignore
new file mode 100644
index 0000000..050c9d9
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/.gitignore
@@ -0,0 +1,17 @@
+# See https://help.github.com/articles/ignoring-files for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile '~/.gitignore_global'
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore the default SQLite database.
+/db/*.sqlite3
+/db/*.sqlite3-journal
+
+# Ignore all logfiles and tempfiles.
+/log/*
+!/log/.keep
+/tmp
diff --git a/harshilp/rails_tdd/modelSpec/.rspec b/harshilp/rails_tdd/modelSpec/.rspec
new file mode 100644
index 0000000..c99d2e7
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/.rspec
@@ -0,0 +1 @@
+--require spec_helper
diff --git a/harshilp/rails_tdd/modelSpec/Gemfile b/harshilp/rails_tdd/modelSpec/Gemfile
new file mode 100644
index 0000000..019271d
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/Gemfile
@@ -0,0 +1,48 @@
+source 'https://rubygems.org'
+
+
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
+gem 'rails', '4.2.7'
+# Use sqlite3 as the database for Active Record
+gem 'sqlite3'
+# Use SCSS for stylesheets
+gem 'sass-rails', '~> 5.0'
+# Use Uglifier as compressor for JavaScript assets
+gem 'uglifier', '>= 1.3.0'
+# Use CoffeeScript for .coffee assets and views
+gem 'coffee-rails', '~> 4.1.0'
+# See https://github.com/rails/execjs#readme for more supported runtimes
+# gem 'therubyracer', platforms: :ruby
+
+# Use jquery as the JavaScript library
+gem 'jquery-rails'
+# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
+gem 'turbolinks'
+# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
+gem 'jbuilder', '~> 2.0'
+# bundle exec rake doc:rails generates the API under doc/api.
+gem 'sdoc', '~> 0.4.0', group: :doc
+
+# Use ActiveModel has_secure_password
+# gem 'bcrypt', '~> 3.1.7'
+
+# Use Unicorn as the app server
+# gem 'unicorn'
+
+# Use Capistrano for deployment
+# gem 'capistrano-rails', group: :development
+
+group :development, :test do
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
+ gem 'rspec-rails'
+ gem 'byebug'
+end
+
+group :development do
+ # Access an IRB console on exception pages or by using <%= console %> in views
+ gem 'web-console', '~> 2.0'
+
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
+ gem 'spring'
+end
+
diff --git a/harshilp/rails_tdd/modelSpec/Gemfile.lock b/harshilp/rails_tdd/modelSpec/Gemfile.lock
new file mode 100644
index 0000000..981a84b
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/Gemfile.lock
@@ -0,0 +1,189 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (4.2.7)
+ actionpack (= 4.2.7)
+ actionview (= 4.2.7)
+ activejob (= 4.2.7)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ actionpack (4.2.7)
+ actionview (= 4.2.7)
+ activesupport (= 4.2.7)
+ rack (~> 1.6)
+ rack-test (~> 0.6.2)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (4.2.7)
+ activesupport (= 4.2.7)
+ builder (~> 3.1)
+ erubis (~> 2.7.0)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ activejob (4.2.7)
+ activesupport (= 4.2.7)
+ globalid (>= 0.3.0)
+ activemodel (4.2.7)
+ activesupport (= 4.2.7)
+ builder (~> 3.1)
+ activerecord (4.2.7)
+ activemodel (= 4.2.7)
+ activesupport (= 4.2.7)
+ arel (~> 6.0)
+ activesupport (4.2.7)
+ i18n (~> 0.7)
+ json (~> 1.7, >= 1.7.7)
+ minitest (~> 5.1)
+ thread_safe (~> 0.3, >= 0.3.4)
+ tzinfo (~> 1.1)
+ arel (6.0.4)
+ binding_of_caller (0.7.3)
+ debug_inspector (>= 0.0.1)
+ builder (3.2.3)
+ byebug (9.1.0)
+ coffee-rails (4.1.1)
+ coffee-script (>= 2.2.0)
+ railties (>= 4.0.0, < 5.1.x)
+ coffee-script (2.4.1)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.12.2)
+ concurrent-ruby (1.0.5)
+ crass (1.0.3)
+ debug_inspector (0.0.3)
+ diff-lcs (1.3)
+ erubis (2.7.0)
+ execjs (2.7.0)
+ ffi (1.9.18)
+ globalid (0.4.1)
+ activesupport (>= 4.2.0)
+ i18n (0.9.1)
+ concurrent-ruby (~> 1.0)
+ jbuilder (2.7.0)
+ activesupport (>= 4.2.0)
+ multi_json (>= 1.2)
+ jquery-rails (4.3.1)
+ rails-dom-testing (>= 1, < 3)
+ railties (>= 4.2.0)
+ thor (>= 0.14, < 2.0)
+ json (1.8.6)
+ loofah (2.1.1)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.5.9)
+ mail (2.7.0)
+ mini_mime (>= 0.1.1)
+ mini_mime (1.0.0)
+ mini_portile2 (2.3.0)
+ minitest (5.10.3)
+ multi_json (1.12.2)
+ nokogiri (1.8.1)
+ mini_portile2 (~> 2.3.0)
+ rack (1.6.8)
+ rack-test (0.6.3)
+ rack (>= 1.0)
+ rails (4.2.7)
+ actionmailer (= 4.2.7)
+ actionpack (= 4.2.7)
+ actionview (= 4.2.7)
+ activejob (= 4.2.7)
+ activemodel (= 4.2.7)
+ activerecord (= 4.2.7)
+ activesupport (= 4.2.7)
+ bundler (>= 1.3.0, < 2.0)
+ railties (= 4.2.7)
+ sprockets-rails
+ rails-deprecated_sanitizer (1.0.3)
+ activesupport (>= 4.2.0.alpha)
+ rails-dom-testing (1.0.8)
+ activesupport (>= 4.2.0.beta, < 5.0)
+ nokogiri (~> 1.6)
+ rails-deprecated_sanitizer (>= 1.0.1)
+ rails-html-sanitizer (1.0.3)
+ loofah (~> 2.0)
+ railties (4.2.7)
+ actionpack (= 4.2.7)
+ activesupport (= 4.2.7)
+ rake (>= 0.8.7)
+ thor (>= 0.18.1, < 2.0)
+ rake (12.3.0)
+ rb-fsevent (0.10.2)
+ rb-inotify (0.9.10)
+ ffi (>= 0.5.0, < 2)
+ rdoc (4.3.0)
+ rspec-core (3.7.0)
+ rspec-support (~> 3.7.0)
+ rspec-expectations (3.7.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.7.0)
+ rspec-mocks (3.7.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.7.0)
+ rspec-rails (3.7.2)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec-core (~> 3.7.0)
+ rspec-expectations (~> 3.7.0)
+ rspec-mocks (~> 3.7.0)
+ rspec-support (~> 3.7.0)
+ rspec-support (3.7.0)
+ sass (3.5.3)
+ sass-listen (~> 4.0.0)
+ sass-listen (4.0.0)
+ rb-fsevent (~> 0.9, >= 0.9.4)
+ rb-inotify (~> 0.9, >= 0.9.7)
+ sass-rails (5.0.7)
+ railties (>= 4.0.0, < 6)
+ sass (~> 3.1)
+ sprockets (>= 2.8, < 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+ tilt (>= 1.1, < 3)
+ sdoc (0.4.2)
+ json (~> 1.7, >= 1.7.7)
+ rdoc (~> 4.0)
+ spring (2.0.2)
+ activesupport (>= 4.2)
+ sprockets (3.7.1)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.2.1)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
+ sqlite3 (1.3.13)
+ thor (0.20.0)
+ thread_safe (0.3.6)
+ tilt (2.0.8)
+ turbolinks (5.0.1)
+ turbolinks-source (~> 5)
+ turbolinks-source (5.0.3)
+ tzinfo (1.2.4)
+ thread_safe (~> 0.1)
+ uglifier (4.0.1)
+ execjs (>= 0.3.0, < 3)
+ web-console (2.3.0)
+ activemodel (>= 4.0)
+ binding_of_caller (>= 0.7.2)
+ railties (>= 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ byebug
+ coffee-rails (~> 4.1.0)
+ jbuilder (~> 2.0)
+ jquery-rails
+ rails (= 4.2.7)
+ rspec-rails
+ sass-rails (~> 5.0)
+ sdoc (~> 0.4.0)
+ spring
+ sqlite3
+ turbolinks
+ uglifier (>= 1.3.0)
+ web-console (~> 2.0)
+
+BUNDLED WITH
+ 1.16.0
diff --git a/harshilp/rails_tdd/modelSpec/README.rdoc b/harshilp/rails_tdd/modelSpec/README.rdoc
new file mode 100644
index 0000000..dd4e97e
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/README.rdoc
@@ -0,0 +1,28 @@
+== README
+
+This README would normally document whatever steps are necessary to get the
+application up and running.
+
+Things you may want to cover:
+
+* Ruby version
+
+* System dependencies
+
+* Configuration
+
+* Database creation
+
+* Database initialization
+
+* How to run the test suite
+
+* Services (job queues, cache servers, search engines, etc.)
+
+* Deployment instructions
+
+* ...
+
+
+Please feel free to use a different markup language if you do not plan to run
+rake doc:app.
diff --git a/harshilp/rails_tdd/modelSpec/Rakefile b/harshilp/rails_tdd/modelSpec/Rakefile
new file mode 100644
index 0000000..ba6b733
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/Rakefile
@@ -0,0 +1,6 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+Rails.application.load_tasks
diff --git a/harshilp/rails_tdd/modelSpec/app/assets/images/.keep b/harshilp/rails_tdd/modelSpec/app/assets/images/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/app/assets/javascripts/application.js b/harshilp/rails_tdd/modelSpec/app/assets/javascripts/application.js
new file mode 100644
index 0000000..e07c5a8
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/app/assets/javascripts/application.js
@@ -0,0 +1,16 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// compiled file.
+//
+// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
+// about supported directives.
+//
+//= require jquery
+//= require jquery_ujs
+//= require turbolinks
+//= require_tree .
diff --git a/harshilp/rails_tdd/modelSpec/app/assets/stylesheets/application.css b/harshilp/rails_tdd/modelSpec/app/assets/stylesheets/application.css
new file mode 100644
index 0000000..f9cd5b3
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/app/assets/stylesheets/application.css
@@ -0,0 +1,15 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
+ * compiled file so the styles you add here take precedence over styles defined in any styles
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
+ * file per style scope.
+ *
+ *= require_tree .
+ *= require_self
+ */
diff --git a/harshilp/rails_tdd/modelSpec/app/controllers/application_controller.rb b/harshilp/rails_tdd/modelSpec/app/controllers/application_controller.rb
new file mode 100644
index 0000000..d83690e
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/app/controllers/application_controller.rb
@@ -0,0 +1,5 @@
+class ApplicationController < ActionController::Base
+ # Prevent CSRF attacks by raising an exception.
+ # For APIs, you may want to use :null_session instead.
+ protect_from_forgery with: :exception
+end
diff --git a/harshilp/rails_tdd/modelSpec/app/controllers/concerns/.keep b/harshilp/rails_tdd/modelSpec/app/controllers/concerns/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/app/helpers/application_helper.rb b/harshilp/rails_tdd/modelSpec/app/helpers/application_helper.rb
new file mode 100644
index 0000000..de6be79
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/harshilp/rails_tdd/modelSpec/app/mailers/.keep b/harshilp/rails_tdd/modelSpec/app/mailers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/app/models/.keep b/harshilp/rails_tdd/modelSpec/app/models/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/app/models/concerns/.keep b/harshilp/rails_tdd/modelSpec/app/models/concerns/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/app/models/user.rb b/harshilp/rails_tdd/modelSpec/app/models/user.rb
new file mode 100644
index 0000000..2c24a58
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/app/models/user.rb
@@ -0,0 +1,5 @@
+class User < ActiveRecord::Base
+ EMAIL_REGEX = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]+)\z/i
+ validates :first_name, :last_name, :email, presence: true
+ validates :email, uniqueness: { case_sensitive: false }, format: {with: EMAIL_REGEX}
+end
\ No newline at end of file
diff --git a/harshilp/rails_tdd/modelSpec/app/views/layouts/application.html.erb b/harshilp/rails_tdd/modelSpec/app/views/layouts/application.html.erb
new file mode 100644
index 0000000..fc9636a
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/app/views/layouts/application.html.erb
@@ -0,0 +1,14 @@
+
+
+
+ ModelSpec
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
+ <%= csrf_meta_tags %>
+
+
+
+<%= yield %>
+
+
+
diff --git a/harshilp/rails_tdd/modelSpec/bin/bundle b/harshilp/rails_tdd/modelSpec/bin/bundle
new file mode 100644
index 0000000..66e9889
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/bin/bundle
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+load Gem.bin_path('bundler', 'bundle')
diff --git a/harshilp/rails_tdd/modelSpec/bin/rails b/harshilp/rails_tdd/modelSpec/bin/rails
new file mode 100644
index 0000000..0138d79
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/bin/rails
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path('../spring', __FILE__)
+rescue LoadError => e
+ raise unless e.message.include?('spring')
+end
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require_relative '../config/boot'
+require 'rails/commands'
diff --git a/harshilp/rails_tdd/modelSpec/bin/rake b/harshilp/rails_tdd/modelSpec/bin/rake
new file mode 100644
index 0000000..d87d5f5
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/bin/rake
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path('../spring', __FILE__)
+rescue LoadError => e
+ raise unless e.message.include?('spring')
+end
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run
diff --git a/harshilp/rails_tdd/modelSpec/bin/setup b/harshilp/rails_tdd/modelSpec/bin/setup
new file mode 100644
index 0000000..acdb2c1
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/bin/setup
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+Dir.chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file:
+
+ puts "== Installing dependencies =="
+ system "gem install bundler --conservative"
+ system "bundle check || bundle install"
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?("config/database.yml")
+ # system "cp config/database.yml.sample config/database.yml"
+ # end
+
+ puts "\n== Preparing database =="
+ system "bin/rake db:setup"
+
+ puts "\n== Removing old logs and tempfiles =="
+ system "rm -f log/*"
+ system "rm -rf tmp/cache"
+
+ puts "\n== Restarting application server =="
+ system "touch tmp/restart.txt"
+end
diff --git a/harshilp/rails_tdd/modelSpec/bin/spring b/harshilp/rails_tdd/modelSpec/bin/spring
new file mode 100644
index 0000000..fb2ec2e
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/bin/spring
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+
+# This file loads spring without using Bundler, in order to be fast.
+# It gets overwritten when you run the `spring binstub` command.
+
+unless defined?(Spring)
+ require 'rubygems'
+ require 'bundler'
+
+ lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
+ spring = lockfile.specs.detect { |spec| spec.name == "spring" }
+ if spring
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
+ gem 'spring', spring.version
+ require 'spring/binstub'
+ end
+end
diff --git a/harshilp/rails_tdd/modelSpec/config.ru b/harshilp/rails_tdd/modelSpec/config.ru
new file mode 100644
index 0000000..bd83b25
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Rails.application
diff --git a/harshilp/rails_tdd/modelSpec/config/application.rb b/harshilp/rails_tdd/modelSpec/config/application.rb
new file mode 100644
index 0000000..3b7f38d
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/application.rb
@@ -0,0 +1,26 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
+
+module ModelSpec
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # Do not swallow errors in after_commit/after_rollback callbacks.
+ config.active_record.raise_in_transactional_callbacks = true
+ end
+end
diff --git a/harshilp/rails_tdd/modelSpec/config/boot.rb b/harshilp/rails_tdd/modelSpec/config/boot.rb
new file mode 100644
index 0000000..6b750f0
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/boot.rb
@@ -0,0 +1,3 @@
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' # Set up gems listed in the Gemfile.
diff --git a/harshilp/rails_tdd/modelSpec/config/database.yml b/harshilp/rails_tdd/modelSpec/config/database.yml
new file mode 100644
index 0000000..1c1a37c
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/database.yml
@@ -0,0 +1,25 @@
+# SQLite version 3.x
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem 'sqlite3'
+#
+default: &default
+ adapter: sqlite3
+ pool: 5
+ timeout: 5000
+
+development:
+ <<: *default
+ database: db/development.sqlite3
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ <<: *default
+ database: db/test.sqlite3
+
+production:
+ <<: *default
+ database: db/production.sqlite3
diff --git a/harshilp/rails_tdd/modelSpec/config/environment.rb b/harshilp/rails_tdd/modelSpec/config/environment.rb
new file mode 100644
index 0000000..ee8d90d
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the Rails application.
+require File.expand_path('../application', __FILE__)
+
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/harshilp/rails_tdd/modelSpec/config/environments/development.rb b/harshilp/rails_tdd/modelSpec/config/environments/development.rb
new file mode 100644
index 0000000..b55e214
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/environments/development.rb
@@ -0,0 +1,41 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.cache_classes = false
+
+ # Do not eager load code on boot.
+ config.eager_load = false
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send.
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger.
+ config.active_support.deprecation = :log
+
+ # Raise an error on page load if there are pending migrations.
+ config.active_record.migration_error = :page_load
+
+ # Debug mode disables concatenation and preprocessing of assets.
+ # This option may cause significant delays in view rendering with a large
+ # number of complex assets.
+ config.assets.debug = true
+
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
+ config.assets.digest = true
+
+ # Adds additional error checking when serving assets at runtime.
+ # Checks for improperly declared sprockets dependencies.
+ # Raises helpful error messages.
+ config.assets.raise_runtime_errors = true
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
+end
diff --git a/harshilp/rails_tdd/modelSpec/config/environments/production.rb b/harshilp/rails_tdd/modelSpec/config/environments/production.rb
new file mode 100644
index 0000000..5c1b32e
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/environments/production.rb
@@ -0,0 +1,79 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Code is not reloaded between requests.
+ config.cache_classes = true
+
+ # Eager load code on boot. This eager loads most of Rails and
+ # your application in memory, allowing both threaded web servers
+ # and those relying on copy on write to perform better.
+ # Rake tasks automatically ignore this option for performance.
+ config.eager_load = true
+
+ # Full error reports are disabled and caching is turned on.
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
+ # Add `rack-cache` to your Gemfile before enabling this.
+ # For large-scale production use, consider using a caching reverse proxy like
+ # NGINX, varnish or squid.
+ # config.action_dispatch.rack_cache = true
+
+ # Disable serving static files from the `/public` folder by default since
+ # Apache or NGINX already handles this.
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
+
+ # Compress JavaScripts and CSS.
+ config.assets.js_compressor = :uglifier
+ # config.assets.css_compressor = :sass
+
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
+ config.assets.compile = false
+
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
+ config.assets.digest = true
+
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
+
+ # Specifies the header that your server uses for sending files.
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
+
+ # Use the lowest log level to ensure availability of diagnostic information
+ # when problems arise.
+ config.log_level = :debug
+
+ # Prepend all log lines with the following tags.
+ # config.log_tags = [ :subdomain, :uuid ]
+
+ # Use a different logger for distributed setups.
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
+
+ # Use a different cache store in production.
+ # config.cache_store = :mem_cache_store
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.action_controller.asset_host = 'http://assets.example.com'
+
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners.
+ config.active_support.deprecation = :notify
+
+ # Use default logging formatter so that PID and timestamp are not suppressed.
+ config.log_formatter = ::Logger::Formatter.new
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+end
diff --git a/harshilp/rails_tdd/modelSpec/config/environments/test.rb b/harshilp/rails_tdd/modelSpec/config/environments/test.rb
new file mode 100644
index 0000000..1c19f08
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/environments/test.rb
@@ -0,0 +1,42 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
+
+ # Do not eager load code on boot. This avoids loading your whole application
+ # just for the purpose of running a single test. If you are using a tool that
+ # preloads Rails for running tests, you may have to set it to true.
+ config.eager_load = false
+
+ # Configure static file server for tests with Cache-Control for performance.
+ config.serve_static_files = true
+ config.static_cache_control = 'public, max-age=3600'
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Raise exceptions instead of rendering exception templates.
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Randomize the order test cases are executed.
+ config.active_support.test_order = :random
+
+ # Print deprecation notices to the stderr.
+ config.active_support.deprecation = :stderr
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
+end
diff --git a/harshilp/rails_tdd/modelSpec/config/initializers/assets.rb b/harshilp/rails_tdd/modelSpec/config/initializers/assets.rb
new file mode 100644
index 0000000..01ef3e6
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/initializers/assets.rb
@@ -0,0 +1,11 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = '1.0'
+
+# Add additional assets to the asset load path
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
+# Rails.application.config.assets.precompile += %w( search.js )
diff --git a/harshilp/rails_tdd/modelSpec/config/initializers/backtrace_silencers.rb b/harshilp/rails_tdd/modelSpec/config/initializers/backtrace_silencers.rb
new file mode 100644
index 0000000..59385cd
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/initializers/backtrace_silencers.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
diff --git a/harshilp/rails_tdd/modelSpec/config/initializers/cookies_serializer.rb b/harshilp/rails_tdd/modelSpec/config/initializers/cookies_serializer.rb
new file mode 100644
index 0000000..7f70458
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/initializers/cookies_serializer.rb
@@ -0,0 +1,3 @@
+# Be sure to restart your server when you modify this file.
+
+Rails.application.config.action_dispatch.cookies_serializer = :json
diff --git a/harshilp/rails_tdd/modelSpec/config/initializers/filter_parameter_logging.rb b/harshilp/rails_tdd/modelSpec/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 0000000..4a994e1
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,4 @@
+# Be sure to restart your server when you modify this file.
+
+# Configure sensitive parameters which will be filtered from the log file.
+Rails.application.config.filter_parameters += [:password]
diff --git a/harshilp/rails_tdd/modelSpec/config/initializers/inflections.rb b/harshilp/rails_tdd/modelSpec/config/initializers/inflections.rb
new file mode 100644
index 0000000..ac033bf
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/initializers/inflections.rb
@@ -0,0 +1,16 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.plural /^(ox)$/i, '\1en'
+# inflect.singular /^(ox)en/i, '\1'
+# inflect.irregular 'person', 'people'
+# inflect.uncountable %w( fish sheep )
+# end
+
+# These inflection rules are supported but not enabled by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.acronym 'RESTful'
+# end
diff --git a/harshilp/rails_tdd/modelSpec/config/initializers/mime_types.rb b/harshilp/rails_tdd/modelSpec/config/initializers/mime_types.rb
new file mode 100644
index 0000000..dc18996
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/initializers/mime_types.rb
@@ -0,0 +1,4 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
diff --git a/harshilp/rails_tdd/modelSpec/config/initializers/session_store.rb b/harshilp/rails_tdd/modelSpec/config/initializers/session_store.rb
new file mode 100644
index 0000000..eb59df3
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/initializers/session_store.rb
@@ -0,0 +1,3 @@
+# Be sure to restart your server when you modify this file.
+
+Rails.application.config.session_store :cookie_store, key: '_modelSpec_session'
diff --git a/harshilp/rails_tdd/modelSpec/config/initializers/wrap_parameters.rb b/harshilp/rails_tdd/modelSpec/config/initializers/wrap_parameters.rb
new file mode 100644
index 0000000..33725e9
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/initializers/wrap_parameters.rb
@@ -0,0 +1,14 @@
+# Be sure to restart your server when you modify this file.
+
+# This file contains settings for ActionController::ParamsWrapper which
+# is enabled by default.
+
+# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
+ActiveSupport.on_load(:action_controller) do
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
+end
+
+# To enable root element in JSON for ActiveRecord objects.
+# ActiveSupport.on_load(:active_record) do
+# self.include_root_in_json = true
+# end
diff --git a/harshilp/rails_tdd/modelSpec/config/locales/en.yml b/harshilp/rails_tdd/modelSpec/config/locales/en.yml
new file mode 100644
index 0000000..0653957
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/locales/en.yml
@@ -0,0 +1,23 @@
+# Files in the config/locales directory are used for internationalization
+# and are automatically loaded by Rails. If you want to use locales other
+# than English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t 'hello'
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t('hello') %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# To learn more, please read the Rails Internationalization guide
+# available at http://guides.rubyonrails.org/i18n.html.
+
+en:
+ hello: "Hello world"
diff --git a/harshilp/rails_tdd/modelSpec/config/routes.rb b/harshilp/rails_tdd/modelSpec/config/routes.rb
new file mode 100644
index 0000000..3f66539
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/routes.rb
@@ -0,0 +1,56 @@
+Rails.application.routes.draw do
+ # The priority is based upon order of creation: first created -> highest priority.
+ # See how all your routes lay out with "rake routes".
+
+ # You can have the root of your site routed with "root"
+ # root 'welcome#index'
+
+ # Example of regular route:
+ # get 'products/:id' => 'catalog#view'
+
+ # Example of named route that can be invoked with purchase_url(id: product.id)
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
+
+ # Example resource route (maps HTTP verbs to controller actions automatically):
+ # resources :products
+
+ # Example resource route with options:
+ # resources :products do
+ # member do
+ # get 'short'
+ # post 'toggle'
+ # end
+ #
+ # collection do
+ # get 'sold'
+ # end
+ # end
+
+ # Example resource route with sub-resources:
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
+
+ # Example resource route with more complex sub-resources:
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get 'recent', on: :collection
+ # end
+ # end
+
+ # Example resource route with concerns:
+ # concern :toggleable do
+ # post 'toggle'
+ # end
+ # resources :posts, concerns: :toggleable
+ # resources :photos, concerns: :toggleable
+
+ # Example resource route within a namespace:
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
+ # end
+end
diff --git a/harshilp/rails_tdd/modelSpec/config/secrets.yml b/harshilp/rails_tdd/modelSpec/config/secrets.yml
new file mode 100644
index 0000000..7c1a5d0
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/config/secrets.yml
@@ -0,0 +1,22 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key is used for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+# You can use `rake secret` to generate a secure secret key.
+
+# Make sure the secrets in this file are kept private
+# if you're sharing your code publicly.
+
+development:
+ secret_key_base: 28ab1ee2f10e3eed441ab2332c3c5283a3c406d4c20a708bde0db6cc3497cbc6e21f5d5190c11b5a3892379f39ab2e5c9fda8f445402e7054b6f85abc5aa6883
+
+test:
+ secret_key_base: a4485d2279be028c8b93bd4be851bab346bd0546ea1fbf3b2b7e94dff56657833bc00baad1a77636ada8036c28727920e90db0b4ea904a5069e5216ebfe017da
+
+# Do not keep production secrets in the repository,
+# instead read values from the environment.
+production:
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
diff --git a/harshilp/rails_tdd/modelSpec/db/migrate/20171207185330_create_users.rb b/harshilp/rails_tdd/modelSpec/db/migrate/20171207185330_create_users.rb
new file mode 100644
index 0000000..cc285fe
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/db/migrate/20171207185330_create_users.rb
@@ -0,0 +1,11 @@
+class CreateUsers < ActiveRecord::Migration
+ def change
+ create_table :users do |t|
+ t.string :first_name
+ t.string :last_name
+ t.string :email
+
+ t.timestamps null: false
+ end
+ end
+end
diff --git a/harshilp/rails_tdd/modelSpec/db/schema.rb b/harshilp/rails_tdd/modelSpec/db/schema.rb
new file mode 100644
index 0000000..a91f9ae
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/db/schema.rb
@@ -0,0 +1,24 @@
+# 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: 20171207185330) do
+
+ create_table "users", force: :cascade do |t|
+ t.string "first_name"
+ t.string "last_name"
+ t.string "email"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+end
diff --git a/harshilp/rails_tdd/modelSpec/db/seeds.rb b/harshilp/rails_tdd/modelSpec/db/seeds.rb
new file mode 100644
index 0000000..4edb1e8
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/db/seeds.rb
@@ -0,0 +1,7 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#
+# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
+# Mayor.create(name: 'Emanuel', city: cities.first)
diff --git a/harshilp/rails_tdd/modelSpec/lib/assets/.keep b/harshilp/rails_tdd/modelSpec/lib/assets/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/lib/tasks/.keep b/harshilp/rails_tdd/modelSpec/lib/tasks/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/log/.keep b/harshilp/rails_tdd/modelSpec/log/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/public/404.html b/harshilp/rails_tdd/modelSpec/public/404.html
new file mode 100644
index 0000000..b612547
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/public/404.html
@@ -0,0 +1,67 @@
+
+
+
+ The page you were looking for doesn't exist (404)
+
+
+
+
+
+
+
+
+
The page you were looking for doesn't exist.
+
You may have mistyped the address or the page may have moved.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/harshilp/rails_tdd/modelSpec/public/422.html b/harshilp/rails_tdd/modelSpec/public/422.html
new file mode 100644
index 0000000..a21f82b
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/public/422.html
@@ -0,0 +1,67 @@
+
+
+
+ The change you wanted was rejected (422)
+
+
+
+
+
+
+
+
+
The change you wanted was rejected.
+
Maybe you tried to change something you didn't have access to.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/harshilp/rails_tdd/modelSpec/public/500.html b/harshilp/rails_tdd/modelSpec/public/500.html
new file mode 100644
index 0000000..061abc5
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/public/500.html
@@ -0,0 +1,66 @@
+
+
+
+ We're sorry, but something went wrong (500)
+
+
+
+
+
+
+
+
+
We're sorry, but something went wrong.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/harshilp/rails_tdd/modelSpec/public/favicon.ico b/harshilp/rails_tdd/modelSpec/public/favicon.ico
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/public/robots.txt b/harshilp/rails_tdd/modelSpec/public/robots.txt
new file mode 100644
index 0000000..3c9c7c0
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/public/robots.txt
@@ -0,0 +1,5 @@
+# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
+#
+# To ban all spiders from the entire site uncomment the next two lines:
+# User-agent: *
+# Disallow: /
diff --git a/harshilp/rails_tdd/modelSpec/spec/models/user_spec.rb b/harshilp/rails_tdd/modelSpec/spec/models/user_spec.rb
new file mode 100644
index 0000000..4f2dc6d
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/spec/models/user_spec.rb
@@ -0,0 +1,52 @@
+require 'rails_helper'
+RSpec.describe User, type: :model do
+ context "With valid attributes" do
+ it "should save" do
+ user = User.new(
+ first_name: 'shane',
+ last_name: 'chang',
+ email: 'schang@codingdojo.com'
+ )
+ expect(user).to be_valid
+ end
+ end
+
+ context "With invalid attributes" do
+ it "should not save if first_name field is blank" do
+ user = User.new(
+ first_name: "",
+ last_name: 'chang',
+ email: 'schang@codingdojo.com')
+ expect(user).to be_invalid
+ end
+
+ it "should not save if last_name field is blank" do
+ user = User.new(
+ first_name: "S",
+ last_name: '',
+ email: 'schang@codingdojo.com')
+ expect(user).to be_invalid
+ end
+
+ it "should not save if email already exists" do
+ User.create(
+ first_name: "S",
+ last_name: 'chang',
+ email: 'schang@codingdojo.com')
+ user = User.new(
+ first_name: "S",
+ last_name: 'chang',
+ email: 'schang@codingdojo.com')
+ expect(user).to be_invalid
+ end
+
+ it "should contain a valid email" do
+ user = User.new(
+ first_name: "S",
+ last_name: 'chang',
+ email: 'schangcodingdojo.com')
+ expect(user).to be_invalid
+ end
+
+ end
+end
diff --git a/harshilp/rails_tdd/modelSpec/spec/rails_helper.rb b/harshilp/rails_tdd/modelSpec/spec/rails_helper.rb
new file mode 100644
index 0000000..bbe1ba5
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/spec/rails_helper.rb
@@ -0,0 +1,57 @@
+# This file is copied to spec/ when you run 'rails generate rspec:install'
+require 'spec_helper'
+ENV['RAILS_ENV'] ||= 'test'
+require File.expand_path('../../config/environment', __FILE__)
+# Prevent database truncation if the environment is production
+abort("The Rails environment is running in production mode!") if Rails.env.production?
+require 'rspec/rails'
+# Add additional requires below this line. Rails is not loaded until this point!
+
+# Requires supporting ruby files with custom matchers and macros, etc, in
+# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
+# run as spec files by default. This means that files in spec/support that end
+# in _spec.rb will both be required and run as specs, causing the specs to be
+# run twice. It is recommended that you do not name files matching this glob to
+# end with _spec.rb. You can configure this pattern with the --pattern
+# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
+#
+# The following line is provided for convenience purposes. It has the downside
+# of increasing the boot-up time by auto-requiring all files in the support
+# directory. Alternatively, in the individual `*_spec.rb` files, manually
+# require only the support files necessary.
+#
+# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
+
+# Checks for pending migrations and applies them before tests are run.
+# If you are not using ActiveRecord, you can remove this line.
+ActiveRecord::Migration.maintain_test_schema!
+
+RSpec.configure do |config|
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+
+ # RSpec Rails can automatically mix in different behaviours to your tests
+ # based on their file location, for example enabling you to call `get` and
+ # `post` in specs under `spec/controllers`.
+ #
+ # You can disable this behaviour by removing the line below, and instead
+ # explicitly tag your specs with their type, e.g.:
+ #
+ # RSpec.describe UsersController, :type => :controller do
+ # # ...
+ # end
+ #
+ # The different available types are documented in the features, such as in
+ # https://relishapp.com/rspec/rspec-rails/docs
+ config.infer_spec_type_from_file_location!
+
+ # Filter lines from Rails gems in backtraces.
+ config.filter_rails_from_backtrace!
+ # arbitrary gems may also be filtered via:
+ # config.filter_gems_from_backtrace("gem name")
+end
diff --git a/harshilp/rails_tdd/modelSpec/spec/spec_helper.rb b/harshilp/rails_tdd/modelSpec/spec/spec_helper.rb
new file mode 100644
index 0000000..ce33d66
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/spec/spec_helper.rb
@@ -0,0 +1,96 @@
+# This file was generated by the `rails generate rspec:install` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# The generated `.rspec` file contains `--require spec_helper` which will cause
+# this file to always be loaded, without a need to explicitly require it in any
+# files.
+#
+# Given that it is always loaded, you are encouraged to keep this file as
+# light-weight as possible. Requiring heavyweight dependencies from this file
+# will add to the boot time of your test suite on EVERY test run, even for an
+# individual file that may not need all of that loaded. Instead, consider making
+# a separate helper file that requires the additional dependencies and performs
+# the additional setup, and require it from the spec files that actually need
+# it.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+RSpec.configure do |config|
+ # rspec-expectations config goes here. You can use an alternate
+ # assertion/expectation library such as wrong or the stdlib/minitest
+ # assertions if you prefer.
+ config.expect_with :rspec do |expectations|
+ # This option will default to `true` in RSpec 4. It makes the `description`
+ # and `failure_message` of custom matchers include text for helper methods
+ # defined using `chain`, e.g.:
+ # be_bigger_than(2).and_smaller_than(4).description
+ # # => "be bigger than 2 and smaller than 4"
+ # ...rather than:
+ # # => "be bigger than 2"
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
+ end
+
+ # rspec-mocks config goes here. You can use an alternate test double
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
+ config.mock_with :rspec do |mocks|
+ # Prevents you from mocking or stubbing a method that does not exist on
+ # a real object. This is generally recommended, and will default to
+ # `true` in RSpec 4.
+ mocks.verify_partial_doubles = true
+ end
+
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
+ # have no way to turn it off -- the option exists only for backwards
+ # compatibility in RSpec 3). It causes shared context metadata to be
+ # inherited by the metadata hash of host groups and examples, rather than
+ # triggering implicit auto-inclusion in groups with matching metadata.
+ config.shared_context_metadata_behavior = :apply_to_host_groups
+
+# The settings below are suggested to provide a good initial experience
+# with RSpec, but feel free to customize to your heart's content.
+=begin
+ # This allows you to limit a spec run to individual examples or groups
+ # you care about by tagging them with `:focus` metadata. When nothing
+ # is tagged with `:focus`, all examples get run. RSpec also provides
+ # aliases for `it`, `describe`, and `context` that include `:focus`
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
+ config.filter_run_when_matching :focus
+
+ # Allows RSpec to persist some state between runs in order to support
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
+ # you configure your source control system to ignore this file.
+ config.example_status_persistence_file_path = "spec/examples.txt"
+
+ # Limits the available syntax to the non-monkey patched syntax that is
+ # recommended. For more details, see:
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
+ config.disable_monkey_patching!
+
+ # Many RSpec users commonly either run the entire suite or an individual
+ # file, and it's useful to allow more verbose output when running an
+ # individual spec file.
+ if config.files_to_run.one?
+ # Use the documentation formatter for detailed output,
+ # unless a formatter has already been configured
+ # (e.g. via a command-line flag).
+ config.default_formatter = "doc"
+ end
+
+ # Print the 10 slowest examples and example groups at the
+ # end of the spec run, to help surface which specs are running
+ # particularly slow.
+ config.profile_examples = 10
+
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = :random
+
+ # Seed global randomization in this process using the `--seed` CLI option.
+ # Setting this allows you to use `--seed` to deterministically reproduce
+ # test failures related to randomization by passing the same `--seed` value
+ # as the one that triggered the failure.
+ Kernel.srand config.seed
+=end
+end
diff --git a/harshilp/rails_tdd/modelSpec/test/controllers/.keep b/harshilp/rails_tdd/modelSpec/test/controllers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/test/fixtures/.keep b/harshilp/rails_tdd/modelSpec/test/fixtures/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/test/helpers/.keep b/harshilp/rails_tdd/modelSpec/test/helpers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/test/integration/.keep b/harshilp/rails_tdd/modelSpec/test/integration/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/test/mailers/.keep b/harshilp/rails_tdd/modelSpec/test/mailers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/test/models/.keep b/harshilp/rails_tdd/modelSpec/test/models/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/test/test_helper.rb b/harshilp/rails_tdd/modelSpec/test/test_helper.rb
new file mode 100644
index 0000000..92e39b2
--- /dev/null
+++ b/harshilp/rails_tdd/modelSpec/test/test_helper.rb
@@ -0,0 +1,10 @@
+ENV['RAILS_ENV'] ||= 'test'
+require File.expand_path('../../config/environment', __FILE__)
+require 'rails/test_help'
+
+class ActiveSupport::TestCase
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
+ fixtures :all
+
+ # Add more helper methods to be used by all tests here...
+end
diff --git a/harshilp/rails_tdd/modelSpec/vendor/assets/javascripts/.keep b/harshilp/rails_tdd/modelSpec/vendor/assets/javascripts/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/modelSpec/vendor/assets/stylesheets/.keep b/harshilp/rails_tdd/modelSpec/vendor/assets/stylesheets/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/.gitignore b/harshilp/rails_tdd/wall/.gitignore
new file mode 100644
index 0000000..050c9d9
--- /dev/null
+++ b/harshilp/rails_tdd/wall/.gitignore
@@ -0,0 +1,17 @@
+# See https://help.github.com/articles/ignoring-files for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile '~/.gitignore_global'
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore the default SQLite database.
+/db/*.sqlite3
+/db/*.sqlite3-journal
+
+# Ignore all logfiles and tempfiles.
+/log/*
+!/log/.keep
+/tmp
diff --git a/harshilp/rails_tdd/wall/.rspec b/harshilp/rails_tdd/wall/.rspec
new file mode 100644
index 0000000..c99d2e7
--- /dev/null
+++ b/harshilp/rails_tdd/wall/.rspec
@@ -0,0 +1 @@
+--require spec_helper
diff --git a/harshilp/rails_tdd/wall/Gemfile b/harshilp/rails_tdd/wall/Gemfile
new file mode 100644
index 0000000..970dc7c
--- /dev/null
+++ b/harshilp/rails_tdd/wall/Gemfile
@@ -0,0 +1,50 @@
+source 'https://rubygems.org'
+
+
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
+gem 'rails', '4.2.7'
+# Use sqlite3 as the database for Active Record
+gem 'sqlite3'
+# Use SCSS for stylesheets
+gem 'sass-rails', '~> 5.0'
+# Use Uglifier as compressor for JavaScript assets
+gem 'uglifier', '>= 1.3.0'
+# Use CoffeeScript for .coffee assets and views
+gem 'coffee-rails', '~> 4.1.0'
+# See https://github.com/rails/execjs#readme for more supported runtimes
+# gem 'therubyracer', platforms: :ruby
+gem 'hirb'
+# Use jquery as the JavaScript library
+gem 'jquery-rails'
+# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
+gem 'turbolinks'
+# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
+gem 'jbuilder', '~> 2.0'
+# bundle exec rake doc:rails generates the API under doc/api.
+gem 'sdoc', '~> 0.4.0', group: :doc
+gem 'rails-footnotes'
+# Use ActiveModel has_secure_password
+# gem 'bcrypt', '~> 3.1.7'
+
+# Use Unicorn as the app server
+# gem 'unicorn'
+
+# Use Capistrano for deployment
+# gem 'capistrano-rails', group: :development
+
+group :development, :test do
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
+ gem 'rspec-rails'
+ gem 'factory_girl_rails'
+ gem 'capybara'
+ gem 'byebug'
+end
+
+group :development do
+ # Access an IRB console on exception pages or by using <%= console %> in views
+ gem 'web-console', '~> 2.0'
+
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
+ gem 'spring'
+end
+
diff --git a/harshilp/rails_tdd/wall/Gemfile.lock b/harshilp/rails_tdd/wall/Gemfile.lock
new file mode 100644
index 0000000..326af8d
--- /dev/null
+++ b/harshilp/rails_tdd/wall/Gemfile.lock
@@ -0,0 +1,213 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (4.2.7)
+ actionpack (= 4.2.7)
+ actionview (= 4.2.7)
+ activejob (= 4.2.7)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ actionpack (4.2.7)
+ actionview (= 4.2.7)
+ activesupport (= 4.2.7)
+ rack (~> 1.6)
+ rack-test (~> 0.6.2)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (4.2.7)
+ activesupport (= 4.2.7)
+ builder (~> 3.1)
+ erubis (~> 2.7.0)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ activejob (4.2.7)
+ activesupport (= 4.2.7)
+ globalid (>= 0.3.0)
+ activemodel (4.2.7)
+ activesupport (= 4.2.7)
+ builder (~> 3.1)
+ activerecord (4.2.7)
+ activemodel (= 4.2.7)
+ activesupport (= 4.2.7)
+ arel (~> 6.0)
+ activesupport (4.2.7)
+ i18n (~> 0.7)
+ json (~> 1.7, >= 1.7.7)
+ minitest (~> 5.1)
+ thread_safe (~> 0.3, >= 0.3.4)
+ tzinfo (~> 1.1)
+ addressable (2.5.2)
+ public_suffix (>= 2.0.2, < 4.0)
+ arel (6.0.4)
+ binding_of_caller (0.7.3)
+ debug_inspector (>= 0.0.1)
+ builder (3.2.3)
+ byebug (9.1.0)
+ capybara (2.16.1)
+ addressable
+ mini_mime (>= 0.1.3)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ xpath (~> 2.0)
+ coffee-rails (4.1.1)
+ coffee-script (>= 2.2.0)
+ railties (>= 4.0.0, < 5.1.x)
+ coffee-script (2.4.1)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.12.2)
+ concurrent-ruby (1.0.5)
+ crass (1.0.3)
+ debug_inspector (0.0.3)
+ diff-lcs (1.3)
+ erubis (2.7.0)
+ execjs (2.7.0)
+ factory_girl (4.9.0)
+ activesupport (>= 3.0.0)
+ factory_girl_rails (4.9.0)
+ factory_girl (~> 4.9.0)
+ railties (>= 3.0.0)
+ ffi (1.9.18)
+ globalid (0.4.1)
+ activesupport (>= 4.2.0)
+ hirb (0.7.3)
+ i18n (0.9.1)
+ concurrent-ruby (~> 1.0)
+ jbuilder (2.7.0)
+ activesupport (>= 4.2.0)
+ multi_json (>= 1.2)
+ jquery-rails (4.3.1)
+ rails-dom-testing (>= 1, < 3)
+ railties (>= 4.2.0)
+ thor (>= 0.14, < 2.0)
+ json (1.8.6)
+ loofah (2.1.1)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.5.9)
+ mail (2.7.0)
+ mini_mime (>= 0.1.1)
+ mini_mime (1.0.0)
+ mini_portile2 (2.3.0)
+ minitest (5.10.3)
+ multi_json (1.12.2)
+ nokogiri (1.8.1)
+ mini_portile2 (~> 2.3.0)
+ public_suffix (3.0.1)
+ rack (1.6.8)
+ rack-test (0.6.3)
+ rack (>= 1.0)
+ rails (4.2.7)
+ actionmailer (= 4.2.7)
+ actionpack (= 4.2.7)
+ actionview (= 4.2.7)
+ activejob (= 4.2.7)
+ activemodel (= 4.2.7)
+ activerecord (= 4.2.7)
+ activesupport (= 4.2.7)
+ bundler (>= 1.3.0, < 2.0)
+ railties (= 4.2.7)
+ sprockets-rails
+ rails-deprecated_sanitizer (1.0.3)
+ activesupport (>= 4.2.0.alpha)
+ rails-dom-testing (1.0.8)
+ activesupport (>= 4.2.0.beta, < 5.0)
+ nokogiri (~> 1.6)
+ rails-deprecated_sanitizer (>= 1.0.1)
+ rails-footnotes (4.1.8)
+ rails (>= 3.2)
+ rails-html-sanitizer (1.0.3)
+ loofah (~> 2.0)
+ railties (4.2.7)
+ actionpack (= 4.2.7)
+ activesupport (= 4.2.7)
+ rake (>= 0.8.7)
+ thor (>= 0.18.1, < 2.0)
+ rake (12.3.0)
+ rb-fsevent (0.10.2)
+ rb-inotify (0.9.10)
+ ffi (>= 0.5.0, < 2)
+ rdoc (4.3.0)
+ rspec-core (3.7.0)
+ rspec-support (~> 3.7.0)
+ rspec-expectations (3.7.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.7.0)
+ rspec-mocks (3.7.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.7.0)
+ rspec-rails (3.7.2)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec-core (~> 3.7.0)
+ rspec-expectations (~> 3.7.0)
+ rspec-mocks (~> 3.7.0)
+ rspec-support (~> 3.7.0)
+ rspec-support (3.7.0)
+ sass (3.5.3)
+ sass-listen (~> 4.0.0)
+ sass-listen (4.0.0)
+ rb-fsevent (~> 0.9, >= 0.9.4)
+ rb-inotify (~> 0.9, >= 0.9.7)
+ sass-rails (5.0.7)
+ railties (>= 4.0.0, < 6)
+ sass (~> 3.1)
+ sprockets (>= 2.8, < 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+ tilt (>= 1.1, < 3)
+ sdoc (0.4.2)
+ json (~> 1.7, >= 1.7.7)
+ rdoc (~> 4.0)
+ spring (2.0.2)
+ activesupport (>= 4.2)
+ sprockets (3.7.1)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.2.1)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
+ sqlite3 (1.3.13)
+ thor (0.20.0)
+ thread_safe (0.3.6)
+ tilt (2.0.8)
+ turbolinks (5.0.1)
+ turbolinks-source (~> 5)
+ turbolinks-source (5.0.3)
+ tzinfo (1.2.4)
+ thread_safe (~> 0.1)
+ uglifier (4.0.1)
+ execjs (>= 0.3.0, < 3)
+ web-console (2.3.0)
+ activemodel (>= 4.0)
+ binding_of_caller (>= 0.7.2)
+ railties (>= 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+ xpath (2.1.0)
+ nokogiri (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ byebug
+ capybara
+ coffee-rails (~> 4.1.0)
+ factory_girl_rails
+ hirb
+ jbuilder (~> 2.0)
+ jquery-rails
+ rails (= 4.2.7)
+ rails-footnotes
+ rspec-rails
+ sass-rails (~> 5.0)
+ sdoc (~> 0.4.0)
+ spring
+ sqlite3
+ turbolinks
+ uglifier (>= 1.3.0)
+ web-console (~> 2.0)
+
+BUNDLED WITH
+ 1.16.0
diff --git a/harshilp/rails_tdd/wall/README.rdoc b/harshilp/rails_tdd/wall/README.rdoc
new file mode 100644
index 0000000..dd4e97e
--- /dev/null
+++ b/harshilp/rails_tdd/wall/README.rdoc
@@ -0,0 +1,28 @@
+== README
+
+This README would normally document whatever steps are necessary to get the
+application up and running.
+
+Things you may want to cover:
+
+* Ruby version
+
+* System dependencies
+
+* Configuration
+
+* Database creation
+
+* Database initialization
+
+* How to run the test suite
+
+* Services (job queues, cache servers, search engines, etc.)
+
+* Deployment instructions
+
+* ...
+
+
+Please feel free to use a different markup language if you do not plan to run
+rake doc:app.
diff --git a/harshilp/rails_tdd/wall/Rakefile b/harshilp/rails_tdd/wall/Rakefile
new file mode 100644
index 0000000..ba6b733
--- /dev/null
+++ b/harshilp/rails_tdd/wall/Rakefile
@@ -0,0 +1,6 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+Rails.application.load_tasks
diff --git a/harshilp/rails_tdd/wall/app/assets/images/.keep b/harshilp/rails_tdd/wall/app/assets/images/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/app/assets/javascripts/application.js b/harshilp/rails_tdd/wall/app/assets/javascripts/application.js
new file mode 100644
index 0000000..e07c5a8
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/assets/javascripts/application.js
@@ -0,0 +1,16 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// compiled file.
+//
+// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
+// about supported directives.
+//
+//= require jquery
+//= require jquery_ujs
+//= require turbolinks
+//= require_tree .
diff --git a/harshilp/rails_tdd/wall/app/assets/javascripts/comments.coffee b/harshilp/rails_tdd/wall/app/assets/javascripts/comments.coffee
new file mode 100644
index 0000000..24f83d1
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/assets/javascripts/comments.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/harshilp/rails_tdd/wall/app/assets/javascripts/messages.coffee b/harshilp/rails_tdd/wall/app/assets/javascripts/messages.coffee
new file mode 100644
index 0000000..24f83d1
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/assets/javascripts/messages.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/harshilp/rails_tdd/wall/app/assets/javascripts/users.coffee b/harshilp/rails_tdd/wall/app/assets/javascripts/users.coffee
new file mode 100644
index 0000000..24f83d1
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/assets/javascripts/users.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/harshilp/rails_tdd/wall/app/assets/stylesheets/application.css b/harshilp/rails_tdd/wall/app/assets/stylesheets/application.css
new file mode 100644
index 0000000..f9cd5b3
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/assets/stylesheets/application.css
@@ -0,0 +1,15 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
+ * compiled file so the styles you add here take precedence over styles defined in any styles
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
+ * file per style scope.
+ *
+ *= require_tree .
+ *= require_self
+ */
diff --git a/harshilp/rails_tdd/wall/app/assets/stylesheets/comments.scss b/harshilp/rails_tdd/wall/app/assets/stylesheets/comments.scss
new file mode 100644
index 0000000..e730912
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/assets/stylesheets/comments.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Comments controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/harshilp/rails_tdd/wall/app/assets/stylesheets/messages.scss b/harshilp/rails_tdd/wall/app/assets/stylesheets/messages.scss
new file mode 100644
index 0000000..63b0b59
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/assets/stylesheets/messages.scss
@@ -0,0 +1,50 @@
+// Place all the styles related to the Messages controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+.message{
+ width:95%;
+ padding:10px;
+ border:1px solid black;
+ margin-top:10px;
+}
+.comment{
+ width:82%;
+ margin:auto;
+ border-bottom:1px solid black;
+ margin-bottom:5px;
+}
+
+p{
+ padding-left:10px;
+}
+form{
+ line-height:75px;
+ width:95%;
+}
+textarea{
+ height:60px;
+ width:75%;
+ vertical-align:middle;
+}
+button{
+ vertical-align:middle;
+ width:15%;
+ padding: 5px 10px 5px 10px;
+ border-radius: 5px;
+ border:none;
+ margin-left:5%;
+ background-color:cadetblue;
+}
+#sign{
+ background-color:darkgreen;
+ color:white;
+}
+input{
+ height:30px;
+ border-radius: 2px;
+ border:none;
+ border:1px purple solid;
+}
+.error{
+ color:darkred;
+}
\ No newline at end of file
diff --git a/harshilp/rails_tdd/wall/app/assets/stylesheets/users.scss b/harshilp/rails_tdd/wall/app/assets/stylesheets/users.scss
new file mode 100644
index 0000000..22bdb7c
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/assets/stylesheets/users.scss
@@ -0,0 +1,6 @@
+// Place all the styles related to the Users controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+.error{
+ color:darkred;
+}
\ No newline at end of file
diff --git a/harshilp/rails_tdd/wall/app/controllers/application_controller.rb b/harshilp/rails_tdd/wall/app/controllers/application_controller.rb
new file mode 100644
index 0000000..d83690e
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/controllers/application_controller.rb
@@ -0,0 +1,5 @@
+class ApplicationController < ActionController::Base
+ # Prevent CSRF attacks by raising an exception.
+ # For APIs, you may want to use :null_session instead.
+ protect_from_forgery with: :exception
+end
diff --git a/harshilp/rails_tdd/wall/app/controllers/comments_controller.rb b/harshilp/rails_tdd/wall/app/controllers/comments_controller.rb
new file mode 100644
index 0000000..003da27
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/controllers/comments_controller.rb
@@ -0,0 +1,11 @@
+class CommentsController < ApplicationController
+ def create
+ @comment = Comment.new(comment:params[:comment])
+ @comment[:user_id] = session[:user]['id']
+ @comment[:message_id] = params[:message_id]
+ if not @comment.save
+ flash[:comerrors] = @comment.errors.full_messages
+ end
+ redirect_to wall_path
+ end
+end
diff --git a/harshilp/rails_tdd/wall/app/controllers/concerns/.keep b/harshilp/rails_tdd/wall/app/controllers/concerns/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/app/controllers/messages_controller.rb b/harshilp/rails_tdd/wall/app/controllers/messages_controller.rb
new file mode 100644
index 0000000..56bd587
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/controllers/messages_controller.rb
@@ -0,0 +1,19 @@
+class MessagesController < ApplicationController
+ def index
+ unless session[:user]
+ return redirect_to index_path
+ end
+ @user = session[:user]
+ @messages = Message.select('messages.*', 'users.username').joins(:user)
+ render 'wall'
+ end
+
+ def create
+ @message = Message.new(message:params[:message])
+ @message[:user_id] = session[:user]['id']
+ if not @message.save
+ flash[:errors] = @message.errors.full_messages
+ end
+ redirect_to wall_path
+ end
+end
diff --git a/harshilp/rails_tdd/wall/app/controllers/users_controller.rb b/harshilp/rails_tdd/wall/app/controllers/users_controller.rb
new file mode 100644
index 0000000..f2895a1
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/controllers/users_controller.rb
@@ -0,0 +1,26 @@
+class UsersController < ApplicationController
+ def index
+ end
+ def create
+ u = User.find_by(username: params[:username])
+ puts u
+ if not u
+ @user = User.new(username:params[:username])
+ if @user.save
+ session[:user] = @user
+ redirect_to wall_path
+ else
+ flash[:errors] = @user.errors.full_messages
+ redirect_to :back
+ end
+ else
+ session[:user] = u
+ redirect_to wall_path
+ end
+ end
+
+ def logout
+ session.delete(:user)
+ redirect_to index_path
+ end
+end
diff --git a/harshilp/rails_tdd/wall/app/helpers/application_helper.rb b/harshilp/rails_tdd/wall/app/helpers/application_helper.rb
new file mode 100644
index 0000000..de6be79
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/harshilp/rails_tdd/wall/app/helpers/comments_helper.rb b/harshilp/rails_tdd/wall/app/helpers/comments_helper.rb
new file mode 100644
index 0000000..0ec9ca5
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/helpers/comments_helper.rb
@@ -0,0 +1,2 @@
+module CommentsHelper
+end
diff --git a/harshilp/rails_tdd/wall/app/helpers/messages_helper.rb b/harshilp/rails_tdd/wall/app/helpers/messages_helper.rb
new file mode 100644
index 0000000..f1bca9f
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/helpers/messages_helper.rb
@@ -0,0 +1,2 @@
+module MessagesHelper
+end
diff --git a/harshilp/rails_tdd/wall/app/helpers/users_helper.rb b/harshilp/rails_tdd/wall/app/helpers/users_helper.rb
new file mode 100644
index 0000000..2310a24
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/helpers/users_helper.rb
@@ -0,0 +1,2 @@
+module UsersHelper
+end
diff --git a/harshilp/rails_tdd/wall/app/mailers/.keep b/harshilp/rails_tdd/wall/app/mailers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/app/models/.keep b/harshilp/rails_tdd/wall/app/models/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/app/models/comment.rb b/harshilp/rails_tdd/wall/app/models/comment.rb
new file mode 100644
index 0000000..7980ef0
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/models/comment.rb
@@ -0,0 +1,6 @@
+class Comment < ActiveRecord::Base
+ belongs_to :user
+ belongs_to :message
+ validates :comment, presence: true, length: {minimum: 6}
+ validates :message, :user, presence: true
+end
diff --git a/harshilp/rails_tdd/wall/app/models/concerns/.keep b/harshilp/rails_tdd/wall/app/models/concerns/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/app/models/message.rb b/harshilp/rails_tdd/wall/app/models/message.rb
new file mode 100644
index 0000000..8a41b8c
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/models/message.rb
@@ -0,0 +1,6 @@
+class Message < ActiveRecord::Base
+ belongs_to :user
+ has_many :comments
+ validates :message, presence: true, length: {minimum: 10}
+ validates :user, presence: true
+end
diff --git a/harshilp/rails_tdd/wall/app/models/user.rb b/harshilp/rails_tdd/wall/app/models/user.rb
new file mode 100644
index 0000000..a383722
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/models/user.rb
@@ -0,0 +1,3 @@
+class User < ActiveRecord::Base
+ validates :username, presence: true, uniqueness: { case_sensitive: false }, length: {minimum: 5}
+end
diff --git a/harshilp/rails_tdd/wall/app/views/layouts/application.html.erb b/harshilp/rails_tdd/wall/app/views/layouts/application.html.erb
new file mode 100644
index 0000000..dcae2f2
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/views/layouts/application.html.erb
@@ -0,0 +1,14 @@
+
+
+
+ Wall
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
+ <%= csrf_meta_tags %>
+
+
+
+<%= yield %>
+
+
+
diff --git a/harshilp/rails_tdd/wall/app/views/messages/wall.html.erb b/harshilp/rails_tdd/wall/app/views/messages/wall.html.erb
new file mode 100644
index 0000000..37882c2
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/views/messages/wall.html.erb
@@ -0,0 +1,37 @@
+
Welcome to the Dojo Wall, <%= @user['username'] %> \_(~.~)_/
+<%= link_to "Log Out", logout_path %>
+
Post a message
+
+<% @messages.each do |mes| %>
+
+ <%= time_ago_in_words(mes.created_at) %> ago by <%= mes.username %>
+
<%= mes.message %>
+
Comments:
+ <% mes.comments.reverse.each do |com| %>
+
+ <%= com.user.username %> @ <%= time_ago_in_words(com.created_at) %> ago
+
<%= com.comment %>
+
+ <% end %>
+
+
+<% end %>
\ No newline at end of file
diff --git a/harshilp/rails_tdd/wall/app/views/users/index.html.erb b/harshilp/rails_tdd/wall/app/views/users/index.html.erb
new file mode 100644
index 0000000..622bd01
--- /dev/null
+++ b/harshilp/rails_tdd/wall/app/views/users/index.html.erb
@@ -0,0 +1,11 @@
+
Sign In
+
\ No newline at end of file
diff --git a/harshilp/rails_tdd/wall/bin/bundle b/harshilp/rails_tdd/wall/bin/bundle
new file mode 100644
index 0000000..66e9889
--- /dev/null
+++ b/harshilp/rails_tdd/wall/bin/bundle
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+load Gem.bin_path('bundler', 'bundle')
diff --git a/harshilp/rails_tdd/wall/bin/rails b/harshilp/rails_tdd/wall/bin/rails
new file mode 100644
index 0000000..0138d79
--- /dev/null
+++ b/harshilp/rails_tdd/wall/bin/rails
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path('../spring', __FILE__)
+rescue LoadError => e
+ raise unless e.message.include?('spring')
+end
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require_relative '../config/boot'
+require 'rails/commands'
diff --git a/harshilp/rails_tdd/wall/bin/rake b/harshilp/rails_tdd/wall/bin/rake
new file mode 100644
index 0000000..d87d5f5
--- /dev/null
+++ b/harshilp/rails_tdd/wall/bin/rake
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path('../spring', __FILE__)
+rescue LoadError => e
+ raise unless e.message.include?('spring')
+end
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run
diff --git a/harshilp/rails_tdd/wall/bin/setup b/harshilp/rails_tdd/wall/bin/setup
new file mode 100644
index 0000000..acdb2c1
--- /dev/null
+++ b/harshilp/rails_tdd/wall/bin/setup
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+Dir.chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file:
+
+ puts "== Installing dependencies =="
+ system "gem install bundler --conservative"
+ system "bundle check || bundle install"
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?("config/database.yml")
+ # system "cp config/database.yml.sample config/database.yml"
+ # end
+
+ puts "\n== Preparing database =="
+ system "bin/rake db:setup"
+
+ puts "\n== Removing old logs and tempfiles =="
+ system "rm -f log/*"
+ system "rm -rf tmp/cache"
+
+ puts "\n== Restarting application server =="
+ system "touch tmp/restart.txt"
+end
diff --git a/harshilp/rails_tdd/wall/bin/spring b/harshilp/rails_tdd/wall/bin/spring
new file mode 100644
index 0000000..fb2ec2e
--- /dev/null
+++ b/harshilp/rails_tdd/wall/bin/spring
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+
+# This file loads spring without using Bundler, in order to be fast.
+# It gets overwritten when you run the `spring binstub` command.
+
+unless defined?(Spring)
+ require 'rubygems'
+ require 'bundler'
+
+ lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
+ spring = lockfile.specs.detect { |spec| spec.name == "spring" }
+ if spring
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
+ gem 'spring', spring.version
+ require 'spring/binstub'
+ end
+end
diff --git a/harshilp/rails_tdd/wall/config.ru b/harshilp/rails_tdd/wall/config.ru
new file mode 100644
index 0000000..bd83b25
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Rails.application
diff --git a/harshilp/rails_tdd/wall/config/application.rb b/harshilp/rails_tdd/wall/config/application.rb
new file mode 100644
index 0000000..8ecfe4c
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/application.rb
@@ -0,0 +1,26 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
+
+module Wall
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # Do not swallow errors in after_commit/after_rollback callbacks.
+ config.active_record.raise_in_transactional_callbacks = true
+ end
+end
diff --git a/harshilp/rails_tdd/wall/config/boot.rb b/harshilp/rails_tdd/wall/config/boot.rb
new file mode 100644
index 0000000..6b750f0
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/boot.rb
@@ -0,0 +1,3 @@
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' # Set up gems listed in the Gemfile.
diff --git a/harshilp/rails_tdd/wall/config/database.yml b/harshilp/rails_tdd/wall/config/database.yml
new file mode 100644
index 0000000..1c1a37c
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/database.yml
@@ -0,0 +1,25 @@
+# SQLite version 3.x
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem 'sqlite3'
+#
+default: &default
+ adapter: sqlite3
+ pool: 5
+ timeout: 5000
+
+development:
+ <<: *default
+ database: db/development.sqlite3
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ <<: *default
+ database: db/test.sqlite3
+
+production:
+ <<: *default
+ database: db/production.sqlite3
diff --git a/harshilp/rails_tdd/wall/config/environment.rb b/harshilp/rails_tdd/wall/config/environment.rb
new file mode 100644
index 0000000..ee8d90d
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the Rails application.
+require File.expand_path('../application', __FILE__)
+
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/harshilp/rails_tdd/wall/config/environments/development.rb b/harshilp/rails_tdd/wall/config/environments/development.rb
new file mode 100644
index 0000000..45b1759
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/environments/development.rb
@@ -0,0 +1,41 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.cache_classes = false
+
+ # Do not eager load code on boot.
+ config.eager_load = false
+ config.reload_classes_only_on_change = false
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send.
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger.
+ config.active_support.deprecation = :log
+
+ # Raise an error on page load if there are pending migrations.
+ config.active_record.migration_error = :page_load
+
+ # Debug mode disables concatenation and preprocessing of assets.
+ # This option may cause significant delays in view rendering with a large
+ # number of complex assets.
+ config.assets.debug = true
+
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
+ config.assets.digest = true
+
+ # Adds additional error checking when serving assets at runtime.
+ # Checks for improperly declared sprockets dependencies.
+ # Raises helpful error messages.
+ config.assets.raise_runtime_errors = true
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
+end
diff --git a/harshilp/rails_tdd/wall/config/environments/production.rb b/harshilp/rails_tdd/wall/config/environments/production.rb
new file mode 100644
index 0000000..5c1b32e
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/environments/production.rb
@@ -0,0 +1,79 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Code is not reloaded between requests.
+ config.cache_classes = true
+
+ # Eager load code on boot. This eager loads most of Rails and
+ # your application in memory, allowing both threaded web servers
+ # and those relying on copy on write to perform better.
+ # Rake tasks automatically ignore this option for performance.
+ config.eager_load = true
+
+ # Full error reports are disabled and caching is turned on.
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
+ # Add `rack-cache` to your Gemfile before enabling this.
+ # For large-scale production use, consider using a caching reverse proxy like
+ # NGINX, varnish or squid.
+ # config.action_dispatch.rack_cache = true
+
+ # Disable serving static files from the `/public` folder by default since
+ # Apache or NGINX already handles this.
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
+
+ # Compress JavaScripts and CSS.
+ config.assets.js_compressor = :uglifier
+ # config.assets.css_compressor = :sass
+
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
+ config.assets.compile = false
+
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
+ config.assets.digest = true
+
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
+
+ # Specifies the header that your server uses for sending files.
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
+
+ # Use the lowest log level to ensure availability of diagnostic information
+ # when problems arise.
+ config.log_level = :debug
+
+ # Prepend all log lines with the following tags.
+ # config.log_tags = [ :subdomain, :uuid ]
+
+ # Use a different logger for distributed setups.
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
+
+ # Use a different cache store in production.
+ # config.cache_store = :mem_cache_store
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.action_controller.asset_host = 'http://assets.example.com'
+
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners.
+ config.active_support.deprecation = :notify
+
+ # Use default logging formatter so that PID and timestamp are not suppressed.
+ config.log_formatter = ::Logger::Formatter.new
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+end
diff --git a/harshilp/rails_tdd/wall/config/environments/test.rb b/harshilp/rails_tdd/wall/config/environments/test.rb
new file mode 100644
index 0000000..1c19f08
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/environments/test.rb
@@ -0,0 +1,42 @@
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
+
+ # Do not eager load code on boot. This avoids loading your whole application
+ # just for the purpose of running a single test. If you are using a tool that
+ # preloads Rails for running tests, you may have to set it to true.
+ config.eager_load = false
+
+ # Configure static file server for tests with Cache-Control for performance.
+ config.serve_static_files = true
+ config.static_cache_control = 'public, max-age=3600'
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Raise exceptions instead of rendering exception templates.
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Randomize the order test cases are executed.
+ config.active_support.test_order = :random
+
+ # Print deprecation notices to the stderr.
+ config.active_support.deprecation = :stderr
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
+end
diff --git a/harshilp/rails_tdd/wall/config/initializers/assets.rb b/harshilp/rails_tdd/wall/config/initializers/assets.rb
new file mode 100644
index 0000000..01ef3e6
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/initializers/assets.rb
@@ -0,0 +1,11 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = '1.0'
+
+# Add additional assets to the asset load path
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
+# Rails.application.config.assets.precompile += %w( search.js )
diff --git a/harshilp/rails_tdd/wall/config/initializers/backtrace_silencers.rb b/harshilp/rails_tdd/wall/config/initializers/backtrace_silencers.rb
new file mode 100644
index 0000000..59385cd
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/initializers/backtrace_silencers.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
diff --git a/harshilp/rails_tdd/wall/config/initializers/cookies_serializer.rb b/harshilp/rails_tdd/wall/config/initializers/cookies_serializer.rb
new file mode 100644
index 0000000..7f70458
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/initializers/cookies_serializer.rb
@@ -0,0 +1,3 @@
+# Be sure to restart your server when you modify this file.
+
+Rails.application.config.action_dispatch.cookies_serializer = :json
diff --git a/harshilp/rails_tdd/wall/config/initializers/filter_parameter_logging.rb b/harshilp/rails_tdd/wall/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 0000000..4a994e1
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,4 @@
+# Be sure to restart your server when you modify this file.
+
+# Configure sensitive parameters which will be filtered from the log file.
+Rails.application.config.filter_parameters += [:password]
diff --git a/harshilp/rails_tdd/wall/config/initializers/inflections.rb b/harshilp/rails_tdd/wall/config/initializers/inflections.rb
new file mode 100644
index 0000000..ac033bf
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/initializers/inflections.rb
@@ -0,0 +1,16 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.plural /^(ox)$/i, '\1en'
+# inflect.singular /^(ox)en/i, '\1'
+# inflect.irregular 'person', 'people'
+# inflect.uncountable %w( fish sheep )
+# end
+
+# These inflection rules are supported but not enabled by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.acronym 'RESTful'
+# end
diff --git a/harshilp/rails_tdd/wall/config/initializers/mime_types.rb b/harshilp/rails_tdd/wall/config/initializers/mime_types.rb
new file mode 100644
index 0000000..dc18996
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/initializers/mime_types.rb
@@ -0,0 +1,4 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
diff --git a/harshilp/rails_tdd/wall/config/initializers/rails_footnotes.rb b/harshilp/rails_tdd/wall/config/initializers/rails_footnotes.rb
new file mode 100644
index 0000000..9a15363
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/initializers/rails_footnotes.rb
@@ -0,0 +1,27 @@
+defined?(Footnotes) && Footnotes.setup do |f|
+ # Whether or not to enable footnotes
+ f.enabled = Rails.env.development?
+ # You can also use a lambda / proc to conditionally toggle footnotes
+ # Example :
+ # f.enabled = -> { User.current.admin? }
+ # Beware of thread-safety though, Footnotes.enabled is NOT thread safe
+ # and should not be modified anywhere else.
+
+ # Only toggle some notes :
+ # f.notes = [:session, :cookies, :params, :filters, :routes, :env, :queries, :log]
+
+ # Change the prefix :
+ # f.prefix = 'mvim://open?url=file://%s&line=%d&column=%d'
+
+ # Disable style :
+ # f.no_style = true
+
+ # Lock notes to top right :
+ # f.lock_top_right = true
+
+ # Change font size :
+ # f.font_size = '11px'
+
+ # Allow to open multiple notes :
+ # f.multiple_notes = true
+end
diff --git a/harshilp/rails_tdd/wall/config/initializers/session_store.rb b/harshilp/rails_tdd/wall/config/initializers/session_store.rb
new file mode 100644
index 0000000..ccb3b46
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/initializers/session_store.rb
@@ -0,0 +1,3 @@
+# Be sure to restart your server when you modify this file.
+
+Rails.application.config.session_store :cookie_store, key: '_wall_session'
diff --git a/harshilp/rails_tdd/wall/config/initializers/wrap_parameters.rb b/harshilp/rails_tdd/wall/config/initializers/wrap_parameters.rb
new file mode 100644
index 0000000..33725e9
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/initializers/wrap_parameters.rb
@@ -0,0 +1,14 @@
+# Be sure to restart your server when you modify this file.
+
+# This file contains settings for ActionController::ParamsWrapper which
+# is enabled by default.
+
+# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
+ActiveSupport.on_load(:action_controller) do
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
+end
+
+# To enable root element in JSON for ActiveRecord objects.
+# ActiveSupport.on_load(:active_record) do
+# self.include_root_in_json = true
+# end
diff --git a/harshilp/rails_tdd/wall/config/locales/en.yml b/harshilp/rails_tdd/wall/config/locales/en.yml
new file mode 100644
index 0000000..0653957
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/locales/en.yml
@@ -0,0 +1,23 @@
+# Files in the config/locales directory are used for internationalization
+# and are automatically loaded by Rails. If you want to use locales other
+# than English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t 'hello'
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t('hello') %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# To learn more, please read the Rails Internationalization guide
+# available at http://guides.rubyonrails.org/i18n.html.
+
+en:
+ hello: "Hello world"
diff --git a/harshilp/rails_tdd/wall/config/routes.rb b/harshilp/rails_tdd/wall/config/routes.rb
new file mode 100644
index 0000000..5ed1ed2
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/routes.rb
@@ -0,0 +1,63 @@
+Rails.application.routes.draw do
+ get '' => 'users#index', as: 'index'
+ post 'users/create' => 'users#create', as: 'new_user'
+ get 'wall' => 'messages#index', as: 'wall'
+ post 'wall/messages/new' => 'messages#create', as: 'new_message'
+ post 'wall/comments/new' => 'comments#create', as: 'new_comment'
+ get 'users/logout' => 'users#logout', as: 'logout'
+
+ # The priority is based upon order of creation: first created -> highest priority.
+ # See how all your routes lay out with "rake routes".
+
+ # You can have the root of your site routed with "root"
+ # root 'welcome#index'
+
+ # Example of regular route:
+ # get 'products/:id' => 'catalog#view'
+
+ # Example of named route that can be invoked with purchase_url(id: product.id)
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
+
+ # Example resource route (maps HTTP verbs to controller actions automatically):
+ # resources :products
+
+ # Example resource route with options:
+ # resources :products do
+ # member do
+ # get 'short'
+ # post 'toggle'
+ # end
+ #
+ # collection do
+ # get 'sold'
+ # end
+ # end
+
+ # Example resource route with sub-resources:
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
+
+ # Example resource route with more complex sub-resources:
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get 'recent', on: :collection
+ # end
+ # end
+
+ # Example resource route with concerns:
+ # concern :toggleable do
+ # post 'toggle'
+ # end
+ # resources :posts, concerns: :toggleable
+ # resources :photos, concerns: :toggleable
+
+ # Example resource route within a namespace:
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
+ # end
+end
diff --git a/harshilp/rails_tdd/wall/config/secrets.yml b/harshilp/rails_tdd/wall/config/secrets.yml
new file mode 100644
index 0000000..760a1c7
--- /dev/null
+++ b/harshilp/rails_tdd/wall/config/secrets.yml
@@ -0,0 +1,22 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key is used for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+# You can use `rake secret` to generate a secure secret key.
+
+# Make sure the secrets in this file are kept private
+# if you're sharing your code publicly.
+
+development:
+ secret_key_base: 78af54bd94fd50a8ab3705be68cd5a4dc60dc4a57f4cbb243bdfaef02d053207e4d3e8e9fb1bf344441a55acf2343cdaa7991d066dbf639d7601f3d95fc910aa
+
+test:
+ secret_key_base: b00b5767da9c29b0816d2040c796cc587fb68bb11ba9148f609c6919fa6657822a593debf01b97dfc96bd9cb13150d5ad7422f047791ce30716499a594e5ddda
+
+# Do not keep production secrets in the repository,
+# instead read values from the environment.
+production:
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
diff --git a/harshilp/rails_tdd/wall/db/migrate/20171207201601_create_users.rb b/harshilp/rails_tdd/wall/db/migrate/20171207201601_create_users.rb
new file mode 100644
index 0000000..78f2820
--- /dev/null
+++ b/harshilp/rails_tdd/wall/db/migrate/20171207201601_create_users.rb
@@ -0,0 +1,9 @@
+class CreateUsers < ActiveRecord::Migration
+ def change
+ create_table :users do |t|
+ t.string :username
+
+ t.timestamps null: false
+ end
+ end
+end
diff --git a/harshilp/rails_tdd/wall/db/migrate/20171207201607_create_messages.rb b/harshilp/rails_tdd/wall/db/migrate/20171207201607_create_messages.rb
new file mode 100644
index 0000000..7a8cd1b
--- /dev/null
+++ b/harshilp/rails_tdd/wall/db/migrate/20171207201607_create_messages.rb
@@ -0,0 +1,10 @@
+class CreateMessages < ActiveRecord::Migration
+ def change
+ create_table :messages do |t|
+ t.text :message
+ t.references :user, index: true, foreign_key: true
+
+ t.timestamps null: false
+ end
+ end
+end
diff --git a/harshilp/rails_tdd/wall/db/migrate/20171207201613_create_comments.rb b/harshilp/rails_tdd/wall/db/migrate/20171207201613_create_comments.rb
new file mode 100644
index 0000000..5de0491
--- /dev/null
+++ b/harshilp/rails_tdd/wall/db/migrate/20171207201613_create_comments.rb
@@ -0,0 +1,11 @@
+class CreateComments < ActiveRecord::Migration
+ def change
+ create_table :comments do |t|
+ t.text :comment
+ t.references :user, index: true, foreign_key: true
+ t.references :message, index: true, foreign_key: true
+
+ t.timestamps null: false
+ end
+ end
+end
diff --git a/harshilp/rails_tdd/wall/db/schema.rb b/harshilp/rails_tdd/wall/db/schema.rb
new file mode 100644
index 0000000..d718c3b
--- /dev/null
+++ b/harshilp/rails_tdd/wall/db/schema.rb
@@ -0,0 +1,42 @@
+# 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: 20171207201613) do
+
+ create_table "comments", force: :cascade do |t|
+ t.text "comment"
+ t.integer "user_id"
+ t.integer "message_id"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "comments", ["message_id"], name: "index_comments_on_message_id"
+ add_index "comments", ["user_id"], name: "index_comments_on_user_id"
+
+ create_table "messages", force: :cascade do |t|
+ t.text "message"
+ t.integer "user_id"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "messages", ["user_id"], name: "index_messages_on_user_id"
+
+ create_table "users", force: :cascade do |t|
+ t.string "username"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+end
diff --git a/harshilp/rails_tdd/wall/db/seeds.rb b/harshilp/rails_tdd/wall/db/seeds.rb
new file mode 100644
index 0000000..4edb1e8
--- /dev/null
+++ b/harshilp/rails_tdd/wall/db/seeds.rb
@@ -0,0 +1,7 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#
+# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
+# Mayor.create(name: 'Emanuel', city: cities.first)
diff --git a/harshilp/rails_tdd/wall/lib/assets/.keep b/harshilp/rails_tdd/wall/lib/assets/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/lib/tasks/.keep b/harshilp/rails_tdd/wall/lib/tasks/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/log/.keep b/harshilp/rails_tdd/wall/log/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/public/404.html b/harshilp/rails_tdd/wall/public/404.html
new file mode 100644
index 0000000..b612547
--- /dev/null
+++ b/harshilp/rails_tdd/wall/public/404.html
@@ -0,0 +1,67 @@
+
+
+
+ The page you were looking for doesn't exist (404)
+
+
+
+
+
+
+
+
+
The page you were looking for doesn't exist.
+
You may have mistyped the address or the page may have moved.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/harshilp/rails_tdd/wall/public/422.html b/harshilp/rails_tdd/wall/public/422.html
new file mode 100644
index 0000000..a21f82b
--- /dev/null
+++ b/harshilp/rails_tdd/wall/public/422.html
@@ -0,0 +1,67 @@
+
+
+
+ The change you wanted was rejected (422)
+
+
+
+
+
+
+
+
+
The change you wanted was rejected.
+
Maybe you tried to change something you didn't have access to.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/harshilp/rails_tdd/wall/public/500.html b/harshilp/rails_tdd/wall/public/500.html
new file mode 100644
index 0000000..061abc5
--- /dev/null
+++ b/harshilp/rails_tdd/wall/public/500.html
@@ -0,0 +1,66 @@
+
+
+
+ We're sorry, but something went wrong (500)
+
+
+
+
+
+
+
+
+
We're sorry, but something went wrong.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/harshilp/rails_tdd/wall/public/favicon.ico b/harshilp/rails_tdd/wall/public/favicon.ico
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/public/robots.txt b/harshilp/rails_tdd/wall/public/robots.txt
new file mode 100644
index 0000000..3c9c7c0
--- /dev/null
+++ b/harshilp/rails_tdd/wall/public/robots.txt
@@ -0,0 +1,5 @@
+# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
+#
+# To ban all spiders from the entire site uncomment the next two lines:
+# User-agent: *
+# Disallow: /
diff --git a/harshilp/rails_tdd/wall/spec/factories/comments.rb b/harshilp/rails_tdd/wall/spec/factories/comments.rb
new file mode 100644
index 0000000..6ab282d
--- /dev/null
+++ b/harshilp/rails_tdd/wall/spec/factories/comments.rb
@@ -0,0 +1,7 @@
+FactoryGirl.define do
+ factory :comment do
+ comment "My Test Comment"
+ user nil
+ message nil
+ end
+end
diff --git a/harshilp/rails_tdd/wall/spec/factories/messages.rb b/harshilp/rails_tdd/wall/spec/factories/messages.rb
new file mode 100644
index 0000000..59d4ad3
--- /dev/null
+++ b/harshilp/rails_tdd/wall/spec/factories/messages.rb
@@ -0,0 +1,6 @@
+FactoryGirl.define do
+ factory :message do
+ message "My Test Message"
+ user
+ end
+end
diff --git a/harshilp/rails_tdd/wall/spec/factories/users.rb b/harshilp/rails_tdd/wall/spec/factories/users.rb
new file mode 100644
index 0000000..96b3ad4
--- /dev/null
+++ b/harshilp/rails_tdd/wall/spec/factories/users.rb
@@ -0,0 +1,5 @@
+FactoryGirl.define do
+ factory :user do
+ username 'harshilp'
+ end
+end
diff --git a/harshilp/rails_tdd/wall/spec/features/logout_spec.rb b/harshilp/rails_tdd/wall/spec/features/logout_spec.rb
new file mode 100644
index 0000000..1f9c435
--- /dev/null
+++ b/harshilp/rails_tdd/wall/spec/features/logout_spec.rb
@@ -0,0 +1,13 @@
+require 'rails_helper'
+feature "User" do
+ before(:each) do
+ visit index_path
+ fill_in 'user_username', with: "harshilp"
+ click_button 'Sign In'
+ end
+ scenario 'logs out of account in session' do
+ click_on 'Log Out'
+ expect(page).to have_content('Sign In')
+ expect(page).to have_current_path(index_path)
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails_tdd/wall/spec/features/notloggedin_spec.rb b/harshilp/rails_tdd/wall/spec/features/notloggedin_spec.rb
new file mode 100644
index 0000000..2848b44
--- /dev/null
+++ b/harshilp/rails_tdd/wall/spec/features/notloggedin_spec.rb
@@ -0,0 +1,8 @@
+require 'rails_helper'
+feature "User" do
+ scenario 'auto redirects to index if user not in session' do
+ visit wall_path
+ expect(page).to have_content('Sign In')
+ expect(page).to have_current_path(index_path)
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails_tdd/wall/spec/features/post_comment_spec.rb b/harshilp/rails_tdd/wall/spec/features/post_comment_spec.rb
new file mode 100644
index 0000000..f0ab497
--- /dev/null
+++ b/harshilp/rails_tdd/wall/spec/features/post_comment_spec.rb
@@ -0,0 +1,22 @@
+require 'rails_helper'
+feature "Comment creates a new comment" do
+ before(:each) do
+ visit index_path
+ fill_in 'user_username', with: "harshilp"
+ click_button 'Sign In'
+ fill_in 'message_message', with: 'My Test Message'
+ click_button 'Post Message'
+ end
+ scenario "successfully creates a new comment" do
+ fill_in "comment_comment", with: "My Test Comment"
+ click_button "Comment"
+ expect(page).to have_content "My Test Comment"
+ expect(page).to have_current_path(wall_path)
+ end
+ scenario "successfully displays error messages if comment field is left blank or invalid" do
+ fill_in "comment_comment", with: ''
+ click_button "Comment"
+ expect(page).to have_content "Comment can't be blank"
+ expect(page).to have_current_path(wall_path)
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails_tdd/wall/spec/features/post_message_spec.rb b/harshilp/rails_tdd/wall/spec/features/post_message_spec.rb
new file mode 100644
index 0000000..2390722
--- /dev/null
+++ b/harshilp/rails_tdd/wall/spec/features/post_message_spec.rb
@@ -0,0 +1,20 @@
+require 'rails_helper'
+feature "Message creates a new message" do
+ before(:each) do
+ visit index_path
+ fill_in 'user_username', with: "harshilp"
+ click_button 'Sign In'
+ end
+ scenario "successfully creates a new message" do
+ fill_in "message_message", with: "My Test Message"
+ click_button "Post Message"
+ expect(page).to have_content "My Test Message"
+ expect(page).to have_current_path(wall_path)
+ end
+ scenario "successfully displays error messages if message field is left blank or invalid" do
+ fill_in "message_message", with: ''
+ click_button "Post Message"
+ expect(page).to have_content "Message can't be blank"
+ expect(page).to have_current_path(wall_path)
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails_tdd/wall/spec/features/register_user_spec.rb b/harshilp/rails_tdd/wall/spec/features/register_user_spec.rb
new file mode 100644
index 0000000..b51d2f9
--- /dev/null
+++ b/harshilp/rails_tdd/wall/spec/features/register_user_spec.rb
@@ -0,0 +1,18 @@
+require 'rails_helper'
+feature "User creates an account" do
+ before(:each) do
+ visit index_path
+ end
+ scenario "successfully creates a new user account" do
+ fill_in "user_username", with: "harshilp"
+ click_button "Sign In"
+ expect(page).to have_content "Welcome, harshilp"
+ expect(page).to have_current_path(wall_path)
+ end
+ scenario "successfully displays error messages if username field is left blank or invalid" do
+ fill_in "user_username", with: ''
+ click_button "Sign In"
+ expect(page).to have_content "Username can't be blank"
+ expect(page).to have_current_path(index_path)
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails_tdd/wall/spec/models/comment_spec.rb b/harshilp/rails_tdd/wall/spec/models/comment_spec.rb
new file mode 100644
index 0000000..13009c9
--- /dev/null
+++ b/harshilp/rails_tdd/wall/spec/models/comment_spec.rb
@@ -0,0 +1,14 @@
+require 'rails_helper'
+RSpec.describe Comment, type: :model do
+ context "With valid attributes" do
+ it "should save" do
+ create(:message)
+ expect(build(:comment, message: Message.first, user: User.first)).to be_valid
+ end
+ end
+ context "With invalid attributes" do
+ it "should not save if comment field is blank" do
+ expect(build(:comment, comment: "")).to be_invalid
+ end
+ end
+end
diff --git a/harshilp/rails_tdd/wall/spec/models/message_spec.rb b/harshilp/rails_tdd/wall/spec/models/message_spec.rb
new file mode 100644
index 0000000..0621465
--- /dev/null
+++ b/harshilp/rails_tdd/wall/spec/models/message_spec.rb
@@ -0,0 +1,16 @@
+require 'rails_helper'
+RSpec.describe Message, type: :model do
+ context "With valid attributes" do
+ it "should save" do
+ expect(build(:message)).to be_valid
+ end
+ end
+ context "With invalid attributes" do
+ it "should not save if message field is blank" do
+ expect(build(:message, message: "")).to be_invalid
+ end
+ it "should not save if user field is blank" do
+ expect(build(:message, user: nil)).to be_invalid
+ end
+ end
+end
\ No newline at end of file
diff --git a/harshilp/rails_tdd/wall/spec/models/user_spec.rb b/harshilp/rails_tdd/wall/spec/models/user_spec.rb
new file mode 100644
index 0000000..2c845a5
--- /dev/null
+++ b/harshilp/rails_tdd/wall/spec/models/user_spec.rb
@@ -0,0 +1,13 @@
+require 'rails_helper'
+RSpec.describe User, type: :model do
+ context "With valid attributes" do
+ it "should save" do
+ expect(build(:user)).to be_valid
+ end
+ end
+ context "With invalid attributes" do
+ it "should not save if username field is blank" do
+ expect(build(:user, username: "")).to be_invalid
+ end
+ end
+end
diff --git a/harshilp/rails_tdd/wall/spec/rails_helper.rb b/harshilp/rails_tdd/wall/spec/rails_helper.rb
new file mode 100644
index 0000000..70c1534
--- /dev/null
+++ b/harshilp/rails_tdd/wall/spec/rails_helper.rb
@@ -0,0 +1,58 @@
+# This file is copied to spec/ when you run 'rails generate rspec:install'
+require 'spec_helper'
+require 'factory_girl_rails'
+ENV['RAILS_ENV'] ||= 'test'
+require File.expand_path('../../config/environment', __FILE__)
+# Prevent database truncation if the environment is production
+abort("The Rails environment is running in production mode!") if Rails.env.production?
+require 'rspec/rails'
+# Add additional requires below this line. Rails is not loaded until this point!
+
+# Requires supporting ruby files with custom matchers and macros, etc, in
+# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
+# run as spec files by default. This means that files in spec/support that end
+# in _spec.rb will both be required and run as specs, causing the specs to be
+# run twice. It is recommended that you do not name files matching this glob to
+# end with _spec.rb. You can configure this pattern with the --pattern
+# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
+#
+# The following line is provided for convenience purposes. It has the downside
+# of increasing the boot-up time by auto-requiring all files in the support
+# directory. Alternatively, in the individual `*_spec.rb` files, manually
+# require only the support files necessary.
+#
+# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
+
+# Checks for pending migrations and applies them before tests are run.
+# If you are not using ActiveRecord, you can remove this line.
+ActiveRecord::Migration.maintain_test_schema!
+
+RSpec.configure do |config|
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+ config.include FactoryGirl::Syntax::Methods
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+
+ # RSpec Rails can automatically mix in different behaviours to your tests
+ # based on their file location, for example enabling you to call `get` and
+ # `post` in specs under `spec/controllers`.
+ #
+ # You can disable this behaviour by removing the line below, and instead
+ # explicitly tag your specs with their type, e.g.:
+ #
+ # RSpec.describe UsersController, :type => :controller do
+ # # ...
+ # end
+ #
+ # The different available types are documented in the features, such as in
+ # https://relishapp.com/rspec/rspec-rails/docs
+ config.infer_spec_type_from_file_location!
+
+ # Filter lines from Rails gems in backtraces.
+ config.filter_rails_from_backtrace!
+ # arbitrary gems may also be filtered via:
+ # config.filter_gems_from_backtrace("gem name")
+end
diff --git a/harshilp/rails_tdd/wall/spec/spec_helper.rb b/harshilp/rails_tdd/wall/spec/spec_helper.rb
new file mode 100644
index 0000000..ce33d66
--- /dev/null
+++ b/harshilp/rails_tdd/wall/spec/spec_helper.rb
@@ -0,0 +1,96 @@
+# This file was generated by the `rails generate rspec:install` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# The generated `.rspec` file contains `--require spec_helper` which will cause
+# this file to always be loaded, without a need to explicitly require it in any
+# files.
+#
+# Given that it is always loaded, you are encouraged to keep this file as
+# light-weight as possible. Requiring heavyweight dependencies from this file
+# will add to the boot time of your test suite on EVERY test run, even for an
+# individual file that may not need all of that loaded. Instead, consider making
+# a separate helper file that requires the additional dependencies and performs
+# the additional setup, and require it from the spec files that actually need
+# it.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+RSpec.configure do |config|
+ # rspec-expectations config goes here. You can use an alternate
+ # assertion/expectation library such as wrong or the stdlib/minitest
+ # assertions if you prefer.
+ config.expect_with :rspec do |expectations|
+ # This option will default to `true` in RSpec 4. It makes the `description`
+ # and `failure_message` of custom matchers include text for helper methods
+ # defined using `chain`, e.g.:
+ # be_bigger_than(2).and_smaller_than(4).description
+ # # => "be bigger than 2 and smaller than 4"
+ # ...rather than:
+ # # => "be bigger than 2"
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
+ end
+
+ # rspec-mocks config goes here. You can use an alternate test double
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
+ config.mock_with :rspec do |mocks|
+ # Prevents you from mocking or stubbing a method that does not exist on
+ # a real object. This is generally recommended, and will default to
+ # `true` in RSpec 4.
+ mocks.verify_partial_doubles = true
+ end
+
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
+ # have no way to turn it off -- the option exists only for backwards
+ # compatibility in RSpec 3). It causes shared context metadata to be
+ # inherited by the metadata hash of host groups and examples, rather than
+ # triggering implicit auto-inclusion in groups with matching metadata.
+ config.shared_context_metadata_behavior = :apply_to_host_groups
+
+# The settings below are suggested to provide a good initial experience
+# with RSpec, but feel free to customize to your heart's content.
+=begin
+ # This allows you to limit a spec run to individual examples or groups
+ # you care about by tagging them with `:focus` metadata. When nothing
+ # is tagged with `:focus`, all examples get run. RSpec also provides
+ # aliases for `it`, `describe`, and `context` that include `:focus`
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
+ config.filter_run_when_matching :focus
+
+ # Allows RSpec to persist some state between runs in order to support
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
+ # you configure your source control system to ignore this file.
+ config.example_status_persistence_file_path = "spec/examples.txt"
+
+ # Limits the available syntax to the non-monkey patched syntax that is
+ # recommended. For more details, see:
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
+ config.disable_monkey_patching!
+
+ # Many RSpec users commonly either run the entire suite or an individual
+ # file, and it's useful to allow more verbose output when running an
+ # individual spec file.
+ if config.files_to_run.one?
+ # Use the documentation formatter for detailed output,
+ # unless a formatter has already been configured
+ # (e.g. via a command-line flag).
+ config.default_formatter = "doc"
+ end
+
+ # Print the 10 slowest examples and example groups at the
+ # end of the spec run, to help surface which specs are running
+ # particularly slow.
+ config.profile_examples = 10
+
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = :random
+
+ # Seed global randomization in this process using the `--seed` CLI option.
+ # Setting this allows you to use `--seed` to deterministically reproduce
+ # test failures related to randomization by passing the same `--seed` value
+ # as the one that triggered the failure.
+ Kernel.srand config.seed
+=end
+end
diff --git a/harshilp/rails_tdd/wall/test/controllers/.keep b/harshilp/rails_tdd/wall/test/controllers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/test/controllers/comments_controller_test.rb b/harshilp/rails_tdd/wall/test/controllers/comments_controller_test.rb
new file mode 100644
index 0000000..2ec71b4
--- /dev/null
+++ b/harshilp/rails_tdd/wall/test/controllers/comments_controller_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class CommentsControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/harshilp/rails_tdd/wall/test/controllers/messages_controller_test.rb b/harshilp/rails_tdd/wall/test/controllers/messages_controller_test.rb
new file mode 100644
index 0000000..47ce261
--- /dev/null
+++ b/harshilp/rails_tdd/wall/test/controllers/messages_controller_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class MessagesControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/harshilp/rails_tdd/wall/test/controllers/users_controller_test.rb b/harshilp/rails_tdd/wall/test/controllers/users_controller_test.rb
new file mode 100644
index 0000000..d23f182
--- /dev/null
+++ b/harshilp/rails_tdd/wall/test/controllers/users_controller_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class UsersControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/harshilp/rails_tdd/wall/test/fixtures/.keep b/harshilp/rails_tdd/wall/test/fixtures/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/test/fixtures/comments.yml b/harshilp/rails_tdd/wall/test/fixtures/comments.yml
new file mode 100644
index 0000000..62864f1
--- /dev/null
+++ b/harshilp/rails_tdd/wall/test/fixtures/comments.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ comment: MyText
+ user_id:
+ message_id:
+
+two:
+ comment: MyText
+ user_id:
+ message_id:
diff --git a/harshilp/rails_tdd/wall/test/fixtures/messages.yml b/harshilp/rails_tdd/wall/test/fixtures/messages.yml
new file mode 100644
index 0000000..65a8f06
--- /dev/null
+++ b/harshilp/rails_tdd/wall/test/fixtures/messages.yml
@@ -0,0 +1,9 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ message: MyText
+ user_id:
+
+two:
+ message: MyText
+ user_id:
diff --git a/harshilp/rails_tdd/wall/test/fixtures/users.yml b/harshilp/rails_tdd/wall/test/fixtures/users.yml
new file mode 100644
index 0000000..952febd
--- /dev/null
+++ b/harshilp/rails_tdd/wall/test/fixtures/users.yml
@@ -0,0 +1,7 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ username: MyString
+
+two:
+ username: MyString
diff --git a/harshilp/rails_tdd/wall/test/helpers/.keep b/harshilp/rails_tdd/wall/test/helpers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/test/integration/.keep b/harshilp/rails_tdd/wall/test/integration/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/test/mailers/.keep b/harshilp/rails_tdd/wall/test/mailers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/test/models/.keep b/harshilp/rails_tdd/wall/test/models/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/test/models/comment_test.rb b/harshilp/rails_tdd/wall/test/models/comment_test.rb
new file mode 100644
index 0000000..b6d6131
--- /dev/null
+++ b/harshilp/rails_tdd/wall/test/models/comment_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class CommentTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/harshilp/rails_tdd/wall/test/models/message_test.rb b/harshilp/rails_tdd/wall/test/models/message_test.rb
new file mode 100644
index 0000000..11e5db0
--- /dev/null
+++ b/harshilp/rails_tdd/wall/test/models/message_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class MessageTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/harshilp/rails_tdd/wall/test/models/user_test.rb b/harshilp/rails_tdd/wall/test/models/user_test.rb
new file mode 100644
index 0000000..82f61e0
--- /dev/null
+++ b/harshilp/rails_tdd/wall/test/models/user_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class UserTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/harshilp/rails_tdd/wall/test/test_helper.rb b/harshilp/rails_tdd/wall/test/test_helper.rb
new file mode 100644
index 0000000..92e39b2
--- /dev/null
+++ b/harshilp/rails_tdd/wall/test/test_helper.rb
@@ -0,0 +1,10 @@
+ENV['RAILS_ENV'] ||= 'test'
+require File.expand_path('../../config/environment', __FILE__)
+require 'rails/test_help'
+
+class ActiveSupport::TestCase
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
+ fixtures :all
+
+ # Add more helper methods to be used by all tests here...
+end
diff --git a/harshilp/rails_tdd/wall/vendor/assets/javascripts/.keep b/harshilp/rails_tdd/wall/vendor/assets/javascripts/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/harshilp/rails_tdd/wall/vendor/assets/stylesheets/.keep b/harshilp/rails_tdd/wall/vendor/assets/stylesheets/.keep
new file mode 100644
index 0000000..e69de29
<%= com.comment %>
+