From ae1f292719fcc8ef323991ad116fa90f914bc92d Mon Sep 17 00:00:00 2001 From: shlok007 Date: Wed, 31 May 2017 19:35:43 +0530 Subject: [PATCH] indent using spaces --- app/controllers/organizations_controller.rb | 63 ++++++++++----------- app/models/organization.rb | 2 +- spec/factories/organizations.rb | 16 +++--- spec/models/organization_spec.rb | 3 +- 4 files changed, 41 insertions(+), 43 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 28016899..13d6c204 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -1,41 +1,40 @@ class OrganizationsController < ApplicationController - load_and_authorize_resource :organization + load_and_authorize_resource :organization - def index - @organizations = Organization.all - end + def index + @organizations = Organization.all + end - def create - @organization = Organization.new(organization_params) - if @organization.save - redirect_to organizations_path, - notice: 'Organization successfully created' - else - redirect_to new_organization_path, - error: @organization.errors.full_messages.join(', ') - end - end + def create + @organization = Organization.new(organization_params) + if @organization.save + redirect_to organizations_path, + notice: 'Organization successfully created' + else + redirect_to new_organization_path, + error: @organization.errors.full_messages.join(', ') + end + end - def new - @organization = Organization.new - end + def new + @organization = Organization.new + end - def edit - end + def edit; end - def update - if @organization.update_attributes(organization_params) - redirect_to organizations_path, - notice: 'Organization successfully updated' - else - redirect_to edit_organization_path(@organization), - error: @organization.errors.full_messages.join(', ') - end - end + def update + if @organization.update_attributes(organization_params) + redirect_to organizations_path, + notice: 'Organization successfully updated' + else + redirect_to edit_organization_path(@organization), + error: @organization.errors.full_messages.join(', ') + end + end - private + private - def organization_params - params.require(:organization).permit(:name, :description, :picture) - end + def organization_params + params.require(:organization).permit(:name, :description, :picture) + end end diff --git a/app/models/organization.rb b/app/models/organization.rb index 87accd1e..60a83fef 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -4,4 +4,4 @@ class Organization < ActiveRecord::Base validates :name, presence: true mount_uploader :picture, PictureUploader, mount_on: :picture -end \ No newline at end of file +end diff --git a/spec/factories/organizations.rb b/spec/factories/organizations.rb index 69829de7..0ee76554 100644 --- a/spec/factories/organizations.rb +++ b/spec/factories/organizations.rb @@ -1,13 +1,13 @@ FactoryGirl.define do factory :organization do - name { Faker::Company.name } - description { Faker::Lorem.paragraph } + name { Faker::Company.name } + description { Faker::Lorem.paragraph } - # after(:create) do |organization| - # File.open("spec/support/logos/#{1 + rand(13)}.png") do |file| - # organization.picture = file - # end - # organization.save! - # end + # after(:create) do |organization| + # File.open("spec/support/logos/#{1 + rand(13)}.png") do |file| + # organization.picture = file + # end + # organization.save! + # end end end diff --git a/spec/models/organization_spec.rb b/spec/models/organization_spec.rb index 45a50827..748205d5 100644 --- a/spec/models/organization_spec.rb +++ b/spec/models/organization_spec.rb @@ -5,7 +5,7 @@ describe Organization do describe 'validation' do it 'has a valid factory' do - expect( build(:organization) ).to be_valid + expect(build(:organization)).to be_valid end it 'is not valid without a name' do @@ -17,4 +17,3 @@ describe Organization do it { should have_many(:conferences).dependent(:destroy) } end end -