diff --git a/.buildpacks b/.buildpacks new file mode 100644 index 0000000..9fb1242 --- /dev/null +++ b/.buildpacks @@ -0,0 +1,2 @@ +https://github.com/heroku/heroku-buildpack-nodejs.git +https://github.com/heroku/heroku-buildpack-ruby.git diff --git a/.gitignore b/.gitignore index e62f78e..fb37970 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,7 @@ bower.json # Ignore node_modules node_modules/ +public/dcic_docs/* +!public/dcic_docs/Mobile_AD +.DS_Store + diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..08af9cb --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +scribe diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..76521af --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-2.2.0 diff --git a/Capfile b/Capfile new file mode 100644 index 0000000..8f99ee4 --- /dev/null +++ b/Capfile @@ -0,0 +1,43 @@ +# Load DSL and set up stages +require "capistrano/setup" + +# Include default deployment tasks +require "capistrano/deploy" + +require 'capistrano/rails' +require 'capistrano/passenger' +require 'capistrano/rvm' +set :rvm_type, :user +set :rvm_ruby_version, '2.2.0' +# Load the SCM plugin appropriate to your project: +# +# require "capistrano/scm/hg" +# install_plugin Capistrano::SCM::Hg +# or +# require "capistrano/scm/svn" +# install_plugin Capistrano::SCM::Svn +# or +require "capistrano/scm/git" +install_plugin Capistrano::SCM::Git + +# Include tasks from other gems included in your Gemfile +# +# For documentation on these, see for example: +# +# https://github.com/capistrano/rvm +# https://github.com/capistrano/rbenv +# https://github.com/capistrano/chruby +# https://github.com/capistrano/bundler +# https://github.com/capistrano/rails +# https://github.com/capistrano/passenger +# +# require "capistrano/rvm" +# require "capistrano/rbenv" +# require "capistrano/chruby" +# require "capistrano/bundler" +# require "capistrano/rails/assets" +# require "capistrano/rails/migrations" +# require "capistrano/passenger" + +# Load custom tasks from `lib/capistrano/tasks` if you have any defined +Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r } diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e356a7d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM zooniverse/ruby:2.1.5 + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update && apt-get upgrade -y && \ + apt-get install -y git nodejs npm coffeescript && \ + ln -s /usr/bin/nodejs /usr/local/bin/node + +ADD . /src/ + +WORKDIR /src/ + +RUN bundle install + +RUN npm install + +EXPOSE 80 + +ENTRYPOINT ["/src/start.sh"] diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..0c17987 --- /dev/null +++ b/Gemfile @@ -0,0 +1,80 @@ +source 'https://rubygems.org' + +ruby '2.2.0' + +gem 'rails', '4.0.13' +gem "nokogiri", "~> 1.6.8" +gem 'sass-rails', '~> 4.0.0' +gem 'uglifier', '>= 1.3.0' +gem 'coffee-rails', '4.0.1' +gem 'jquery-rails', '3.1.2' +gem 'turbolinks' +gem 'jbuilder', '~> 1.2' +gem 'devise' +gem 'omniauth-facebook', '~> 4.0.0' +gem "omniauth-google-oauth2" +gem 'omniauth-zooniverse', '~> 0.0.3' + +gem 'mongoid', '~> 4.0.2' +gem 'active_model_serializers', '0.9.3' +gem 'mongoid-serializer' +gem 'rack-cors', :require => 'rack/cors' +gem "bson" +gem "moped", '2.0.4' +gem 'sprockets-coffee-react', '3.0.1' +gem 'stylus', '~> 1.0.1' +gem 'browserify-rails', '~> 0.9.1' +gem 'react-rails', '1.0.0'#, github: 'reactjs/react-rails' + +gem 'rack-streaming-proxy', '~> 2.0.1' +gem 'kaminari' +gem 'fastimage', '1.7.0' + +gem 'actionpack-action_caching' + +gem 'newrelic_rpm', '3.13.2.302' +gem 'newrelic_moped', '1.0.1' + +gem 'puma', '~> 2.14.0' + +gem 'logstasher', '~> 0.6' + +gem 'aws-sdk', '~> 2' + +# gem 'mongoid_fulltext' + +group :development do + gem 'dotenv-rails' +end + +group :development, :production do + gem 'better_errors' + gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :rbx] + gem 'quiet_assets' + gem 'rails_layout' + gem 'pry' +end + +group :production do + gem 'net-ssh', '~> 4.2' + gem 'capistrano', '~> 3.7', '>= 3.7.1' + gem 'capistrano-rails', '~> 1.2' + gem 'capistrano-passenger', '~> 0.2.0' + gem 'capistrano-rvm', '~> 0.1.2' +end + +group :assets do + gem 'jquery-ui-sass-rails' +end + +group :test do + gem 'capybara' + gem 'cucumber-rails', :require=>false + gem 'database_cleaner', '1.0.1' + gem 'rspec-rails', '~> 3.0' + gem 'shoulda-matchers' + gem 'email_spec' + gem 'launchy' + gem 'factory_girl' + gem 'mongoid-rspec', '2.2.0' #, '>= 1.6.0', :github=>"myeong/mongoid-rspec" +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..4cf993f --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,393 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.0.13) + actionpack (= 4.0.13) + mail (~> 2.5, >= 2.5.4) + actionpack (4.0.13) + activesupport (= 4.0.13) + builder (~> 3.1.0) + erubis (~> 2.7.0) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + actionpack-action_caching (1.2.0) + actionpack (>= 4.0.0, < 6) + active_model-shaz (0.0.1) + active_model_serializers (0.9.3) + activemodel (>= 3.2) + activemodel (4.0.13) + activesupport (= 4.0.13) + builder (~> 3.1.0) + activerecord (4.0.13) + activemodel (= 4.0.13) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.13) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.4) + activesupport (4.0.13) + i18n (~> 0.6, >= 0.6.9) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + addressable (2.6.0) + public_suffix (>= 2.0.2, < 4.0) + airbrussh (1.3.1) + sshkit (>= 1.6.1, != 1.7.0) + arel (4.0.2) + aws-sdk (2.11.227) + aws-sdk-resources (= 2.11.227) + aws-sdk-core (2.11.227) + aws-sigv4 (~> 1.0) + jmespath (~> 1.0) + aws-sdk-resources (2.11.227) + aws-sdk-core (= 2.11.227) + aws-sigv4 (1.0.3) + backports (3.12.0) + bcrypt (3.1.12) + better_errors (2.5.1) + coderay (>= 1.0.0) + erubi (>= 1.0.0) + rack (>= 0.9.0) + binding_of_caller (0.8.0) + debug_inspector (>= 0.0.1) + browserify-rails (0.9.3) + sprockets (~> 2.2) + bson (2.3.0) + builder (3.1.4) + capistrano (3.11.0) + airbrussh (>= 1.0.0) + i18n + rake (>= 10.0.0) + sshkit (>= 1.9.0) + capistrano-bundler (1.5.0) + capistrano (~> 3.1) + capistrano-passenger (0.2.0) + capistrano (~> 3.0) + capistrano-rails (1.4.0) + capistrano (~> 3.1) + capistrano-bundler (~> 1.1) + capistrano-rvm (0.1.2) + capistrano (~> 3.0) + sshkit (~> 1.2) + capybara (2.18.0) + addressable + mini_mime (>= 0.1.3) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + xpath (>= 2.0, < 4.0) + coderay (1.1.2) + coffee-rails (4.0.1) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.0) + coffee-react (4.0.1) + execjs + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + concurrent-ruby (1.1.4) + connection_pool (2.2.2) + cucumber (3.1.2) + builder (>= 2.1.2) + cucumber-core (~> 3.2.0) + cucumber-expressions (~> 6.0.1) + cucumber-wire (~> 0.0.1) + diff-lcs (~> 1.3) + gherkin (~> 5.1.0) + multi_json (>= 1.7.5, < 2.0) + multi_test (>= 0.1.2) + cucumber-core (3.2.1) + backports (>= 3.8.0) + cucumber-tag_expressions (~> 1.1.0) + gherkin (~> 5.0) + cucumber-expressions (6.0.1) + cucumber-rails (1.5.0) + capybara (>= 1.1.2, < 3) + cucumber (>= 1.3.8, < 4) + mime-types (>= 1.17, < 4) + nokogiri (~> 1.5) + railties (>= 4, < 5.2) + cucumber-tag_expressions (1.1.1) + cucumber-wire (0.0.1) + database_cleaner (1.0.1) + debug_inspector (0.0.3) + devise (3.5.10) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 3.2.6, < 5) + responders + thread_safe (~> 0.1) + warden (~> 1.2.3) + diff-lcs (1.3) + dotenv (2.7.0) + dotenv-rails (2.7.0) + dotenv (= 2.7.0) + railties (>= 3.2, < 6.1) + email_spec (2.2.0) + htmlentities (~> 4.3.3) + launchy (~> 2.1) + mail (~> 2.7) + erubi (1.8.0) + erubis (2.7.0) + execjs (2.7.0) + factory_girl (4.9.0) + activesupport (>= 3.0.0) + faraday (0.15.4) + multipart-post (>= 1.2, < 3) + fastimage (1.7.0) + addressable (~> 2.3, >= 2.3.5) + gherkin (5.1.0) + hashie (3.6.0) + hike (1.2.3) + htmlentities (4.3.4) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + jbuilder (1.5.3) + activesupport (>= 3.0.0) + multi_json (>= 1.2.0) + jmespath (1.4.0) + jquery-rails (3.1.2) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) + jquery-ui-rails (4.0.3) + jquery-rails + railties (>= 3.1.0) + jquery-ui-sass-rails (4.0.3.0) + jquery-rails + jquery-ui-rails (= 4.0.3) + railties (>= 3.1.0) + jwt (2.1.0) + kaminari (0.17.0) + actionpack (>= 3.0.0) + activesupport (>= 3.0.0) + launchy (2.4.3) + addressable (~> 2.3) + logstash-event (1.2.02) + logstasher (0.9.0) + activerecord (>= 3.0) + activesupport (>= 3.0) + logstash-event (~> 1.2.0) + request_store + mail (2.7.1) + mini_mime (>= 0.1.1) + method_source (0.9.2) + mime-types (3.2.2) + mime-types-data (~> 3.2015) + mime-types-data (3.2018.0812) + mini_mime (1.0.1) + mini_portile2 (2.1.0) + minitest (4.7.5) + mongoid (4.0.2) + activemodel (~> 4.0) + moped (~> 2.0.0) + origin (~> 2.1) + tzinfo (>= 0.3.37) + mongoid-rspec (2.2.0) + mongoid (~> 4.0.0) + rake + rspec (~> 3.1) + mongoid-serializer (0.0.5) + active_model-shaz + mongoid (>= 3.0) + moped (2.0.4) + bson (~> 2.2) + connection_pool (~> 2.0) + optionable (~> 0.2.0) + multi_json (1.13.1) + multi_test (0.1.2) + multi_xml (0.6.0) + multipart-post (2.0.0) + net-scp (1.2.1) + net-ssh (>= 2.6.5) + net-ssh (4.2.0) + newrelic_moped (1.0.1) + moped + newrelic_rpm (~> 3.11) + newrelic_rpm (3.13.2.302) + nokogiri (1.6.8.1) + mini_portile2 (~> 2.1.0) + oauth2 (1.4.1) + faraday (>= 0.8, < 0.16.0) + jwt (>= 1.0, < 3.0) + multi_json (~> 1.3) + multi_xml (~> 0.5) + rack (>= 1.2, < 3) + omniauth (1.4.2) + hashie (>= 1.2, < 4) + rack (>= 1.0, < 3) + omniauth-facebook (4.0.0) + omniauth-oauth2 (~> 1.2) + omniauth-google-oauth2 (0.2.6) + omniauth (> 1.0) + omniauth-oauth2 (~> 1.1) + omniauth-oauth2 (1.3.1) + oauth2 (~> 1.0) + omniauth (~> 1.2) + omniauth-zooniverse (0.0.4) + omniauth-oauth2 (= 1.3.1) + optionable (0.2.0) + origin (2.3.1) + orm_adapter (0.5.0) + pry (0.12.2) + coderay (~> 1.1.0) + method_source (~> 0.9.0) + public_suffix (3.0.3) + puma (2.14.0) + quiet_assets (1.1.0) + railties (>= 3.1, < 5.0) + rack (1.5.5) + rack-cors (1.0.2) + rack-streaming-proxy (2.0.2) + rack (>= 1.4) + servolux (~> 0.10) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.0.13) + actionmailer (= 4.0.13) + actionpack (= 4.0.13) + activerecord (= 4.0.13) + activesupport (= 4.0.13) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.13) + sprockets-rails (~> 2.0) + rails_layout (1.0.42) + railties (4.0.13) + actionpack (= 4.0.13) + activesupport (= 4.0.13) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.2) + react-rails (1.0.0) + coffee-script-source (~> 1.8) + connection_pool + execjs + rails (>= 3.1) + react-source (~> 0.13) + react-source (0.13.3) + request_store (1.4.1) + rack (>= 1.4) + responders (1.1.2) + railties (>= 3.2, < 4.2) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-rails (3.8.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) + sass (3.2.19) + sass-rails (4.0.5) + railties (>= 4.0.0, < 5.0) + sass (~> 3.2.2) + sprockets (~> 2.8, < 3.0) + sprockets-rails (~> 2.0) + servolux (0.13.0) + shoulda-matchers (3.1.3) + activesupport (>= 4.0.0) + sprockets (2.12.5) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sprockets-coffee-react (3.0.1) + coffee-react (>= 3.0.1) + coffee-script + sprockets + tilt + sprockets-rails (2.3.3) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + sshkit (1.18.2) + net-scp (>= 1.1.2) + net-ssh (>= 2.8.0) + stylus (1.0.2) + execjs + stylus-source + stylus-source (0.54.5) + thor (0.20.3) + thread_safe (0.3.6) + tilt (1.4.1) + turbolinks (5.2.0) + turbolinks-source (~> 5.2) + turbolinks-source (5.2.0) + tzinfo (0.3.55) + uglifier (4.1.20) + execjs (>= 0.3.0, < 3) + warden (1.2.7) + rack (>= 1.0) + xpath (2.1.0) + nokogiri (~> 1.3) + +PLATFORMS + ruby + +DEPENDENCIES + actionpack-action_caching + active_model_serializers (= 0.9.3) + aws-sdk (~> 2) + better_errors + binding_of_caller + browserify-rails (~> 0.9.1) + bson + capistrano (~> 3.7, >= 3.7.1) + capistrano-passenger (~> 0.2.0) + capistrano-rails (~> 1.2) + capistrano-rvm (~> 0.1.2) + capybara + coffee-rails (= 4.0.1) + cucumber-rails + database_cleaner (= 1.0.1) + devise + dotenv-rails + email_spec + factory_girl + fastimage (= 1.7.0) + jbuilder (~> 1.2) + jquery-rails (= 3.1.2) + jquery-ui-sass-rails + kaminari + launchy + logstasher (~> 0.6) + mongoid (~> 4.0.2) + mongoid-rspec (= 2.2.0) + mongoid-serializer + moped (= 2.0.4) + net-ssh (~> 4.2) + newrelic_moped (= 1.0.1) + newrelic_rpm (= 3.13.2.302) + nokogiri (~> 1.6.8) + omniauth-facebook (~> 4.0.0) + omniauth-google-oauth2 + omniauth-zooniverse (~> 0.0.3) + pry + puma (~> 2.14.0) + quiet_assets + rack-cors + rack-streaming-proxy (~> 2.0.1) + rails (= 4.0.13) + rails_layout + react-rails (= 1.0.0) + rspec-rails (~> 3.0) + sass-rails (~> 4.0.0) + shoulda-matchers + sprockets-coffee-react (= 3.0.1) + stylus (~> 1.0.1) + turbolinks + uglifier (>= 1.3.0) diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..4ffc563 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Zooniverse and New York Public Library + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..4cae32a --- /dev/null +++ b/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +API::Application.load_tasks diff --git a/app/assets/.js.coffee.cjsx b/app/assets/.js.coffee.cjsx new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/fonts/.keep b/app/assets/fonts/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/images/.keep b/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/images/black-pixel-screen.png b/app/assets/images/black-pixel-screen.png new file mode 100644 index 0000000..b50a975 Binary files /dev/null and b/app/assets/images/black-pixel-screen.png differ diff --git a/app/assets/images/bullet.svg b/app/assets/images/bullet.svg new file mode 100644 index 0000000..a0b325f --- /dev/null +++ b/app/assets/images/bullet.svg @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/app/assets/images/checkmark.png b/app/assets/images/checkmark.png new file mode 100644 index 0000000..feaa040 Binary files /dev/null and b/app/assets/images/checkmark.png differ diff --git a/app/assets/images/neh_logo.png b/app/assets/images/neh_logo.png new file mode 100644 index 0000000..c9828eb Binary files /dev/null and b/app/assets/images/neh_logo.png differ diff --git a/app/assets/images/nypllabs_logo.png b/app/assets/images/nypllabs_logo.png new file mode 100644 index 0000000..d2c51d6 Binary files /dev/null and b/app/assets/images/nypllabs_logo.png differ diff --git a/app/assets/images/scribe-logo-inv.png b/app/assets/images/scribe-logo-inv.png new file mode 100644 index 0000000..c8fe3a2 Binary files /dev/null and b/app/assets/images/scribe-logo-inv.png differ diff --git a/app/assets/images/searchtool.svg b/app/assets/images/searchtool.svg new file mode 100644 index 0000000..26806fb --- /dev/null +++ b/app/assets/images/searchtool.svg @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/app/assets/images/zooniverse_logo.png b/app/assets/images/zooniverse_logo.png new file mode 100644 index 0000000..d9811d8 Binary files /dev/null and b/app/assets/images/zooniverse_logo.png differ diff --git a/app/assets/javascripts/__tests__/action-button-test.cjsx b/app/assets/javascripts/__tests__/action-button-test.cjsx new file mode 100644 index 0000000..2ebe94e --- /dev/null +++ b/app/assets/javascripts/__tests__/action-button-test.cjsx @@ -0,0 +1,18 @@ +jest + .dontMock '../components/action-button' + + describe 'ActionButton', -> + React = require 'react/addons' + {renderIntoDocument, Simulate} = React.addons.TestUtils + + ActionButton = require '../components/action-button' + + it 'should grab the action-button code', -> + expect(ActionButton).toBeTruthy() + + actionButton = renderIntoDocument() + + + + + diff --git a/app/assets/javascripts/__tests__/generic-tests.cjsx b/app/assets/javascripts/__tests__/generic-tests.cjsx new file mode 100644 index 0000000..40d8678 --- /dev/null +++ b/app/assets/javascripts/__tests__/generic-tests.cjsx @@ -0,0 +1,12 @@ +jest + .dontMock '../components/core-tools/generic' + + describe "GenericTask", -> + React = require 'react/addons' + {renderIntoDocument, Simulate} = React.addons.TestUtils + + GenericTask = require '../components/core-tools/generic' + it 'should grab the GenericTask code', -> + expect(GenericTask).toBeTruthy() + # this isn't working becuase the props.answers is an array of react elements from the parent core-tool + # genericTask = renderIntoDocument() \ No newline at end of file diff --git a/app/assets/javascripts/__tests__/pick-one-test.cjsx b/app/assets/javascripts/__tests__/pick-one-test.cjsx new file mode 100644 index 0000000..4f7d4c0 --- /dev/null +++ b/app/assets/javascripts/__tests__/pick-one-test.cjsx @@ -0,0 +1,83 @@ +jest + .dontMock '../components/core-tools/pick-one' + +jest + .dontMock '../components/core-tools/generic' + + describe 'SingleChoiceTask/pickOne', -> + React = require 'react/addons' + + { + renderIntoDocument, + scryRenderedComponentsWithType, + scryRenderedDOMComponentsWithClass, + scryRenderedDOMComponentsWithTag, + createRenderer, + Simulate + } = React.addons.TestUtils + + task_object = { + generates_subject_type: null, + instruction: "Do you have a favorite ice cream flavour?", + key: "pick_page_type", + next_task: null, + tool: "pickOne" + tool_config: { + options: { + yes: { + label: "yes", + next_task: null + }, + no: { + label: "no", + next_task: null + } + } + } + } + + # mock of the props.onChange from subject-viewer + clickRecord = jest.genMockFunction() + + PickOne = require '../components/core-tools/pick-one' + GenericTask = require '../components/core-tools/generic' + + shallowRenderer = React.addons.TestUtils.createRenderer() + shallowRenderer.render() + result = shallowRenderer.getRenderOutput() + + it 'should load the SingleChoiceTask/pickOne', -> + expect(PickOne).toBeTruthy() + + # this seems like it could be improved. not sure that this is an effective use of shallowRender + it "should render a function with the displayName GenericTask", -> + expect(result.type.displayName).toBe("GenericTask") + expect(result.type.defaultProps.question).toBe('') + expect(result.type.defaultProps.answers).toBe('') + expect(result.type.defaultProps.help).toBe('') + + it "should create 2