Skip to content

Commit

Permalink
Circleci project setup (#104)
Browse files Browse the repository at this point in the history
* Beginning to rspec

* First test

* Add factory bot, a few factories, and an additional test

* Change visit to go to a less silly url

* Add test for accessing public story. Need to figure out how to have stories have content

* Remove whitespace

* Address feedback and add some basic logged-in tests

* Add more tests and webdrivers

* Remove whitespace

* Address feedback, add password fields to factory

* Add .circleci/config.yml

* Update config.yml

* Add --full-index

* Update config and add needed gem

* Change way bundle install is working

* Add dependency to lock

* trying bundle update

* Correct YML syntax

* Add more to the config

* Strip rspec command down for the time being

* Add environments for psql

* Add postgres image

* Fix formatting

* Add circle browser tools

* Add install lines

* Add the browsers flag to handle the chrome download

* Add the browsers flag to handle the chrome download the correct way

* Change image

* Change webdrivers version for earlier version of chrome

* Limit chromedriver version to be in line with chrome version

* Add line to check for version

* Remove a possibly broken line

* Switch back to stretch version

* Go back to installing at least the driver

* Add required orb

* Remove webdrivers from test

* Remove rake task

* Remove webdriver stuff

* Testing new solution

* Using selenium

* Using selenium and getting the newest form of chrome

* Add simplecov and a few more tests. Currently 89% coverage

* Add cov to circle file
  • Loading branch information
DanielSBrown authored May 14, 2020
1 parent bb00c7e commit e43d841
Show file tree
Hide file tree
Showing 12 changed files with 604 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: 2.1
orbs:
ruby: circleci/[email protected]
browser-tools: circleci/[email protected]

jobs:
build:
docker:
- image: circleci/ruby:2.5.1-stretch-node
environment:
RAILS_ENV: test
DATABASE_URL: "postgresql://root@localhost/adventure-time_test?pool=5"
BUNDLER_PATH: vendor/bundle
BUNDLER_JOBS: 4
YARN_CACHE_FOLDER: ~/.cache/yarn
- image: circleci/postgres:9.3-alpine-ram
environment:
POSTGRES_USER: root
POSTGRES_DB: adventure-time_test
TZ: "/usr/share/zoneinfo/America/New_York"

executor: ruby/default
steps:
- browser-tools/install-chrome
- checkout
- run:
name: Which bundler?
command: bundle -v
- run:
bundle update capistrano
- run:
bundle install --full-index
- run: node --version
- run: yarn --version
- run: yarn install

- run:
name: RSpec
command: bundle exec rspec
no_output_timeout: 1h
- store_artifacts:
path: coverage
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@
yarn-debug.log*
.yarn-integrity
.vscode/
coverage
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ gem 'capistrano-db-tasks', {

group :development, :test do
gem 'pry-rails'
gem 'rspec-rails', '~> 4.0.0'
end

group :development do
Expand All @@ -37,5 +38,8 @@ end
group :test do
gem 'capybara', '>= 2.15'
gem 'chromedriver-helper'
gem 'database_cleaner', '~> 0.9.1'
gem "factory_bot_rails"
gem 'selenium-webdriver'
gem 'simplecov', require: false
end
35 changes: 35 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,24 @@ GEM
coderay (1.1.2)
concurrent-ruby (1.1.5)
crass (1.0.5)
database_cleaner (0.9.1)
devise (4.7.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
diff-lcs (1.3)
docile (1.3.2)
erubi (1.8.0)
ethon (0.11.0)
ffi (>= 1.3.0)
execjs (2.7.0)
factory_bot (5.2.0)
activesupport (>= 4.2.0)
factory_bot_rails (5.2.0)
factory_bot (~> 5.2.0)
railties (>= 4.2.0)
faraday (0.15.2)
multipart-post (>= 1.2, < 3)
ffi (1.9.25)
Expand All @@ -114,6 +122,7 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.3.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
Expand Down Expand Up @@ -192,13 +201,35 @@ GEM
responders (3.0.0)
actionpack (>= 5.0)
railties (>= 5.0)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-rails (4.0.0)
actionpack (>= 4.2)
activesupport (>= 4.2)
railties (>= 4.2)
rspec-core (~> 3.9)
rspec-expectations (~> 3.9)
rspec-mocks (~> 3.9)
rspec-support (~> 3.9)
rspec-support (3.9.3)
ruby_dep (1.5.0)
rubyzip (1.3.0)
selenium-webdriver (3.141.0)
childprocess (~> 0.5)
rubyzip (~> 1.2, >= 1.2.2)
sentry-raven (2.7.4)
faraday (>= 0.7.6, < 1.0)
simplecov (0.17.0)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
Expand Down Expand Up @@ -251,15 +282,19 @@ DEPENDENCIES
capistrano-db-tasks!
capybara (>= 2.15)
chromedriver-helper
database_cleaner (~> 0.9.1)
devise
factory_bot_rails
listen (>= 3.0.5, < 3.2)
pg (>= 0.18, < 2.0)
pointless_feedback (~> 4.0.6)
pry-rails
puma (~> 3.12)
rails (~> 5.2.1)
rspec-rails (~> 4.0.0)
selenium-webdriver
sentry-raven
simplecov
spring
spring-watcher-listen (~> 2.0.0)
stat_board (~> 1.0.1)
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/sentry.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# :nocov
if Rails.env.production?
Raven.configure do |config|
config.dsn = 'https://de79a076153b4546b6a41a3ae60584d7:[email protected]/1322181'
end
end
# :nocov
122 changes: 122 additions & 0 deletions spec/factories/adventure.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
FactoryBot.define do
factory :adventure do
association :user, :factory => :user
description { "Test Story" }
title { "Test Story" }
slug { "test-story"}
has_password { false }
password { "" }
theme { "light" }
content { {"slug"=>"test-empty-content",
"story"=>
{"id"=>"4f4b1e22-5fa3-4b4d-8a01-7fe86a1f660e",
"offsetX"=>0,
"offsetY"=>0,
"zoom"=>100,
"gridSize"=>0,
"links"=>
[{"id"=>"b0bcbc51-9046-45e6-b38a-80b62f07120b",
"type"=>"default",
"selected"=>false,
"source"=>"94913fcb-4d8e-4314-b99e-e24646d5e551",
"sourcePort"=>"a0786b8b-8508-4328-b367-3c3a28976a0d",
"target"=>"38388378-6f4c-4631-884a-f63ff3ac8fb1",
"targetPort"=>"434b32bc-170d-41d2-9d31-9700be9033f9",
"points"=>
[{"id"=>"2b06a74b-88fe-479f-9392-77da960cda16", "selected"=>false, "x"=>367.9375, "y"=>271.5},
{"id"=>"f1adab1e-7086-4e9f-8895-258b232b2278", "selected"=>false, "x"=>442.765625, "y"=>241.4375}],
"extras"=>{},
"labels"=>[],
"width"=>3,
"color"=>"rgba(255,255,255,0.5)",
"curvyness"=>50},
{"id"=>"5d5a6262-5da2-4514-aeae-4efd3cf13ad5",
"type"=>"default",
"selected"=>false,
"source"=>"94913fcb-4d8e-4314-b99e-e24646d5e551",
"sourcePort"=>"5681e7ad-2b1f-4629-9ff4-0a4092e75a89",
"target"=>"9e59af2a-a4dd-4e2d-ac68-14f344ecb4db",
"targetPort"=>"0ae3490a-2034-487d-81ce-a42c5011e772",
"points"=>
[{"id"=>"efe043ca-dd4d-42be-8a77-c5e628def55b", "selected"=>false, "x"=>367.9375, "y"=>314.5},
{"id"=>"a9509f15-46c7-4412-8580-1aa25062f5c9", "selected"=>false, "x"=>449.421875, "y"=>391.703125}],
"extras"=>{},
"labels"=>[],
"width"=>3,
"color"=>"rgba(255,255,255,0.5)",
"curvyness"=>50}],
"nodes"=>
[{"id"=>"94913fcb-4d8e-4314-b99e-e24646d5e551",
"type"=>"default",
"selected"=>true,
"x"=>121,
"y"=>246,
"extras"=>{},
"ports"=>
[{"id"=>"a0786b8b-8508-4328-b367-3c3a28976a0d",
"type"=>"default",
"selected"=>false,
"name"=>"46e10351-0ca5-445c-b41b-5726d7abcd50",
"parentNode"=>"94913fcb-4d8e-4314-b99e-e24646d5e551",
"links"=>["b0bcbc51-9046-45e6-b38a-80b62f07120b"],
"in"=>false,
"label"=>"Choice 1"},
{"id"=>"5681e7ad-2b1f-4629-9ff4-0a4092e75a89",
"type"=>"default",
"selected"=>false,
"name"=>"75ee643b-e9f4-4f71-96bc-daa9e62b05db",
"parentNode"=>"94913fcb-4d8e-4314-b99e-e24646d5e551",
"links"=>["5d5a6262-5da2-4514-aeae-4efd3cf13ad5"],
"in"=>false,
"label"=>"Choice 2"}],
"name"=>"Start",
"color"=>"#4CAF50"},
{"id"=>"38388378-6f4c-4631-884a-f63ff3ac8fb1",
"type"=>"default",
"selected"=>false,
"x"=>444.7673906340974,
"y"=>203.44928447026237,
"extras"=>{},
"ports"=>
[{"id"=>"434b32bc-170d-41d2-9d31-9700be9033f9",
"type"=>"default",
"selected"=>false,
"name"=>"01247fcc-ed87-488b-9edd-13b9279856a0",
"parentNode"=>"38388378-6f4c-4631-884a-f63ff3ac8fb1",
"links"=>["b0bcbc51-9046-45e6-b38a-80b62f07120b"],
"in"=>true,
"label"=>"Input"}],
"name"=>"Decision 1",
"color"=>"#f6412d"},
{"id"=>"9e59af2a-a4dd-4e2d-ac68-14f344ecb4db",
"type"=>"default",
"selected"=>false,
"x"=>451.42860245001907,
"y"=>353.7076665392747,
"extras"=>{},
"ports"=>
[{"id"=>"0ae3490a-2034-487d-81ce-a42c5011e772",
"type"=>"default",

"selected"=>false,
"name"=>"d003fe27-f7c6-4100-b128-d703a7f4f1b1",
"parentNode"=>"9e59af2a-a4dd-4e2d-ac68-14f344ecb4db",
"links"=>["5d5a6262-5da2-4514-aeae-4efd3cf13ad5"],
"in"=>true,
"label"=>"Input"}],
"name"=>"Decision 2",
"color"=>"#f6412d"}]},
"meta"=>
{"94913fcb-4d8e-4314-b99e-e24646d5e551"=>
{"text"=>
"<p>This the starting scene, where you introduce your story to the reader. It's marked in green so you can find it easily.</p><p>Feel free to edit this text, the name above, and the choices below to write your first story.<br></p><p>If you don't set any choices for a scene, that scene is&nbsp;considered an end to the story and marked in red.</p>"},
"38388378-6f4c-4631-884a-f63ff3ac8fb1"=>{"text"=>"<p>This content is shown to the reader if they choose \"Choice 1\" in the opening scene.</p>"},
"9e59af2a-a4dd-4e2d-ac68-14f344ecb4db"=>{"text"=>"<p>This content is shown to the reader if they choose \"Choice 2\" in the opening scene.</p>"}},
"portMeta"=>{},
"modifiers"=>[],
"children"=>
[{"key"=>nil, "ref"=>nil, "props"=>{"viewOnly"=>false}, "_owner"=>nil, "_store"=>{}},
{"key"=>nil, "ref"=>nil, "props"=>{}, "_owner"=>nil, "_store"=>{}}]}
}
end
end
7 changes: 7 additions & 0 deletions spec/factories/user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FactoryBot.define do
factory :user do
email { "[email protected]" }
password { "password" }
password_confirmation { "password" }
end
end
Loading

0 comments on commit e43d841

Please sign in to comment.