Changed naming from Routes to Controllers; fixed some Sinatra modular layout stuff; added RSpec for testing and some basic tests
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
23
spec/controllers/index_controller_spec.rb
Normal file
23
spec/controllers/index_controller_spec.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../spec_helper'
|
||||
|
||||
RSpec.describe(IndexController) do
|
||||
# / route
|
||||
describe 'Get /' do
|
||||
it 'Dashboard returns 200.' do
|
||||
get '/'
|
||||
expect(last_response).to(be_ok)
|
||||
end
|
||||
|
||||
it "Dashboard contains 'Game Data' on page (nav bar should be loaded)." do
|
||||
get '/'
|
||||
expect(last_response.body).to(include('Game Data'))
|
||||
end
|
||||
|
||||
it "Dashboard contains 'Ruby version' on page (footer should be loaded)." do
|
||||
get '/'
|
||||
expect(last_response.body).to(include('Ruby version'))
|
||||
end
|
||||
end
|
||||
end
|
@@ -1,14 +0,0 @@
|
||||
require_relative '../spec_helper'
|
||||
|
||||
RSpec.describe IndexRoutes do
|
||||
|
||||
def app
|
||||
IndexRoutes
|
||||
end
|
||||
|
||||
it "Dashboard returns 200" do
|
||||
get '/'
|
||||
expect(last_response).to be_ok
|
||||
end
|
||||
|
||||
end
|
@@ -1,17 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ENV['APP_ENV'] = 'test'
|
||||
|
||||
require_relative '../src/app'
|
||||
require_relative '../src/server'
|
||||
require 'rspec'
|
||||
require 'rack/test'
|
||||
|
||||
module RSpecMixin
|
||||
|
||||
include Rack::Test::Methods
|
||||
|
||||
def app
|
||||
GameData
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.include RSpecMixin
|
||||
config.include(RSpecMixin)
|
||||
end
|
||||
|
Reference in New Issue
Block a user