Skip to content

Commit

Permalink
Adding i18n-tasks, Rubocop, FactoryGirl and Shoulda Matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoHolo committed Apr 21, 2017
1 parent 4095401 commit 25e340f
Show file tree
Hide file tree
Showing 64 changed files with 356 additions and 98 deletions.
20 changes: 9 additions & 11 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 28
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
require: rubocop-rspec

AllCops:
TargetRubyVersion: 2.4
Exclude:
- 'db/schema.rb'
- 'tmp/**/*'

Metrics/LineLength:
Max: 120

# Offense count: 4
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'app/controllers/application_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/mailers/application_mailer.rb'
- 'app/models/application_record.rb'
Enabled: false
12 changes: 12 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# frozen_string_literal: true

source 'https://rubygems.org'

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
"https://github.com/#{repo_name}.git"
end

ruby '2.4.1'

gem 'coffee-rails', '~> 4.2'
gem 'haml-rails', '~> 0.9'
gem 'pg'
Expand All @@ -23,6 +27,8 @@ gem 'turbolinks', '~> 5'

gem 'semantic-ui-sass', '~> 2'

gem 'i18n-tasks', '~> 0.8.3'

# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
Expand All @@ -31,9 +37,14 @@ gem 'semantic-ui-sass', '~> 2'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :test do
gem 'shoulda-matchers', '~> 3.1'
end

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
gem 'factory_girl_rails'
gem 'rspec-rails', '~> 3.5'
end

Expand All @@ -46,6 +57,7 @@ group :development do
gem 'spring-watcher-listen', '~> 2.0.0'

gem 'rubocop', require: false
gem 'rubocop-rspec', require: false
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
Expand Down
39 changes: 39 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,17 @@ GEM
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
diff-lcs (1.3)
easy_translate (0.5.0)
json
thread
thread_safe
erubis (2.7.0)
execjs (2.7.0)
factory_girl (4.8.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.8.0)
factory_girl (~> 4.8.0)
railties (>= 3.0.0)
ffi (1.9.18)
foreman (0.83.0)
thor (~> 0.19.1)
Expand All @@ -67,19 +76,29 @@ GEM
haml (>= 4.0.6, < 5.0)
html2haml (>= 1.0.1)
railties (>= 4.0.1)
highline (1.7.8)
html2haml (2.1.0)
erubis (~> 2.7.0)
haml (~> 4.0)
nokogiri (>= 1.6.0)
ruby_parser (~> 3.5)
i18n (0.8.1)
i18n-tasks (0.8.7)
activesupport (>= 2.3.18)
easy_translate (>= 0.5.0)
erubis
highline (>= 1.7.3)
i18n
term-ansicolor (>= 1.3.2)
terminal-table (>= 1.5.1)
jbuilder (2.6.3)
activesupport (>= 3.0.0, < 5.2)
multi_json (~> 1.2)
jquery-rails (4.3.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.0.3)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
Expand Down Expand Up @@ -156,6 +175,8 @@ GEM
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-rspec (1.15.0)
rubocop (>= 0.42.0)
ruby-progressbar (1.8.1)
ruby_parser (3.8.4)
sexp_processor (~> 4.1)
Expand All @@ -169,6 +190,8 @@ GEM
semantic-ui-sass (2.2.9.3)
sass (>= 3.2)
sexp_processor (4.8.0)
shoulda-matchers (3.1.1)
activesupport (>= 4.0.0)
spring (2.0.1)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
Expand All @@ -181,9 +204,15 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
term-ansicolor (1.5.0)
tins (~> 1.0)
terminal-table (1.7.3)
unicode-display_width (~> 1.1.1)
thor (0.19.4)
thread (0.2.2)
thread_safe (0.3.6)
tilt (2.0.7)
tins (1.13.2)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
Expand All @@ -207,8 +236,13 @@ PLATFORMS
DEPENDENCIES
byebug
coffee-rails (~> 4.2)
<<<<<<< HEAD
foreman
=======
factory_girl_rails
>>>>>>> Adding i18n-tasks, Rubocop, FactoryGirl and Shoulda Matchers
haml-rails (~> 0.9)
i18n-tasks (~> 0.8.3)
jbuilder (~> 2.5)
jquery-rails
listen (~> 3.0.5)
Expand All @@ -217,14 +251,19 @@ DEPENDENCIES
rails (~> 5.0.2)
rspec-rails (~> 3.5)
rubocop
rubocop-rspec
sass-rails (~> 5.0)
semantic-ui-sass (~> 2)
shoulda-matchers (~> 3.1)
spring
spring-watcher-listen (~> 2.0.0)
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)

RUBY VERSION
ruby 2.4.1p111

BUNDLED WITH
1.14.6
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# 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.

Expand Down
2 changes: 2 additions & 0 deletions app/channels/application_cable/channel.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ApplicationCable
class Channel < ActionCable::Channel::Base
end
Expand Down
2 changes: 2 additions & 0 deletions app/channels/application_cable/connection.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ApplicationCable
class Connection < ActionCable::Connection::Base
end
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
end
6 changes: 4 additions & 2 deletions app/controllers/companies_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

class CompaniesController < ApplicationController
def index
end
def index; end

def show
@company = Company.find params[:id]
end
end
5 changes: 3 additions & 2 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class HomeController < ApplicationController
def index
end
def index; end
end
2 changes: 2 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# frozen_string_literal: true

module ApplicationHelper
end
2 changes: 0 additions & 2 deletions app/helpers/companies_helper.rb

This file was deleted.

2 changes: 2 additions & 0 deletions app/jobs/application_job.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# frozen_string_literal: true

class ApplicationJob < ActiveJob::Base
end
2 changes: 2 additions & 0 deletions app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ApplicationMailer < ActionMailer::Base
default from: '[email protected]'
layout 'mailer'
Expand Down
2 changes: 2 additions & 0 deletions app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
3 changes: 3 additions & 0 deletions app/models/company.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# frozen_string_literal: true

class Company < ApplicationRecord
validates :name, presence: true
end
12 changes: 10 additions & 2 deletions app/views/companies/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
%h1 Companies#show
%p Find me in app/views/companies/show.html.haml
%h1= @company.name
%table
%thead
%tr
%th
%th
%tbody
%tr
%td= 'Siren'
%td= @company.siren
6 changes: 2 additions & 4 deletions app/views/home/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.ui.main.text.container
%h1
= t('.welcome_title')
%p
= t('.welcome_message')
%h1= t('.welcome_title')
%p= t('.welcome_message')
4 changes: 4 additions & 0 deletions app/views/layouts/_footer.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
%footer.ui.bottom.fixed.menu
.ui.container
.item
= 'Footer with information.'
8 changes: 6 additions & 2 deletions app/views/layouts/_navbar.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
%header.ui.top.fixed.menu
.ui.container
.header.item
= link_to semantic_icon('home') + t('.home') , root_path
= link_to root_path do
= semantic_icon('home')
= t('.home')
.header.item
= link_to semantic_icon('building outline') + t('.search') , companies_path
= link_to companies_path do
= semantic_icon('building outline')
= t('.search')
9 changes: 3 additions & 6 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
!!!
%html
%head
%title EConseils
%title= 'EConseils'
= csrf_meta_tags
= stylesheet_link_tag 'application', media: 'all', data: {turbolinks_track: 'reload'}
= stylesheet_link_tag 'application', media: 'all', data: {turbolinks_track: 'reload'}
= javascript_include_tag 'application', data: {turbolinks_track: 'reload'}
%body
= render 'layouts/navbar'
.main.container
= yield
%footer.ui.bottom.fixed.menu
.ui.container
.item
Footer with information.
= render 'layouts/footer'
2 changes: 2 additions & 0 deletions bin/bundle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')
2 changes: 2 additions & 0 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'pathname'
require 'fileutils'
include FileUtils
Expand Down
1 change: 1 addition & 0 deletions bin/spring
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# This file loads spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.
Expand Down
2 changes: 2 additions & 0 deletions bin/update
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'pathname'
require 'fileutils'
include FileUtils
Expand Down
2 changes: 2 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This file is used by Rack-based servers to start the application.

require_relative 'config/environment'
Expand Down
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative 'boot'

require 'rails/all'
Expand Down
2 changes: 2 additions & 0 deletions config/boot.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

require 'bundler/setup' # Set up gems listed in the Gemfile.
Loading

0 comments on commit 25e340f

Please sign in to comment.