source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20140417131622_change_ogluk_licence_id.rb
Ruby
mit
47
master
629
class ChangeOglukLicenceId < ActiveRecord::Migration def up data = Answer.joins(:question).where(questions: {reference_identifier: 'dataLicence'}).readonly(false) data.each do |d| case d.reference_identifier when 'uk_ogl' d.update_attributes(:reference_identifier => 'ogl_uk') end ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20130917150936_create_transfers.rb
Ruby
mit
47
master
259
class CreateTransfers < ActiveRecord::Migration def change create_table :transfers do |t| t.integer :dataset_id t.integer :user_id t.string :target_email t.string :aasm_state, default: 'new' t.timestamps end end end
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20130430110367_create_survey_translations.rb
Ruby
mit
47
master
330
# encoding: UTF-8 class CreateSurveyTranslations < ActiveRecord::Migration def self.up create_table :survey_translations do |t| # Content t.integer :survey_id # Reference t.string :locale t.text :translation t.timestamps end end def self.down drop_table :surveys ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20130613212741_create_response_cache_maps.rb
Ruby
mit
47
master
239
class CreateResponseCacheMaps < ActiveRecord::Migration def change create_table :response_cache_maps do |t| t.integer :origin_id t.integer :target_id t.integer :response_set_id t.timestamps end end end
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20140829104356_add_generate_stats_delayed_job.rb
Ruby
mit
47
master
369
class AddGenerateStatsDelayedJob < ActiveRecord::Migration def up Delayed::Job.enqueue GenerateStats, { :priority => 5, :run_at => DateTime.now.tomorrow.change(:hour => 3, :min => 00) } end def down stats = Delayed::Job.enqueue GenerateStats, { :priority => 5, :run_at => DateTime.now.tomorrow.change(:hou...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20141110155300_move_autocomplete_override_message_to_response.rb
Ruby
mit
47
master
1,025
class MoveAutocompleteOverrideMessageToResponse < ActiveRecord::Migration def up add_column :responses, :explanation, :string, :default => nil update_query = <<-SQL update responses r join autocomplete_override_messages ac on (r.response_set_id = ac.response_set_id and r.question_id = ac.que...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20130513155536_create_certificates.rb
Ruby
mit
47
master
278
class CreateCertificates < ActiveRecord::Migration def self.up create_table :certificates do |t| # Context t.integer :response_set_id # Content t.text :name t.timestamps end end def self.down drop_table :certificates end end
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20140721090011_add_missing_indexes.rb
Ruby
mit
47
master
1,593
class AddMissingIndexes < ActiveRecord::Migration def change add_index :survey_translations, :survey_id add_index :responses, :response_set_id add_index :responses, :question_id add_index :responses, :answer_id add_index :questions, :question_group_id add_index :questions, :correct_answer_id ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20140814092153_create_stats.rb
Ruby
mit
47
master
400
class CreateStats < ActiveRecord::Migration def change create_table :stats do |t| t.string :name t.integer :all t.integer :expired t.integer :publishers t.integer :this_month t.integer :level_none t.integer :level_basic t.integer :level_pilot t.integer :level...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20141202154424_restore_documentation_urls.rb
Ruby
mit
47
master
521
class RestoreDocumentationUrls < ActiveRecord::Migration def up update(<<-SQL) update datasets d join response_sets rs on (rs.dataset_id = d.id and rs.aasm_state = 'published') right outer join responses r on (rs.id=r.response_set_id) join questions q on (r.question_id = q.id and q.`refere...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20141117145346_expand_kitten_data_field.rb
Ruby
mit
47
master
225
class ExpandKittenDataField < ActiveRecord::Migration def change # 16.megabytes - 1 should trigger a column type of MEDIUMTEXT on MySQL change_column :kitten_data, :data, :text, :limit => 16.megabytes - 1 end end
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20130520111150_add_cert_population_fields_to_question.rb
Ruby
mit
47
master
224
class AddCertPopulationFieldsToQuestion < ActiveRecord::Migration def change add_column :questions, :text_as_statement, :string add_column :questions, :display_on_certificate, :boolean, :default => false end end
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20130520095300_alter_questions_add_default_value_to_requirement.rb
Ruby
mit
47
master
289
# encoding: UTF-8 class AlterQuestionsAddDefaultValueToRequirement < ActiveRecord::Migration def self.up change_column :questions, :required, :string, default: '', null: false end def self.down change_column :questions, :required, :string, default: nil, null: true end end
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20130809150653_populate_curator_for_certificates.rb
Ruby
mit
47
master
244
class PopulateCuratorForCertificates < ActiveRecord::Migration def up Certificate.where(curator: nil).find_each(batch_size: 20) do |c| c.delay.update_from_response_set unless c.response_set.nil? end end def down end end
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
db/migrate/20130806160042_change_licence_identifiers.rb
Ruby
mit
47
master
981
class ChangeLicenceIdentifiers < ActiveRecord::Migration def up data = Answer.joins(:question).where(questions: {:reference_identifier => 'dataLicence'}).readonly(false) data.each do |d| case d.reference_identifier when "odc_by_sa" d.update_attributes(:reference_identifier => "odc_odb...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/routes.rb
Ruby
mit
47
master
7,283
OpenDataCertificate::Application.routes.draw do require 'sidekiq/web' authenticate :user, lambda { |u| u.admin? } do mount Sidekiq::Web => '/sidekiq' end scope '/:locale', constraints: {locale: Regexp.union(I18n.available_locales.map(&:to_s))} do root :to => 'main#home' # 'Static' pages managed by...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/environment.rb
Ruby
mit
47
master
301
# Load the rails application require File.expand_path('../application', __FILE__) Mime::Type.register "text/turtle", :ttl Mime::Type.register "application/rdf+xml", :rdf Mime::Type.register "application/atom+xml", :feed # Initialize the rails application OpenDataCertificate::Application.initialize!
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/application.rb
Ruby
mit
47
master
4,271
require File.expand_path('../boot', __FILE__) require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets => %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.requi...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/puma.rb
Ruby
mit
47
master
758
workers Integer(ENV['WEB_CONCURRENCY'] || 2) threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5) threads threads_count, threads_count preload_app! rackup DefaultRackup port ENV['PORT'] || 3000 environment ENV['RACK_ENV'] || 'development' on_worker_boot do # See: https://devcenter.heroku.com/arti...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/initializers/delayed_job.rb
Ruby
mit
47
master
251
Delayed::Worker.destroy_failed_jobs = false Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'delayed_job.log')) Delayed::Worker.default_log_level = 'debug'.freeze Delayed::Worker.max_run_time = 8.hours Delayed::Worker.max_attempts = 1
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/initializers/session_store.rb
Ruby
mit
47
master
451
# Be sure to restart your server when you modify this file. OpenDataCertificate::Application.config.session_store :cookie_store, key: '_open-data-certificate_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the s...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/initializers/locales.rb
Ruby
mit
47
master
639
# Be sure to restart your server when you modify this file. I18n.load_path += Dir[Rails.root.join('surveys/translations/questionnaire.*.yml')] # set up language fallbacks so we don't see a lot of blank # space in development. I18n.backend.class.send(:include, I18n::Backend::Fallbacks) I18n.fallbacks.map('fr' => 'en'...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/initializers/secret_token.rb
Ruby
mit
47
master
713
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/initializers/airbrake.rb
Ruby
mit
47
master
404
if ENV['AIRBRAKE_CERTIFICATE_KEY'] Airbrake.configure do |config| config.api_key = ENV['AIRBRAKE_CERTIFICATE_KEY'] config.environment_name = ENV['AIRBRAKE_ENV'] # displayed in the 500.html error page config.user_information = "Exception ID <strong>{{ error_id }}</strong>" end require 'delayed-pl...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/initializers/i18n_custom_backend.rb
Ruby
mit
47
master
981
module OdiI18nBackend def store_translations(locale, data, options={}) super(locale, data, options) super('db', duplicate_locale_strings(data), options) if locale == 'en' super('bl', underscore_locale_strings(data), options) if locale == 'en' end def duplicate_locale_strings(data) deep_transform_...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/initializers/sidekiq.rb
Ruby
mit
47
master
251
Sidekiq.hook_rails! Sidekiq.remove_delay! Sidekiq.configure_server do |config| config.redis = { url: ENV['REDIS_URL'] } config.failures_default_mode = :all end Sidekiq.configure_client do |config| config.redis = { url: ENV['REDIS_URL'] } end
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/initializers/devise.rb
Ruby
mit
47
master
11,877
# Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use yo...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/environments/production.rb
Ruby
mit
47
master
3,471
OpenDataCertificate::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false c...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/environments/development.rb
Ruby
mit
47
master
1,685
OpenDataCertificate::Application.configure do # Settings specified here will take precedence over those in config/application.rb # 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 restar...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
config/environments/test.rb
Ruby
mit
47
master
1,651
OpenDataCertificate::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/test_helper.rb
Ruby
mit
47
master
2,128
if ENV['COVERAGE'] require 'coveralls' Coveralls.wear_merged! 'rails' end ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' require 'parallel_tests/test/runtime_logger' if Rails.env.development? require 'factory_girl' require 'vcr' require 'mocha/se...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/factories/stat_factory.rb
Ruby
mit
47
master
354
FactoryGirl.define do factory :stat do |s| s.all 0 s.expired 0 s.publishers 0 s.this_month 0 s.level_none 0 s.level_basic 0 s.level_pilot 0 s.level_standard 0 s.level_exemplar 0 factory :all_stat do |s| s.name "all" end factory :published_stat do |s| s.na...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/factories/dependency_factory.rb
Ruby
mit
47
master
584
FactoryGirl.define do factory :dependency do |d| # the dependent question d.association :question # d.question_id {} d.question_group_id {} d.rule { "A" } end factory :dependency_condition do |d| d.association :dependency # d.dependency_id {} d.rule_key { "A" } ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/factories/dataset_factory.rb
Ruby
mit
47
master
278
FactoryGirl.define do factory :dataset do title "Test dataset" documentation_url "http://www.example.com" factory :untitled_dataset do title nil end factory :dataset_without_documentation_url do documentation_url nil end end end
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/factories/user_factory.rb
Ruby
mit
47
master
767
FactoryGirl.define do factory :user do sequence :email do |n| "test#{n}@example.com" end password "testpassword" password_confirmation "testpassword" factory :user_with_responses do after(:create) do |user| FactoryGirl.create_list(:dataset, 3, user: user) user.datase...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/factories/certificate_factory.rb
Ruby
mit
47
master
3,003
FactoryGirl.define do factory :certificate do factory :published_certificate do aasm_state "published" published true published_at DateTime.now end end factory :certificate_with_dataset, :class => Certificate do name "Test certificate" after(:create) do |cert| FactoryGir...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/factories/answer_factory.rb
Ruby
mit
47
master
821
FactoryGirl.define do sequence(:answer_display_order) { |n| n } factory :answer do |a| a.association :question # a.question_id {} a.text "My favorite color is clear" a.short_text "clear" a.help_text "Clear is the absense of color" # a.weight a.response...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/factories/question_factory.rb
Ruby
mit
47
master
1,408
FactoryGirl.define do sequence(:question_display_order) { |n| n } factory :question do |q| q.association :survey_section # s.survey_section_id {} # q.question_group_id {} q.text "What is your favorite color?" q.short_text "favorite_color" q.help_text "...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/factories/transfer_factory.rb
Ruby
mit
47
master
222
FactoryGirl.define do factory :transfer do user dataset sequence :target_email do |n| "target#{n}@example.com" end factory :notified_transfer do aasm_state 'notified' end end end
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/factories/claim_factory.rb
Ruby
mit
47
master
399
FactoryGirl.define do factory :claim do initiating_user factory: :user user dataset factory :claim_on_published_certificate do after(:create) do |claim| create(:response_set_with_dataset, user: claim.user, dataset: claim.dataset, aasm_state: :published, ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/factories/survey_section_factory.rb
Ruby
mit
47
master
440
FactoryGirl.define do sequence(:survey_section_display_order) { |n| n } factory :survey_section do |s| s.association :survey # s.survey_id {} s.title { "Demographics" } s.description { "Asking you about your personal data" } s.display_order { FactoryGirl.generate :survey_section_...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/factories/response_set_factory.rb
Ruby
mit
47
master
1,276
FactoryGirl.define do factory :response_set do |r| user r.association :survey # r.survey_id {} r.access_code { Surveyor::Common.make_tiny_code } r.started_at { Time.now } factory :completed_response_set do completed_at { Time.now } end factory :published_response_set do ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/factories/validation_factory.rb
Ruby
mit
47
master
503
FactoryGirl.define do factory :validation do |v| v.association :answer # v.answer_id {} v.rule { "A" } v.message {} end factory :validation_condition do |v| v.association :validation # v.validation_id {} v.rule_key { "A" } v.question_id {} v.operator { "==" } v.answer...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/factories/survey_factory.rb
Ruby
mit
47
master
867
FactoryGirl.define do factory :survey do |s| meta_hash = { dataset_title: 'testDataTitle', dataset_curator: 'testPublisher', dataset_documentation_url: 'testDocumentationUrl' } s.title "Simple survey" s.description "A simple survey for testing" s.access_code { FactoryGi...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/embed_stats_controller_test.rb
Ruby
mit
47
master
496
require_relative '../test_helper' class EmbedStatsControllerTest < ActionController::TestCase include Devise::TestHelpers test "should generate a CSV of all embeds" do dataset = FactoryGirl.create :dataset dataset.register_embed("http://example.com") get 'index', locale: :en assert_response :suc...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/transfer_mailer_test.rb
Ruby
mit
47
master
487
require_relative '../test_helper' class TransferMailerTest < ActionMailer::TestCase test "transfer notify" do transfer = FactoryGirl.create :transfer email = TransferMailer.notify(transfer).deliver refute ActionMailer::Base.deliveries.empty? assert_equal [transfer.target_email], email.to asse...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/claims_mailer_test.rb
Ruby
mit
47
master
1,563
require_relative '../test_helper' class ClaimsMailerTest < ActionMailer::TestCase test "claim notify" do claim = FactoryGirl.create :claim_on_published_certificate email = ClaimMailer.notify(claim).deliver refute ActionMailer::Base.deliveries.empty? assert_equal [Devise.mailer_sender], email.to ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/datasets_controller_test.rb
Ruby
mit
47
master
24,100
require_relative '../test_helper' require 'rss' class DatasetsControllerTest < ActionController::TestCase include Devise::TestHelpers test "index shows all published datasets" do 5.times do FactoryGirl.create(:published_certificate_with_dataset) end 5.times do FactoryGirl.create(:certifica...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/certificates_controller_test.rb
Ruby
mit
47
master
13,629
require_relative '../test_helper' class CertificatesControllerTest < ActionController::TestCase include Devise::TestHelpers test "published certificates can be shown" do cert = FactoryGirl.create(:published_certificate_with_dataset) get :show, {locale: :en, dataset_id: cert.dataset.id, id: cert.id} as...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/campaigns_controller_test.rb
Ruby
mit
47
master
1,549
require_relative '../test_helper' class CampaignsControllerTest < ActionController::TestCase include Devise::TestHelpers setup do @user = FactoryGirl.create(:user) sign_in @user end test "should list all campaigns" do get :index assert_response :success end test "should 404 if campaign n...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/main_controller_test.rb
Ruby
mit
47
master
6,150
require_relative '../test_helper' class MainControllerTest < ActionController::TestCase include Devise::TestHelpers test "homepage" do get :home, locale: 'en' assert_response 200 end test "status shows correct stats" do all = FactoryGirl.create(:all_stat, all: 10, ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/response_sets_controller_test.rb
Ruby
mit
47
master
1,227
require_relative '../test_helper' class ResponseSetsControllerTest < ActionController::TestCase include Devise::TestHelpers test "user can destroy their response_set" do @user = FactoryGirl.create(:user) @response_set = FactoryGirl.create(:response_set, :user => @user) sign_in @user assert_diffe...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/surveyor_controller_test.rb
Ruby
mit
47
master
5,513
require_relative '../test_helper' class SurveyorControllerTest < ActionController::TestCase include Devise::TestHelpers test "continue survey" do @response_set = FactoryGirl.create(:response_set) sign_in @response_set.user assert_no_difference('ResponseSet.count') do post :continue, ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/flow_controller_test.rb
Ruby
mit
47
master
1,738
require_relative '../test_helper' require 'flow' class FlowchartsControllerTest < ActionController::TestCase include Devise::TestHelpers test "it sets defaults correctly" do get 'show' assert assigns(:jurisdiction) == "gb" assert assigns(:type) == "Practical" end # these tests should test that ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/claims_controller_test.rb
Ruby
mit
47
master
4,289
require_relative '../test_helper' class ClaimsControllerTest < ActionController::TestCase include Devise::TestHelpers test "creating a claim on an autogenerated dataset" do owner = FactoryGirl.create(:user) initiating_user = FactoryGirl.create(:user) certificate = FactoryGirl.create(:autogenerated_pub...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/application_controller_test.rb
Ruby
mit
47
master
851
require_relative '../test_helper' class ApplicationControllerTest < ActionController::TestCase test "parse iso8601 year only" do ac = ApplicationController.new assert_equal DateTime.new(2014, 1, 1), ac.send(:parse_iso8601, "2014") assert_equal DateTime.new(1999, 1, 1), ac.send(:parse_iso8601, "1999") ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/jurisdictions_controller_test.rb
Ruby
mit
47
master
581
require_relative '../test_helper' class JurisdictionsControllerTest < ActionController::TestCase test "should get index" do FactoryGirl.create :survey, title: "GB", access_code: "GB", full_title: "United Kingdoom", survey_version: 0 FactoryGirl.create :survey, title: "GB", access_code: "GB", full_title: "Un...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/transfers_controller_test.rb
Ruby
mit
47
master
3,804
require_relative '../test_helper' class TransfersControllerTest < ActionController::TestCase include Devise::TestHelpers test "user should create transfer" do user = FactoryGirl.create :user sign_in user dataset = FactoryGirl.create :dataset, user: user transfer = FactoryGirl.build :transfer, dat...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/functional/admin_controller_test.rb
Ruby
mit
47
master
1,120
require_relative '../test_helper' class AdminControllerTest < ActionController::TestCase include Devise::TestHelpers setup do @user = FactoryGirl.create :user @admin = FactoryGirl.create :admin_user end test "cannot be accessed by normal user" do sign_in @user get :index assert_response ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/performance/browsing_test.rb
Ruby
mit
47
master
382
require_relative '../test_helper' require 'rails/performance_test_help' class BrowsingTest < ActionDispatch::PerformanceTest # Refer to the documentation for all available options # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory] # :output => 'tmp/performance', :fo...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/integration/api_authentication_test.rb
Ruby
mit
47
master
816
require_relative '../test_helper' require "base64" class ApiAuthenticationTest < ActionDispatch::IntegrationTest def setup @user = FactoryGirl.create :user, email: 'test@example.com', authentication_token: 'test1234' end test "Unauthorised user tries to create a dataset" do cert = FactoryGirl.create(:p...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/integration/user_management_test.rb
Ruby
mit
47
master
455
require_relative '../test_helper' class UserManagementTest < ActionDispatch::IntegrationTest setup do user = FactoryGirl.create(:user, preferred_locale: 'cs') post_via_redirect '/users/sign_in', "user[email]" => user.email, "user[password]" => 'testpassword' end test "user is redirected to their prefer...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/integration/redirects_test.rb
Ruby
mit
47
master
2,872
require_relative '../test_helper' class RedirectsTest < ActionDispatch::IntegrationTest test "dashboard URL redirects" do get "/dashboard" assert_response :redirect assert_redirected_to '/users/dashboard' end test "certificate URL redirects" do cert = FactoryGirl.create(:published_certificate_w...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/integration/locale_routing_test.rb
Ruby
mit
47
master
1,138
require_relative '../test_helper' class LocaleRoutingTest < ActionDispatch::IntegrationTest test "route with a locale succedes" do get '/en/privacy-policy' assert_response :success end test "route with a non-default locale succedes" do get '/cs/privacy-policy' assert_response :success end ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/integration/data_dump_test.rb
Ruby
mit
47
master
4,247
# require_relative '../test_helper' # require File.join(Rails.root, 'lib/extra/certificate_dump') # require File.join(Rails.root, 'lib/extra/stats_dump') # # class DataDumpTest < ActionDispatch::IntegrationTest # # def service # Fog::Storage.new({ # :provider => 'Rackspace', # :rackspace_us...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/integration/survey_routing_test.rb
Ruby
mit
47
master
354
require_relative '../test_helper' class SurveyRoutingTest < ActionDispatch::IntegrationTest test "redirects old survey URL that includes :survey_code" do response_set = FactoryGirl.create(:response_set) get "/en/surveys/gb/#{response_set.access_code}/take" assert_redirected_to "/en/surveys/#{response_...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/survey_section_test.rb
Ruby
mit
47
master
701
require_relative '../test_helper' class SurveySectionTest < ActiveSupport::TestCase def setup @section = FactoryGirl.create :survey_section # add two questions, one to be the certificate @q1 = FactoryGirl.create :question, survey_section: @section @q2 = FactoryGirl.create :question_o...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/question_test.rb
Ruby
mit
47
master
11,980
require_relative '../test_helper' class QuestionTest < ActiveSupport::TestCase test "Question should have attributes we've added" do attributes_that_we_have_added = [:is_requirement, :corresponding_requirements, :required, :help_text_more_url] question = FactoryGirl.build(:question) attributes_that_we_h...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/survey_test.rb
Ruby
mit
47
master
5,934
require_relative '../test_helper' class SurveyTest < ActiveSupport::TestCase test "#superseded? returns false when survey is most recent version" do survey = FactoryGirl.create :survey # version 0 survey = FactoryGirl.create :survey, access_code: survey.access_code, survey_version: nil # version 1 asse...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/certification_campaign_test.rb
Ruby
mit
47
master
333
require_relative '../test_helper' class CertificationCampaignTest < ActiveSupport::TestCase def setup @user = FactoryGirl.create :user end test "determines CKAN factory" do campaign = CertificationCampaign.new(url: "http://data.gov.uk/") assert_equal campaign.factory, CertificateFactory::CKANFactor...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/flow_test.rb
Ruby
mit
47
master
6,198
require_relative '../test_helper' require 'flow' class FlowTest < ActiveSupport::TestCase include FlowchartHelper # Called before every test method runs. Can be used # to set up fixture information. def setup @practical = Flow.new("gb", "Practical") @legal = Flow.new("gb", "Legal") # binding.pry ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/transfer_test.rb
Ruby
mit
47
master
719
require_relative '../test_helper' class TransferTest < ActiveSupport::TestCase def setup Delayed::Job.destroy_all end test "notifying target user" do transfer = FactoryGirl.create :transfer assert_difference 'ActionMailer::Base.deliveries.size', 1 do transfer.notify Delayed::Worker.new...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/odibot_test.rb
Ruby
mit
47
master
5,813
require_relative '../test_helper' require 'odibot' class ODIBotTest < ActiveSupport::TestCase teardown do Rails.cache.clear end test "Should return correct response code for 200" do stub_request(:head, "http://www.example.com"). to_return(:body => "", status: 200) bot = ODIBot.new(...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/kitten_data_test.rb
Ruby
mit
47
master
24,297
require_relative '../test_helper' require 'mocha/setup' class KittenDataTest < ActiveSupport::TestCase class DataKitten::Dataset # this prevents DataKitten from making a request to the access_url def supported? true end end def set_normal_data distribution = DataKitten::Distribution.new(...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/odc_rake_test.rb
Ruby
mit
47
master
5,140
require_relative '../test_helper' require 'rake' OpenDataCertificate::Application.load_tasks class OdcRakeTest < ActiveSupport::TestCase # We are no longer testing all surveys (as there are ~250 now), instead we test (below) if: # * the UK parses correctly # * all files are all syntactically correct ruby ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/user_test.rb
Ruby
mit
47
master
4,128
require_relative '../test_helper' class UserTest < ActiveSupport::TestCase test "user is an admin if db column set" do @user1 = FactoryGirl.create :user, :admin => true @user2 = FactoryGirl.create :user @user3 = FactoryGirl.create :user, :admin => true assert @user1.admin?, 'user one is admin' ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/flow_help_test.rb
Ruby
mit
47
master
3,476
# foreach (question_hash, question_index in @questions) # foreach (answer_hash from question_hash) { # partialMethod(answerhash_val, answerhash_key, question_hash, question_index) # operations_on(partialMethod, [allPreviouslyPassedLocalVars]) # } # # partialMethod(){ # @dependencies # @questions # foreach(dep...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/csv_export_test.rb
Ruby
mit
47
master
1,782
require_relative '../test_helper' class CSVExportTest < ActiveSupport::TestCase test "job is enqueued for 3am the next day" do next_time = DateTime.now.utc.tomorrow.beginning_of_day + 3.hours Delayed::Job.expects(:enqueue).with(CSVExport, has_entries(:run_at => next_time)) DatasetsCSV.any_instance.stubs...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/certificate_test.rb
Ruby
mit
47
master
6,463
require_relative '../test_helper' class CertificateTest < ActiveSupport::TestCase def setup Certificate.destroy_all @certificate1 = FactoryGirl.create(:response_set_with_dataset).certificate @certificate2 = FactoryGirl.create(:response_set_with_dataset).certificate @certificate3 = FactoryGirl.creat...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/verification_test.rb
Ruby
mit
47
master
764
require_relative '../test_helper' class VerificationTest < ActiveSupport::TestCase test "should not save without user" do cv = FactoryGirl.build :verification, user: nil assert !cv.save end test "should not save without certificate" do cv = FactoryGirl.build :verification, certificate: nil asse...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/claim_test.rb
Ruby
mit
47
master
1,306
require_relative '../test_helper' class ClaimTest < ActiveSupport::TestCase def setup @dataset = FactoryGirl.create(:response_set_with_dataset).dataset @initiating_user = FactoryGirl.create(:user) @claim = Claim.create(dataset: @dataset, initiating_user: @initiating_user) end test "defaulting user t...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/dataset_test.rb
Ruby
mit
47
master
7,845
require_relative '../test_helper' class DatasetTest < ActiveSupport::TestCase [ [:untitled_dataset, :title, :set_default_title!, "Test original title", "Test dataset default title"], [:dataset, :curator, :set_default_curator!, "Some Org", "Newer Org"], [:dataset_without_documentation_url, :documentation...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/stat_test.rb
Ruby
mit
47
master
5,785
require_relative '../test_helper' class StatTest < ActiveSupport::TestCase context "with published certificates" do should "type is generated" do s = Stat.generate_published assert_equal s.name, 'published' end should "correct count for all certificates is generated" do 5.times do ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/response_set_test.rb
Ruby
mit
47
master
31,879
require_relative '../test_helper' class ResponseSetTest < ActiveSupport::TestCase should belong_to(:dataset) should have_one(:certificate) test "creating a response set creates a certificate" do assert_difference "Certificate.count", 1 do FactoryGirl.create :response_set end end test "comple...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/certificate_generator_test.rb
Ruby
mit
47
master
11,267
require_relative '../test_helper' class CertificateGeneratorTest < ActiveSupport::TestCase def setup stub_request(:head, "http://www.example.com/error").to_return(status: 200) load_custom_survey 'cert_generator.rb' @user = FactoryGirl.create :user end test "creating blank certificate" do load_c...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/response_test.rb
Ruby
mit
47
master
2,575
require_relative '../test_helper' class ResponseTest < ActiveSupport::TestCase def setup @question = FactoryGirl.create :question, reference_identifier: 'documentationMetadata' @answer_1 = FactoryGirl.create :answer @answer_2 = FactoryGirl.create :answer, reference_identifier: 'spatial', question: @q...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/generate_stats_test.rb
Ruby
mit
47
master
411
require_relative '../test_helper' class GenerateStatsTest < ActiveSupport::TestCase should "generate correct number of stats" do GenerateStats.perform assert_equal Stat.all.count, 2 end should "requeue job after run" do Timecop.freeze do Delayed::Job.expects(:enqueue).with(GenerateStats, { :...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/embed_stat_test.rb
Ruby
mit
47
master
3,230
require_relative '../test_helper' class EmbedStatTest < ActiveSupport::TestCase test "should create an embed stat with a valid URL" do e = EmbedStat.create(referer: "http://example.com/page") assert e.valid? assert_equal EmbedStat.all.count, 1 end test "extracts domain name from referer" do e ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/upload_usage_data_test.rb
Ruby
mit
47
master
4,039
require_relative '../test_helper' class UploadUsageDataTest < ActiveSupport::TestCase setup do @gdocs_path = ENV['GAPPS_CERTIFICATE_USAGE_COLLECTION'] assert @gdocs_path, "GAPPS_CERTIFICATE_USAGE_COLLECTION must be set to a path" end test "create_csvs creates a CSV file with correct stuff" do VCR.us...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/presenters/certificate_presenter_test.rb
Ruby
mit
47
master
2,500
require_relative '../../test_helper' class CertificatePresenterTest < ActiveSupport::TestCase def setup Certificate.destroy_all @certificate = FactoryGirl.create(:response_set_with_dataset).certificate @certificate.update_attributes(name: 'Banana certificate', curator: 'John Smith') @certificate.re...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/helpers/application_helper_test.rb
Ruby
mit
47
master
3,166
# encoding: utf-8 require_relative '../../test_helper' class ApplicationHelperTest < ActionView::TestCase test 'converts markdown' do source = '**hello** world' result = markdown(source) expected = "<p><strong>hello</strong> world</p>\n" assert_equal expected, result assert result.html_safe? ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/lib/translations_test.rb
Ruby
mit
47
master
490
require_relative '../../test_helper' require 'translations' class TranslationsTest < ActiveSupport::TestCase test "merge two yaml files" do run = false path = Rails.root + "fixtures/translations" Tempfile.open('output.yml') do |output| run = true Translations::Merge.merge(output.path, [path...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
test/unit/lib/ckan_factory_test.rb
Ruby
mit
47
master
8,019
require_relative '../../test_helper' class CKANFactoryTest < ActiveSupport::TestCase def setup @user = FactoryGirl.create :user, :admin => true @campaign = CertificationCampaign.create(name: "Test campaign", url: "http://data.gov.uk/api", jurisdiction: "blank") @campaign.update_attribute(:user_id, @user...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
surveys/development/date_survey.rb
Ruby
mit
47
master
414
# encoding: UTF-8 survey "Date Survey", :dataset_title => 'dataTitle', :dataset_curator => 'dataTitle' do section "Simple date questions" do q_dataTitle "What's a good title for this data?" a_1 'Data Title', :string q "What is your birth date?" a :date q "At what time were you born?" a :ti...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
surveys/development/odc_questionnaire.UK.rb
Ruby
mit
47
master
12,848
survey 'GB', :full_title => 'United Kingdom', :status => 'beta', :description => '<p>This self-assessment questionnaire generates an open data certificate and badge you can publish to tell people all about this open data. We also use your answers to learn how organisations publish open data.</p><p>When you answer...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
surveys/development/cert_generation.rb
Ruby
mit
47
master
2,485
survey 'Certificate Generator', :dataset_title => 'dataTitle', :dataset_curator => 'dataTitle', :description => 'This is a development survey to test out the generation of the certificates' do section 'General', :display_header => false do q_dataTitle 'What\'s a good title for this data?', ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
surveys/development/kitchen_sink_survey.rb
Ruby
mit
47
master
10,900
# encoding: UTF-8 survey "Kitchen Sink survey", :dataset_title => 'dataTitle', :dataset_curator => 'dataTitle' do section "Basic questions" do q_dataTitle "What's a good title for this data?" a_1 'Data Title', :string # A label is a question that accepts no answers label "These questions are exampl...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
surveys/development/level_test_questionnaire.rb
Ruby
mit
47
master
5,445
survey 'Level Test Questionnaire', :dataset_title => 'dataTitle', :dataset_curator => 'dataTitle' do section_general 'General Information', :display_header => false do q_dataTitle 'What\'s a good title for this data?', :help_text => 'This is a mandatory question, it will be included in the ...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
surveys/development/quiz.rb
Ruby
mit
47
master
536
# encoding: UTF-8 survey "Favorites", :dataset_title => 'dataTitle', :dataset_curator => 'dataTitle' do section "Foods" do q_dataTitle "What's a good title for this data?" a_1 'Data Title', :string # In a quiz, both the questions and the answers need to have reference identifiers # Here, the questio...
github
theodi/open-data-certificate
https://github.com/theodi/open-data-certificate
surveys/development/repeater_section.rb
Ruby
mit
47
master
869
# encoding: UTF-8 survey "repeater-section", full_title: 'Repeater Section', dataset_title: 'dataTitle', dataset_curator: 'dataTitle' do section_one "One", display_header: false do q_dataTitle "What's a good title for this data?" a_1 'Data Title', :string repeater 'Listing' do q_listing 'Where ...