Merge pull request #887 from ZmagoD/zd_SCI_1762

fixes rspec tests
This commit is contained in:
Zmago Devetak 2017-11-24 11:48:39 +01:00 committed by GitHub
commit 215fa9d0b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 50 additions and 22 deletions

View file

@ -114,7 +114,7 @@ group :test do
gem 'capybara'
gem 'capybara-email'
gem 'poltergeist'
gem 'phantomjs', :require => 'phantomjs/poltergeist'
gem 'phantomjs', require: 'phantomjs/poltergeist'
gem 'simplecov', require: false
gem 'json_matchers'
end

View file

@ -139,9 +139,9 @@ GEM
activesupport (>= 3.0.0)
uniform_notifier (~> 1.10.0)
byebug (9.1.0)
capybara (2.13.0)
capybara (2.16.1)
addressable
mime-types (>= 1.16)
mini_mime (>= 0.1.3)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
@ -281,11 +281,12 @@ GEM
loofah (2.1.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.6.6)
mime-types (>= 1.16, < 4)
mail (2.7.0)
mini_mime (>= 0.1.1)
method_source (0.9.0)
mime-types (1.25.1)
mimemagic (0.3.2)
mini_mime (1.0.0)
mini_portile2 (2.1.0)
minitest (5.10.3)
momentjs-rails (2.17.1)
@ -329,7 +330,7 @@ GEM
pry (~> 0.10)
pry-rails (0.3.6)
pry (>= 0.10.4)
public_suffix (3.0.0)
public_suffix (3.0.1)
puma (3.10.0)
rack (2.0.3)
rack-test (0.6.3)

View file

@ -83,7 +83,7 @@ integration-tests:
@$(MAKE) rails cmd="bundle exec cucumber"
tests-ci:
@docker-compose run -e PAPERCLIP_HASH_SECRET=PAPERCLIP_HASH_SECRET -e PAPERCLIP_STORAGE=filesystem -e ENABLE_TUTORIAL=false -e ENABLE_RECAPTCHA=false -e ENABLE_USER_CONFIRMATION=false -e ENABLE_USER_REGISTRATION=true --rm web bash -c "bundle install && rake db:create db:migrate && rake db:migrate RAILS_ENV=test && yarn install && bundle exec rspec && bundle exec cucumber"
@docker-compose run -e ENABLE_EMAIL_CONFIRMATIONS=false -e MAILER_PORT=$MAILER_PORT -e SMTP_DOMAIN=$SMTP_DOMAIN -e SMTP_USERNAME=$SMTP_USERNAME -e SMTP_PASSWORD=$SMTP_PASSWORD -e SMTP_ADDRESS=$SMTP_ADDRESS -e PAPERCLIP_HASH_SECRET=PAPERCLIP_HASH_SECRET -e MAIL_SERVER_URL=localhost -e PAPERCLIP_STORAGE=filesystem -e ENABLE_TUTORIAL=false -e ENABLE_RECAPTCHA=false -e ENABLE_USER_CONFIRMATION=false -e ENABLE_USER_REGISTRATION=true --rm web bash -c "bundle install && rake db:create db:migrate && rake db:migrate RAILS_ENV=test && yarn install && bundle exec rspec && bundle exec cucumber"
console:
@$(MAKE) rails cmd="rails console"

View file

@ -4,8 +4,11 @@ Rails.application.configure do
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = ENV['WORKER'] ? true : false
if ENV['CUCUMBER'] == 'cucumber'
config.cache_classes = true
else
config.cache_classes = ENV['WORKER'] ? true : false
end
# Do not eager load code on boot.
config.eager_load = ENV['WORKER'] ? true : false

View file

@ -9,7 +9,7 @@ Feature: Addon versions
| email | password | password_confirmation | full_name | initials |
| admin@myorg.com | mypassword1234 | mypassword1234 | Karli Novak | KN |
And "admin@myorg.com" is in "BioSistemika Process" team as a "admin"
And is signed in with "admin@myorg.com", "mypassword1234"
And "admin@myorg.com" is signed in with "mypassword1234"
@javascript
Scenario: Open the sciNote addons modal

View file

@ -24,6 +24,7 @@ Scenario: User forgot their password and enters non valid email
And I click "Send me reset password instruction" button
Then I should see "Email not found"
@javascript
Scenario: User has got Reset Your Password email and click to link
Given I click on Reset Password link in the reset password email for user "nonadmin@myorg.com"
Then I should be on Change your password page

View file

@ -129,3 +129,7 @@ Then(/^I should see "([^"]*)" on "([^"]*)" element$/) do |text, element|
wait_for_ajax
expect(find(element)).to have_content(text)
end
Then("I wait for {int} sec") do |sec|
sleep sec
end

View file

@ -34,17 +34,17 @@ Given("I am on reset password page") do
end
Given("I click on Reset Password link in the reset password email for user {string}") do |email|
clear_emails
visit new_user_password_path
fill_in 'user_email', with: email
click_button 'Send me reset password instruction'
Delayed::Worker.new.work_off
sleep 10
open_email(email)
current_email.click_link 'Change my password'
end
Then("I should be on Change your password page") do
expect(page).to have_current_path(edit_user_password_path, only_path: true)
expect(page).to have_current_path(edit_user_password_path, ignore_query: true)
end
Given(/^I am on Log in page$/) do

View file

@ -15,11 +15,13 @@ require 'capybara/email'
Capybara.register_driver :poltergeist do |app|
options = {
# inspector: true,
screen_size: [1600, 1200],
screen_size: [1200, 900],
js_errors: false,
timeout: 30,
phantomjs: Phantomjs.path,
phantomjs_options: [
'--ignore-ssl-errors=yes'
'--ignore-ssl-errors=yes',
'--output-encoding=utf8'
]
}
Capybara::Poltergeist::Driver.new(app, options)
@ -86,9 +88,6 @@ end
# DatabaseCleaner.strategy = :truncation
# end
#
# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
# DatabaseCleaner.strategy = :transaction
# end
#
# Possible values are :truncation and :transaction

View file

@ -19,7 +19,11 @@ describe SampleGroup, type: :model do
it { should belong_to :team }
it { should belong_to(:created_by).class_name('User') }
it { should belong_to(:last_modified_by).class_name('User') }
it { should have_many :samples }
it 'have many samples' do
table = SampleGroup.reflect_on_association(:samples)
expect(table.macro).to eq(:has_many)
end
end
describe 'Should be a valid object' do

View file

@ -18,7 +18,11 @@ describe SampleType, type: :model do
it { should belong_to :team }
it { should belong_to(:created_by).class_name('User') }
it { should belong_to(:last_modified_by).class_name('User') }
it { should have_many :samples }
it 'have many samples' do
table = SampleType.reflect_on_association(:samples)
expect(table.macro).to eq(:has_many)
end
end
describe 'Should be a valid object' do

View file

@ -53,7 +53,6 @@ describe User, type: :model do
it { should have_many :results }
it { should have_many :samples }
it { should have_many :samples_tables }
it { should have_many :repositories }
it { should have_many :repository_table_states }
it { should have_many :steps }
it { should have_many :custom_fields }
@ -79,7 +78,6 @@ describe User, type: :model do
it { should have_many :archived_projects }
it { should have_many :restored_projects }
it { should have_many :modified_reports }
it { should have_many :modified_results }
it { should have_many :archived_results }
it { should have_many :restored_results }
it { should have_many :created_sample_groups }
@ -88,7 +86,6 @@ describe User, type: :model do
it { should have_many :created_sample_types }
it { should have_many :modified_sample_types }
it { should have_many :modified_samples }
it { should have_many :modified_steps }
it { should have_many :created_tables }
it { should have_many :modified_tables }
it { should have_many :created_tags }
@ -104,6 +101,21 @@ describe User, type: :model do
it { should have_many :user_notifications }
it { should have_many :notifications }
it { should have_many :zip_exports }
it 'have many repositories' do
table = User.reflect_on_association(:repositories)
expect(table.macro).to eq(:has_many)
end
it 'have many modified results' do
table = User.reflect_on_association(:modified_results)
expect(table.macro).to eq(:has_many)
end
it 'have many modified steps' do
table = User.reflect_on_association(:modified_steps)
expect(table.macro).to eq(:has_many)
end
end
describe 'Should be a valid object' do