All Files (91.71% covered at 1.77 hits/line)
35 files in total.
374 relevant lines.
343 lines covered and
31 lines missed
- 1
module ApplicationCable
- 1
class Channel < ActionCable::Channel::Base
end
end
- 1
module ApplicationCable
- 1
class Connection < ActionCable::Connection::Base
end
end
- 1
class ApplicationController < ActionController::Base
- 1
protect_from_forgery with: :exception
- 1
helper_method :current_user
- 1
def current_user
- 104
if session[:user_id]
- 84
@current_user ||= User.find(session[:user_id])
end
end
- 1
def authorize
- 3
if !current_user
flash[:alert] = "You aren't authorized to visit that page."
redirect_to '/'
end
end
end
- 1
class ProductsController < ApplicationController
- 1
before_action :authorize, only: [:new, :edit, :destroy]
- 1
def index
- 5
@products = Product.all
end
- 1
def show
- 7
@product = Product.find(params[:id])
end
- 1
def new
@product = Product.new
end
- 1
def create
@product = Product.new(product_params)
if @product.save
flash[:notice] = "Product successfully added!"
redirect_to products_path
else
render :new
end
end
- 1
def edit
@product = Product.find(params[:id])
end
- 1
def update
@product= Product.find(params[:id])
if @product.update(product_params)
flash[:notice] = "Product successfully updated!"
redirect_to product_path(@product)
else
render :edit
end
end
- 1
def destroy
@product = Product.find(params[:id])
if @product.destroy
flash[:notice] = "Product successfully removed!"
redirect_to products_path
end
end
- 1
private
- 1
def product_params
params.require(:product).permit(
:name,
:description,
:price,
:image,
:material,
:length,
:weight,
:color,
:care )
end
end
- 1
class ReviewsController < ApplicationController
- 1
before_action :authorize, only: [:new]
- 1
def index
@reviews = Review.all
end
- 1
def show
@review = Review.find(params[:id])
end
- 1
def new
- 3
@product = Product.find(params[:product_id])
- 3
@review = Review.new
end
- 1
def create
- 3
@product = Product.find(params[:product_id])
- 3
@review = @product.reviews.create(review_params)
- 3
@review.user_id = current_user.id
- 3
if @review.save
- 2
flash[:notice] = "Review successfully added!"
- 2
redirect_to product_path(@product)
else
- 1
render :new
end
end
- 1
def edit
- 1
@product = Product.find(params[:product_id])
- 1
@review = Review.find(params[:id])
end
- 1
def update
- 1
@product = Product.find(params[:product_id])
- 1
@review= Review.find(params[:id])
- 1
if @review.update(review_params)
- 1
flash[:notice] = "Review successfully updated!"
- 1
redirect_to<EMAIL_ADDRESS>else
render :edit
end
end
- 1
def destroy
@product = Product.find(params[:product_id])
@review = Review.find(params[:id])
if @review.destroy
flash[:notice] = "Review successfully removed!"
redirect_to product_path(@product)
end
end
- 1
private
- 1
def review_params
- 4
params.require(:review).permit(:author, :content)
end
end
- 1
class SessionsController < ApplicationController
- 1
def create
- 7
@user = User.authenticate(params[:email], params[:password])
- 7
if @user
- 6
flash[:notice] = "welcome back!"
- 6
session[:user_id] = @user.id
- 6
redirect_to "/"
else
- 1
flash[:alert] = "There was a problem signing in. Please try again."
- 1
redirect_to signin_path
end
end
- 1
def destroy
session[:user_id] = nil
flash[:notice] = "Succesfully signed out!"
redirect_to "/"
end
end
- 1
class UsersController < ApplicationController
- 1
def index
- 16
@users = User.all
end
- 1
def show
@user = User.find(params[:id])
end
- 1
def new
- 3
@user = User.new
end
- 1
def create
- 2
@user = User.new(user_params)
- 2
if @user.save
- 1
flash[:notice] = "User registration successful!"
- 1
session[:user_id] = @user.id
- 1
redirect_to "/"
else
- 1
flash[:alert] = "There was a problem with your registration"
- 1
redirect_to '/signup'
end
end
# def edit
# @user = User.find(params[:id])
# end
#
# def update
# @user= User.find(params[:id])
# if @user.update(user_params)
# flash[:notice] = "User successfully updated!"
# redirect_to users_path
# else
# render :edit
# end
# end
#
# def destroy
# @user = User.find(params[:id])
# if @user.destroy
# flash[:notice] = "User successfully removed!"
# redirect_to users_path
# end
# end
- 1
private
- 1
def user_params
- 2
params.require(:user).permit(:email, :name, :password, :password_confirmation)
end
end
- 1
module ApplicationHelper
end
- 1
class ApplicationJob < ActiveJob::Base
end
- 1
class ApplicationMailer < ActionMailer::Base
- 1
default from<EMAIL_ADDRESS>- 1
layout 'mailer'
end
- 1
class ApplicationRecord < ActiveRecord::Base
- 1
self.abstract_class = true
end
- 1
class Product < ApplicationRecord
- 1
validates :name, :description, :price,
:image, :material, :length,
:weight, :color, :care, :presence => true
- 1
validates :price, numericality: true, :presence => true
- 1
has_many :reviews, dependent: :destroy
end
- 1
class Review < ApplicationRecord
- 1
validates :author, :content, :presence => true
- 1
validates_length_of :content, maximum: 200, message: "is too long (maximum is 200 characters)"
- 1
validates_length_of :content, minimum: 10, message: "is too short (minimum is 10 characters)"
- 1
belongs_to :product
- 1
belongs_to :user
end
- 1
class User < ApplicationRecord
- 1
attr_accessor :password
- 1
validates_confirmation_of :password
- 1
validates :email, :name, :presence => true, :uniqueness => true
- 1
before_save :encrypt_password
- 1
has_many :reviews
- 1
def encrypt_password
- 9
self.password_salt = BCrypt::Engine.generate_salt
- 9
self.password_hash = BCrypt::Engine.hash_secret(password,password_salt)
end
- 1
def self.authenticate(email, password)
- 7
user = User.find_by "email = ?", email
- 7
if user && user.password_hash == BCrypt::Engine.hash_secret(password, user.password_salt)
- 6
user
else
nil
end
end
end
- 1
require_relative 'boot'
- 1
require "rails"
# Pick the frameworks you want:
- 1
require "active_model/railtie"
- 1
require "active_job/railtie"
- 1
require "active_record/railtie"
- 1
require "action_controller/railtie"
- 1
require "action_mailer/railtie"
- 1
require "action_view/railtie"
- 1
require "action_cable/engine"
- 1
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.
- 1
Bundler.require(*Rails.groups)
- 1
module YarnStore
- 1
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
- 1
config.load_defaults 5.1
# 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.
# Don't generate system test files.
- 1
config.generators.system_tests = nil
end
end
- 1
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
- 1
require 'bundler/setup' # Set up gems listed in the Gemfile.
# Load the Rails application.
- 1
require_relative 'application'
# Initialize the Rails application.
- 1
Rails.application.initialize!
- 1
Rails.application.configure do
- 1
config.cache_classes = true
- 1
config.eager_load = true
- 1
config.public_file_server.enabled = true
- 1
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
}
- 1
config.consider_all_requests_local = true
- 1
config.action_controller.perform_caching = false
- 1
config.action_dispatch.show_exceptions = false
- 1
config.action_controller.allow_forgery_protection = false
- 1
config.action_mailer.perform_caching = 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.
- 1
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr.
- 1
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
# Be sure to restart your server when you modify this file.
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# 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.
- 1
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
- 1
Rails.application.config.assets.paths << Rails.root.join('node_modules')
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
# 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!
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
- 1
Rails.application.config.action_dispatch.cookies_serializer = :json
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
- 1
Rails.application.config.filter_parameters += [:password]
# 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
# 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
# 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.
- 1
ActiveSupport.on_load(:action_controller) do
- 2
wrap_parameters format: [:json]
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end
- 1
Rails.application.routes.draw do
- 1
root to: 'users#index'
# resources :users do
# resources :products
# end
- 1
resources :products do
- 1
resources :reviews
end
- 1
get '/signup' => 'users#new'
- 1
post '/users' => 'users#create'
- 1
get '/signin' => 'sessions#new'
- 1
post '/signin' => 'sessions#create'
- 1
get '/signout' => 'sessions#destroy'
end
- 1
FactoryGirl.define do
- 1
factory(:user) do
- 1
name('coco')
- 1
<EMAIL_ADDRESS>- 1
password('password')
- 1
password_confirmation('password')
- 1
admin(false)
end
- 1
factory(:admin, class: User) do
- 1
name('duke')
- 1
<EMAIL_ADDRESS>- 1
password('password')
- 1
password_confirmation('password')
- 1
admin(true)
end
- 1
factory(:product) do
- 1
name('stupify ribbons')
- 1
description('this beautiful yarn will stupify you with luxurious ribbons and Harry fibers.')
- 1
price(25.00)
- 1
image('http://cdn.lionbrand.com/media/catalog/product/cache/1/image/340x270/9df78eab33525d08d6e5fb8d27136e95/5/9/595-203-deepbluesea.jpg')
- 1
material('riboon, nylon and acrylic blen')
- 1
length('275 yards')
- 1
weight('worsted')
- 1
color('midnight blue')
- 1
care('hand wash cold')
end
- 1
factory(:review) do
- 1
content('I liked this yarn, it was fiborous')
- 1
author('coco')
- 1
association :user_id, factory: :user
- 1
association :product_id, factory: :product
end
end
- 1
require 'rails_helper'
- 1
describe "follows the path of user leaving a comment on product" do
- 1
it "follows user to products page" do
- 1
user = FactoryGirl.create(:user)
- 1
product = FactoryGirl.create(:product)
- 1
visit root_path
- 1
click_link 'Sign in'
- 1
fill_in 'Email', :with => user.email
- 1
fill_in 'Password', :with => user.password
- 1
click_on 'Sign In'
- 1
click_link 'Shop our Collection'
- 1
expect(page).to have_content '$'
end
- 1
it "follows user to products detail page" do
- 1
user = FactoryGirl.create(:user)
- 1
product = FactoryGirl.create(:product)
- 1
visit root_path
- 1
click_link 'Sign in'
- 1
fill_in 'Email', :with => user.email
- 1
fill_in 'Password', :with => user.password
- 1
click_on 'Sign In'
- 1
click_link 'Shop our Collection'
- 1
click_link product.name
- 1
expect(page).to have_content product.name
end
- 1
it "follows user to leave comment on product" do
- 1
user = FactoryGirl.create(:user)
- 1
product = FactoryGirl.create(:product)
- 1
visit root_path
- 1
click_link 'Sign in'
- 1
fill_in 'Email', :with => user.email
- 1
fill_in 'Password', :with => user.password
- 1
click_on 'Sign In'
- 1
click_link 'Shop our Collection'
- 1
click_link product.name
- 1
click_link 'Leave a review'
- 1
fill_in 'author', :with => user.name
- 1
fill_in 'content', :with => "that there is some good yarn."
- 1
click_on 'Create Review'
- 1
expect(page).to have_content 'Review successfully added!'
end
- 1
it "follows user to leave comment on product" do
- 1
user = FactoryGirl.create(:user)
- 1
product = FactoryGirl.create(:product)
- 1
visit root_path
- 1
click_link 'Sign in'
- 1
fill_in 'Email', :with => user.email
- 1
fill_in 'Password', :with => user.password
- 1
click_on 'Sign In'
- 1
click_link 'Shop our Collection'
- 1
click_link product.name
- 1
click_link 'Leave a review'
- 1
click_on 'Create Review'
- 1
expect(page).to have_content 'Please fix these errors:'
end
- 1
it "follows user to edit their comment on product" do
- 1
user = FactoryGirl.create(:user)
- 1
product = FactoryGirl.create(:product)
# review = FactoryGirl.build(:review)
- 1
visit root_path
- 1
click_link 'Sign in'
- 1
fill_in 'Email', :with => user.email
- 1
fill_in 'Password', :with => user.password
- 1
click_on 'Sign In'
- 1
click_link 'Shop our Collection'
- 1
click_link product.name
- 1
click_link 'Leave a review'
- 1
fill_in 'author', :with => user.name
- 1
fill_in 'content', :with => "that there is some good yarn."
- 1
click_on 'Create Review'
- 1
click_link 'Edit'
- 1
fill_in 'author', :with => 'wayne'
- 1
click_on 'Update Review'
- 1
expect(page).to have_content 'Review successfully updated!'
end
end
# save_and_open_page
- 1
require 'rails_helper'
- 1
describe "follows the path of signing in" do
- 1
it "follows user sign in process" do
- 1
user = FactoryGirl.create(:user)
- 1
visit root_path
- 1
click_link 'Sign in'
- 1
fill_in 'Email', :with => user.email
- 1
fill_in 'Password', :with => user.password
- 1
click_on 'Sign In'
- 1
expect(page).to have_content 'welcome back!'
end
- 1
it "follows user sign in process with no user info" do
- 1
visit root_path
- 1
click_link 'Sign in'
- 1
click_on 'Sign In'
- 1
expect(page).to have_content 'There was a problem signing in. Please try again.'
end
end
# save_and_open_page
- 1
require 'rails_helper'
- 1
describe "follows the path of signing up as a user" do
- 1
it "registers new user though signing up" do
- 1
visit root_path
- 1
click_link 'Sign up'
- 1
fill_in 'user_name', :with => 'Chanel'
- 1
fill_in 'user_email', :with =><EMAIL_ADDRESS>- 1
fill_in 'user_password', :with => 'password'
- 1
fill_in 'user_password_confirmation', :with => 'password'
- 1
click_on 'Sign Up'
- 1
expect(page).to have_content 'User registration successful'
end
- 1
it "gives error when no name is entered" do
- 1
visit root_path
- 1
click_link 'Sign up'
- 1
click_on 'Sign Up'
- 1
expect(page).to have_content 'There was a problem with your registration'
end
end
- 1
require 'rails_helper'
- 1
describe Product do
- 2
it { should validate_presence_of :name }
- 2
it { should validate_presence_of :price }
- 2
it { should validate_presence_of :description }
- 2
it { should validate_presence_of :image }
- 2
it { should validate_presence_of :material }
- 2
it { should validate_presence_of :length }
- 2
it { should validate_presence_of :weight }
- 2
it { should validate_presence_of :color }
- 2
it { should validate_presence_of :care }
- 2
it { should have_many :reviews }
- 2
it { should validate_numericality_of(:price)}
- 1
it 'proves factory girl works for product' do
- 1
product = FactoryGirl.build(:product)
- 1
product.name.should eq "stupify ribbons"
end
end
- 1
require 'rails_helper'
- 1
describe Review do
- 2
it { should validate_presence_of :author}
- 2
it { should validate_presence_of :content }
- 2
it { should belong_to :product }
- 2
it { should belong_to :user }
- 2
it { should validate_length_of(:content).is_at_least(10) }
- 2
it { should validate_length_of(:content).is_at_most(200) }
- 1
it 'proves factory girl works for review relationship' do
- 1
user = FactoryGirl.build(:user)
- 1
review = FactoryGirl.build(:review)
- 1
review.user_id.should eq user.id
end
- 1
it 'proves factory girl works for product relationship' do
- 1
product = FactoryGirl.build(:product)
- 1
review = FactoryGirl.build(:review)
- 1
review.product_id.should eq product.id
end
end
- 1
require 'rails_helper'
- 1
RSpec.describe User, type: :model do
- 2
it { should have_many :reviews }
- 2
it { should validate_presence_of :name }
- 2
it { should validate_presence_of :email }
- 2
it { should validate_confirmation_of :password }
- 1
it 'proves factory girl works' do
- 1
user = FactoryGirl.build(:user)
- 1
user.name.should eq "coco"
end
- 1
it 'proves factory girl works for admin' do
- 1
admin = FactoryGirl.build(:admin)
- 1
admin.name.should eq "duke"
end
end
- 1
require 'spec_helper'
- 1
ENV['RAILS_ENV'] ||= 'test'
- 1
require File.expand_path('../../config/environment', __FILE__)
- 1
abort("The Rails environment is running in production mode!") if Rails.env.production?
- 1
require 'rspec/rails'
- 1
ActiveRecord::Migration.maintain_test_schema!
- 1
RSpec.configure do |config|
- 1
config.fixture_path = "#{::Rails.root}/spec/fixtures"
- 1
config.use_transactional_fixtures = true
- 1
config.infer_spec_type_from_file_location!
- 1
config.filter_rails_from_backtrace!
# arbitrary gems may also be filtered via:
# config.filter_gems_from_backtrace("gem name")
# config.include Warden::Test::Helpers
end
- 1
Shoulda::Matchers.configure do |config|
- 1
config.integrate do |with|
- 1
with.test_framework :rspec
- 1
with.library :rails
end
end


| 1131 | (A) | Bot mekiłł pepiłł for the prechynge at the posterne ȝatis |
| 1135 | (C) | ¶ Myche peple for þat prechynge . at þe posterne ȝates |
| 1117 | (D) | For ałł his preching of þe peple at þe posterne yates |
| 1098 | (E) | ¶ For al his talkyng to þe peple . atte a posterne gate |
| (Ex) | ---- no text ---- | |
| 1155 | (L) | Myche peple for þe prechyng at þe posterne ȝatis |
| (P) | ---- no text ---- | |
| 1106 | (U) | For al his preching the puple / atte postern gate |
| 196 | (V) | Mekełł peple for þe preching . atte posterne yates |


To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video


Hello,
Sign in with a Google account to get started.
Your Skill Level
{{activity}}
{{details}}
{{date}}
Start: {{time}}
Duration: {{duration}}
Location: {{location}}
{{details.details}}


{% load i18n %}
We don't have data for your area.
Your polling station address should be printed on your polling card, which is delivered by post before an election.
{% endblocktrans %}{% if council.phone %} {% blocktrans with council.phone as council_phone and council.name as council_name %} Or, you need to contact your local council. You can call {{ council_name }} on {{ council_phone }} {% endblocktrans %} {% else %} {% blocktrans with council.name as council_name %} Or, you need to contact {{ council_name }} {% endblocktrans %} {% endif %}
{% blocktrans %}Polling stations are open from 7am to 10pm on Thursday 2 May.
{% endblocktrans %}


Intializes a new instance of a mocking service for generating random CVSS vectors.
if true, temporal attributes will be included in geenerated vectors
if true, environmental attributes will be included in generated vectors
Gets or sets whether or not this instance will generate environmental attributes.
Gets or sets whether or not this instance will generate environmental attributes.
Gets or sets whether or not this instance will generate temporal attributes.
Gets or sets whether or not this instance will generate temporal attributes.