-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System tests #303
Merged
Merged
System tests #303
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fe0aa36
adding simple system tests for public pages
tsubik d300859
make pg_restore faster
tsubik 3db5072
company selector specs
tsubik 6a89f95
couple simple cclow public pages tests
tsubik 698c01c
add cclow geographies specs
tsubik 512bcfe
moar cclow public pages tests
tsubik b7b1cb8
remove not needed decorator
tsubik 4461bfe
remove commented code
tsubik 0d056c4
add some missing slugs, releted -> related
tsubik 218e4cc
some more leftovers of wrong links
tsubik e4bdf50
fix rails warning messages
tsubik 54fc4d5
bump rspec-rails versio
tsubik b998292
Merge branch 'develop' into system-tests
simaob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 was deleted.
Oops, something went wrong.
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
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
Binary file not shown.
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,34 @@ | ||
namespace :test do | ||
desc 'Recreate DB dump used in system tests by running seeds and dumping database' | ||
task :db_dump do | ||
abort 'Run recreatedb task only in test env! RAILS_ENV=test bin/rails test:db_dump' unless Rails.env.test? | ||
|
||
Rake::Task['db:test:prepare'].invoke | ||
Rails.application.load_seed | ||
system "pg_dump -Fc --no-owner --dbname=#{db_name} > #{dump_path}" | ||
DatabaseCleaner.clean_with(:truncation) | ||
end | ||
|
||
task :db_load do | ||
unless File.exist?(dump_path) | ||
puts "Dump file #{dump_path} does not existing. Invoking db_dump task to create it" | ||
Rake::Task['test:db_dump'].invoke | ||
end | ||
|
||
system "pg_restore -j 8 --clean --no-owner --dbname=#{db_name} #{dump_path}" | ||
end | ||
|
||
private | ||
|
||
def dump_path | ||
Rails.root.join('db/test-dump.psql').to_path | ||
end | ||
|
||
def db_name | ||
"postgresql://#{db_config['username']}:#{db_config['password']}@127.0.0.1:5432/#{db_config['database']}" | ||
end | ||
|
||
def db_config | ||
Rails.configuration.database_configuration[Rails.env] | ||
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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
require 'simplecov' | ||
require 'timecop' | ||
require 'capybara/rspec' | ||
|
||
SimpleCov.start do | ||
add_filter '/spec/' | ||
|
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,5 @@ | ||
module CapybaraHelpers | ||
def contains_class(class_name) | ||
"contains(concat(' ', normalize-space(@class), ' '), ' #{class_name} ')" | ||
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,12 @@ | ||
require 'rails_helper' | ||
|
||
describe 'Climate Targets search', type: 'system' do | ||
before do | ||
visit 'cclow/climate_targets' | ||
end | ||
|
||
it 'loads the page' do | ||
expect(page).to have_text('All Climate Targets') | ||
expect(page).to have_text('Showing 1993 results') | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests would need to be updated if we change the test dump, right? Not sure if I'm understanding correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's why it's not that great. Although, seeds were not changed for a quite a while