mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 17:51:13 +08:00
fixes rspec tests
This commit is contained in:
parent
a2af2fcd7c
commit
70db34090d
8 changed files with 40 additions and 13 deletions
1
.rspec
1
.rspec
|
@ -1,2 +1,3 @@
|
|||
--require spec_helper
|
||||
--format documentation
|
||||
--color
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -111,7 +111,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
|
||||
|
|
|
@ -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.
|
||||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 repositories' do
|
||||
table = User.reflect_on_association(:modified_results)
|
||||
expect(table.macro).to eq(:has_many)
|
||||
end
|
||||
|
||||
it 'have many repositories' do
|
||||
table = User.reflect_on_association(:modified_steps)
|
||||
expect(table.macro).to eq(:has_many)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Should be a valid object' do
|
||||
|
|
Loading…
Reference in a new issue