Skip to content

Commit

Permalink
Update dev dependecies & fix offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
Moncef Belyamani committed Apr 11, 2015
1 parent 913b525 commit 53f7bd9
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 23 deletions.
11 changes: 10 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AllCops:
- 'Rakefile'
- 'lib/tasks/*'
Exclude:
- 'bin/*'
- 'bin/**/*'
- 'db/schema.rb'
- 'db/seeds.rb'
- 'db/migrate/*'
Expand Down Expand Up @@ -48,6 +48,15 @@ Rails/ScopeArgs:
Include:
- app/models/**/*.rb

Rails/TimeZone:
# The value `always` means that `Time` should be used with `zone`.
# The value `acceptable` allows usage of `in_time_zone` instead of `zone`.
Enabled: false
EnforcedStyle: always
SupportedStyles:
- always
- acceptable

Style/AndOr:
Description: Use &&/|| instead of and/or.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-and-or-or
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.9.1)
coveralls (0.7.12)
coveralls (0.8.0)
multi_json (~> 1.10)
rest-client (>= 1.6.8, < 2)
simplecov (~> 0.9.1)
Expand Down Expand Up @@ -251,7 +251,7 @@ GEM
rspec-mocks (~> 3.2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
rubocop (0.29.1)
rubocop (0.30.0)
astrolabe (~> 1.3)
parser (>= 2.2.0.1, < 3.0)
powerpack (~> 0.1)
Expand All @@ -277,7 +277,7 @@ GEM
multi_json (~> 1.0)
simplecov-html (~> 0.9.0)
simplecov-html (0.9.0)
spring (1.3.3)
spring (1.3.4)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
spring-watcher-listen (1.0.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/locations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def show
contacts: :phones,
services: [:categories, :contacts, :phones, :regular_schedules,
:holiday_schedules]
).find(params[:id])
).find(params[:id])
render json: location, status: 200 if stale?(location, public: true)
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/status_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def check_status
response_hash = {}
response_hash[:dependencies] = %w(Mandrill Postgres)
response_hash[:status] = everything_ok? ? 'ok' : 'NOT OK'
response_hash[:updated] = Time.now.to_i
response_hash[:updated] = Time.zone.now.to_i

render json: response_hash
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ def location_services_active?
end

def touch_location(_category)
location.update_column(:updated_at, Time.now) if persisted?
location.update_column(:updated_at, Time.zone.now) if persisted?
end
end
4 changes: 2 additions & 2 deletions app/views/admin/services/forms/_service_locations.html.haml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
- if @location.organization.locations.size > 1
- locs ||= @location.organization.locations.pluck(:id, :name)
- service_ids ||= locs.map { |loc| Location.find(loc.first).services.pluck(:id) }.flatten
.content-box
%h2 Copy this service to other Locations
%p
If this service is offered at other locations, you can copy it to those
locations. Then, make sure to update the service at the other locations
with any information that is different, such as the hours of operation.

- locs ||= @location.organization.locations.pluck(:id, :name)

- locs.each do |loc|
- next if loc.first == @location.id
- next if Location.find(loc.first).services.pluck(:name).include?(@service.name)
Expand Down
2 changes: 1 addition & 1 deletion lib/location_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ def address_attributes_for(id)
end

def matching_address(id)
addresses.select { |a| a[:location_id] == id }.first
addresses.find { |a| a[:location_id] == id }
end
end
4 changes: 2 additions & 2 deletions spec/factories/admins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
email '[email protected]'
password 'ohanatest'
password_confirmation 'ohanatest'
confirmed_at Time.now
confirmed_at Time.zone.now

factory :super_admin do
name 'Super Admin'
Expand All @@ -25,6 +25,6 @@
email '[email protected]'
password 'ohanatest'
password_confirmation 'ohanatest'
confirmed_at Time.now
confirmed_at Time.zone.now
end
end
2 changes: 1 addition & 1 deletion spec/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
password 'mong01dtest'
password_confirmation 'mong01dtest'
# required if the Devise Confirmable module is used
confirmed_at Time.now
confirmed_at Time.zone.now

factory :user_with_app do
after(:create) do |user|
Expand Down
8 changes: 4 additions & 4 deletions spec/features/admin/organizations/create_organization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@
scenario 'with date incorporated' do
fill_in 'organization_name', with: 'new org'
fill_in 'organization_description', with: 'description for new org'
select_date(Date.today, from: 'organization_date_incorporated')
select_date(Time.zone.today, from: 'organization_date_incorporated')
click_button 'Create organization'
click_link 'new org'

expect(find_field('organization_date_incorporated_1i').value).
to eq Date.today.year.to_s
to eq Time.zone.today.year.to_s
expect(find_field('organization_date_incorporated_2i').value).
to eq Date.today.month.to_s
to eq Time.zone.today.month.to_s
expect(find_field('organization_date_incorporated_3i').value).
to eq Date.today.day.to_s
to eq Time.zone.today.day.to_s
end

scenario 'when adding a funding source', :js do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
end

scenario 'with date incorporated' do
select_date(Date.today, from: 'organization_date_incorporated')
select_date(Time.zone.today, from: 'organization_date_incorporated')
click_button 'Save changes'

expect(find_field('organization_date_incorporated_1i').value).
to eq Date.today.year.to_s
to eq Time.zone.today.year.to_s
expect(find_field('organization_date_incorporated_2i').value).
to eq Date.today.month.to_s
to eq Time.zone.today.month.to_s
expect(find_field('organization_date_incorporated_3i').value).
to eq Date.today.day.to_s
to eq Time.zone.today.day.to_s
end
end
4 changes: 2 additions & 2 deletions spec/requests/status_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
end

it "returns 'updated' attribute set to current time" do
expect(json['updated']).to eq(Time.now.to_i)
expect(json['updated']).to eq(Time.zone.now.to_i)
end
end

Expand All @@ -42,7 +42,7 @@
end

it "returns 'updated' attribute set to current time" do
expect(json['updated']).to eq(Time.now.to_i)
expect(json['updated']).to eq(Time.zone.now.to_i)
end
end
end

0 comments on commit 53f7bd9

Please sign in to comment.