-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge testing to add tests to staging branch
- Loading branch information
Showing
33 changed files
with
437 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Documentation here https://circleci.com/developer/orbs/orb/later/ruby-rails-setup | ||
# Following tutorial https://thoughtbot.com/blog/circleci-2-rails | ||
|
||
version: 2.1 | ||
orbs: | ||
ruby: circleci/ruby@0.1.2 | ||
ruby-rails-setup: later/ruby-rails-setup@0.0.3 | ||
|
||
jobs: | ||
build: | ||
working_directory: ~/compost-lyon | ||
docker: | ||
- image: circleci/ruby:2.6.3-node-browsers | ||
environment: | ||
PGHOST: localhost | ||
PGUSER: CompostLyon | ||
RAILS_ENV: test | ||
RACK_ENV: test | ||
NODE_ENV: test | ||
- image: postgres:9.5 | ||
environment: | ||
POSTGRES_USER: CompostLyon | ||
POSTGRES_DB: CompostLyon_test | ||
POSTGRES_PASSWORD: <%= ENV['COMPOSTLYON_DATABASE_PASSWORD'] %> | ||
executor: ruby/default | ||
steps: | ||
- checkout | ||
- run: | ||
name: Configure Bundler | ||
command: | | ||
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV | ||
source $BASH_ENV | ||
gem install bundler | ||
# Bundle install dependencies | ||
- run: bundle install | ||
- run: yarn install | ||
- run: bin/rails webpacker:compile | ||
- save_cache: | ||
key: v1-bundle-{{ checksum "Gemfile.lock" }}-{{ checksum "yarn.lock" }} | ||
paths: | ||
- vendor/bundle | ||
- public/packs-test | ||
# Setup the database | ||
- run: bundle exec rake db:drop RAILS_ENV=test | ||
- run: bundle exec rake db:create RAILS_ENV=test | ||
- run: bundle exec rake db:schema:load RAILS_ENV=test | ||
|
||
# --- RSPEC | ||
|
||
- run: | ||
name: Running tests | ||
command: bundle exec rspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--require spec_helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FactoryBot.define do | ||
factory :organisation, class: CollectiveComposting::Organisation do | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FactoryBot.define do | ||
factory :user do | ||
firstname { "John" } | ||
lastname { "Doe" } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# spec/features/visitor_signs_up_spec.rb | ||
require 'rails_helper' | ||
|
||
feature 'User signs in' do | ||
scenario 'successfuly with correct password' do | ||
sign_in_existing_user_with_correct_password | ||
expect(page).to have_content('Deconnexion') | ||
end | ||
scenario 'with wrong password gets error message' do | ||
sign_in_existing_user_with_wrong_password | ||
expect(page).to have_content('Courriel ou mot de passe incorrect') | ||
end | ||
scenario 'with wrong email gets error message' do | ||
sign_in_existing_user_with_wrong_email | ||
expect(page).to have_content('Courriel ou mot de passe incorrect') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# spec/features/visitor_signs_up_spec.rb | ||
require 'rails_helper' | ||
|
||
feature 'Visitor signs up' do | ||
scenario 'with valid email and password' do | ||
sign_up_with 'valid@example.com', 'password' | ||
|
||
expect(page).to have_content('Deconnexion') | ||
end | ||
|
||
scenario 'with invalid email' do | ||
sign_up_with 'invalid_email', 'password' | ||
|
||
expect(page).to have_content('Me connecter') | ||
end | ||
|
||
scenario 'with blank password' do | ||
sign_up_with 'valid@example.com', '' | ||
|
||
expect(page).to have_content('Me connecter') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'rails_helper' | ||
|
||
feature 'Visitor visits' do | ||
scenario 'home page' do | ||
visit root_path | ||
expect(page).to have_title('Compost Lyon - tout sur le compost à Lyon') | ||
end | ||
scenario 'about page' do | ||
visit about_path | ||
expect(page).to have_title('Compost Lyon - Le projet') | ||
end | ||
scenario 'collective composting page' do | ||
visit collective_composting_path | ||
expect(page).to have_title('Compostage collectif à Lyon') | ||
end | ||
scenario 'sites index' do | ||
visit sites_path | ||
expect(page).to have_title('Composteurs collectifs de quartier de Lyon et des environs') | ||
end | ||
scenario 'condominium sites index' do | ||
visit condominium_sites_path | ||
expect(page).to have_title('Composteurs collectifs de copropriété à Lyon') | ||
end | ||
scenario 'organisations index' do | ||
visit collective_composting_organisations_path | ||
expect(page).to have_title('Compostage collectif - les acteurs') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require 'rails_helper' | ||
RSpec.describe Site, :type => :model do | ||
context "name changes" do | ||
|
||
before(:all) do | ||
user = create(:user, email: 'testing@gmail.com', password: 'password') | ||
@organisation = create(:organisation, name: 'Collectif test', user_id: user.id) | ||
end | ||
|
||
describe "name is 'Compost Bahadourian (de la Guill)'" do | ||
it "slug is 'composteur-bahadourian-de-la-guill'" do | ||
site = @organisation.sites.create(name: "Compost Bahadourian (de la Guill)") | ||
expect(site.formatted_name).to eq("Composteur Bahadourian (de la Guill)") | ||
expect(site.slug).to eq("composteur-bahadourian-de-la-guill") | ||
end | ||
end | ||
describe "name is 'Compostage Potakin'" do | ||
it "slug is 'composteur-potakin'" do | ||
site = @organisation.sites.create(name: "Compostage Potakin") | ||
expect(site.formatted_name).to eq("Composteur Potakin") | ||
expect(site.slug).to eq("composteur-potakin") | ||
end | ||
end | ||
describe "name is 'Composteur ATOME Village'" do | ||
it "slug is 'composteur-atome-village'" do | ||
site = @organisation.sites.create(name: "Composteur ATOME Village") | ||
expect(site.formatted_name).to eq("Composteur ATOME Village") | ||
expect(site.slug).to eq("composteur-atome-village") | ||
end | ||
end | ||
describe "name is 'Clos de Fourvière'" do | ||
it "slug is 'composteur-clos-de-fourviere'" do | ||
site = @organisation.sites.create(name: "Clos de Fourvière") | ||
expect(site.formatted_name).to eq("Composteur Clos de Fourvière") | ||
expect(site.slug).to eq("composteur-clos-de-fourviere") | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.