Skip to content

Commit

Permalink
remove rspec from rakefile in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbeales committed Apr 1, 2018
1 parent b37b7e7 commit 028f592
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ AllCops:
- '.git/**/*'
- 'db/schema.rb'
- 'bin/**/*'
TargetRubyVersion: 2.4
TargetRubyVersion: 2.5
Metrics/LineLength:
Max: 120
Metrics/MethodLength:
Expand All @@ -26,6 +26,8 @@ Style/ReturnNil:
Style/StringMethods:
Description: 'Checks if configured preferred methods are used over non-preferred.'
Enabled: true
Style/HashSyntax:
EnforcedStyle: ruby19_no_mixed_keys
Layout/TrailingWhitespace:
Description: 'Avoid trailing whitespace.'
StyleGuide: '#no-trailing-whitespace'
Expand Down
Empty file added Procfile
Empty file.
7 changes: 6 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

require 'sinatra/activerecord'
require 'sinatra/activerecord/rake'
require 'rspec/core/rake_task'
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
puts 'ignoring rspec in production'
end
require 'turnout/rake_tasks' # rake maintenance:start, rake maintenance:end

Dir.glob('lib/tasks/*.rake').each { |r| load r }
Expand Down
11 changes: 11 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,23 @@
# Takes an incoming Alexa requests and dispatches
# to a matching intent in intents folder
class App < Sinatra::Base

# Register initializers a la Rails
register Sinatra::Initializers

# Entry point for requests from Amazon Alexa.
# The incoming requests are dispatched to intents in the intents folder by Ralyxa.
post '/' do
# store user id in settings
set_user!(request.user_id)
Ralyxa::Skill.handle(request)
end

private

# Authenticate user. If user doesn't exist, still authenticate user and add them to database
def set_user!
user = User.authenticate(request.user_id)
set :userid, user.id
end
end
2 changes: 0 additions & 2 deletions intents/launch_request_intent.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

Ralyxa::Skill.intent 'LaunchRequest' do
# Authenticate user. If user doesn't exist, still authenticate user and add them to database
User.authenticate(request.user_id)
ask(AlexaService.launch_response)
end
8 changes: 4 additions & 4 deletions spec/rspec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ JournalEntry
unique entry date
 {:timecop=>:freeze}
#to_s
 should eq "2018-04-01 05:03:36 UTC "
 should eq "2018-04-01 19:05:29 UTC "

Journal
 is an instance of Journal
Expand All @@ -411,7 +411,7 @@ Journal
 should not be truthy
#list_entries
defaults to last 4
 should eq "2018-04-01 05:03:36 UTC 2012-12-12 00:00:00 UTC "
 should eq "2018-04-01 19:05:29 UTC 2012-12-12 00:00:00 UTC "
#read_entry
 should be > 0
#name
Expand Down Expand Up @@ -1015,7 +1015,7 @@ AlexaService
 should eq " Cannot find instrument blah. Please try again.\n"
 should eq "Below is a list of the ways you might have felt or behaved. Please check the boxes to tell me how often you have felt this way in the past week or so."
#read_all
 should eq "2018-04-01 05:03:34 UTC "
 should eq "2018-04-01 19:05:27 UTC "
 should not be nil

InstrumentLoaderCsv
Expand Down Expand Up @@ -1046,6 +1046,6 @@ InstrumentLoader
missing instrument
 should raise RuntimeError

Finished in 16.84 seconds (files took 10.5 seconds to load)
Finished in 9.26 seconds (files took 8.05 seconds to load)
514 examples, 0 failures

0 comments on commit 028f592

Please sign in to comment.