Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
1,683 additions
and
47 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--color | ||
--require spec_helper |
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 +1 @@ | ||
jruby-1.7.16.1 | ||
jruby-9.1.7.0 |
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,6 +1,2 @@ | ||
rvm: | ||
- jruby-19mode | ||
before_script: | ||
- mkdir -p test/dummy/db | ||
- touch test/dummy/db/test.sqlite3 | ||
- rake db:migrate | ||
- jruby-9.1.7.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
machine: | ||
ruby: | ||
version: | ||
jruby-9.1.7.0 | ||
java: | ||
version: | ||
openjdk7 | ||
environment: | ||
JRUBY_OPTS: '--dev' | ||
dependencies: | ||
pre: | ||
- bundle config github.https true | ||
test: | ||
override: | ||
- bundle exec rake: | ||
parallel: true | ||
pwd: app |
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
124 changes: 124 additions & 0 deletions
124
spec/controllers/ex_cite/export_citations_controller_spec.rb
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,124 @@ | ||
require 'rails_helper' | ||
|
||
describe ExCite::ExportCitationsController, type: :controller do | ||
routes { ExCite::Engine.routes } | ||
|
||
describe "GET index" do | ||
subject{ response } | ||
let(:csf_data){ "itemType: book" } | ||
let(:ris_data){ "TY - BOOK\nER -\n\n" } | ||
let(:openurl_data){ "https://getit.library.nyu.edu/resolve?rft_val_fmt=info:ofi/fmt:kev:mtx:book" } | ||
let(:bibtex_data){ "@book{????\n}" } | ||
let(:pnx_data){ "<display><type>book</type></display>" } | ||
let(:refworks_tagged_data){ "RT Book, whole\nER \n \n" } | ||
|
||
context "using data" do | ||
context "with from_format" do | ||
before { get :index, to_format: to_format, from_format: from_format, data: data } | ||
|
||
context "valid data" do | ||
let(:data){ public_send(:"#{from_format}_data") } | ||
|
||
include_examples "book success for all from_format and to_format" | ||
end | ||
|
||
context "invalid data" do | ||
let(:data){ "$%^$* some nonsense !@#$%^&*}" } | ||
|
||
pending | ||
# include_examples "bad_request for all from_format and to_format" | ||
end | ||
end # end with from_format | ||
end # end using data | ||
|
||
context "using id" do | ||
before { get :index, to_format: to_format, id: id } | ||
|
||
context "valid id" do | ||
around do |example| | ||
old_acts_as_citable_class = ExCite.acts_as_citable_class | ||
ExCite.acts_as_citable_class = DummyPersistentCitation | ||
example.run | ||
ExCite.acts_as_citable_class = old_acts_as_citable_class | ||
end | ||
let(:citation){ DummyPersistentCitation.create(data: data, format: from_format) } | ||
let(:id){ citation.id } | ||
|
||
context "with valid data" do | ||
let(:data){ public_send(:"#{from_format}_data") } | ||
|
||
include_examples "book success for all from_format and to_format" | ||
end | ||
|
||
context "with invalid data" do | ||
let(:data){ "%^&%^&cbdsds" } | ||
|
||
pending | ||
# include_examples "bad_request for all from_format and to_format" | ||
end | ||
end # end valid id | ||
|
||
context "invalid id" do | ||
let(:id) { "error" } | ||
|
||
include_examples "bad_request for all from_format and to_format" | ||
end # end invalid id | ||
end # end using id | ||
|
||
context "using resource_key" do | ||
let(:resource_key){ "abcd" } | ||
let(:converted_to_format) do | ||
return "refworks_tagged" if to_format == "refworks" | ||
return "easybib" if to_format == "easybibpush" | ||
to_format | ||
end | ||
|
||
context "valid resource_key" do | ||
context "for single resource" do | ||
let(:nested_resource_key){ "wxyz" } | ||
let(:nested_resource_cache_key){ nested_resource_key + "to_" + converted_to_format } | ||
before do | ||
allow(Rails.cache).to receive(:fetch).once.with(resource_key).and_return(nested_resource_key) | ||
allow(Rails.cache).to receive(:fetch).once.with(nested_resource_cache_key).and_return(cached_data_converted) if defined?(cached_data_converted) | ||
end | ||
before { get :index, to_format: to_format, resource_key: resource_key } | ||
|
||
include_examples "resource_key-stubbed success for all from_format and to_format" | ||
end # end for single resource | ||
|
||
context "for collection of resources" do | ||
let(:nested_resource_keys){ [nested_resource_key1, nested_resource_key2, nested_resource_key3] } | ||
let(:nested_resource_key1){ "1234" } | ||
let(:nested_resource_key2){ "5678" } | ||
let(:nested_resource_key3){ "wxyz" } | ||
let(:nested_resource_cache_key1){ nested_resource_key1 + "to_" + converted_to_format } | ||
let(:nested_resource_cache_key2){ nested_resource_key2 + "to_" + converted_to_format } | ||
let(:nested_resource_cache_key3){ nested_resource_key3 + "to_" + converted_to_format } | ||
before do | ||
allow(Rails.cache).to receive(:fetch).once.with(resource_key).and_return(nested_resource_keys) | ||
allow(Rails.cache).to receive(:fetch).once.with(nested_resource_cache_key1).and_return(cached_data_converted) if defined?(cached_data_converted) | ||
allow(Rails.cache).to receive(:fetch).once.with(nested_resource_cache_key2).and_return(cached_data_converted) if defined?(cached_data_converted) | ||
allow(Rails.cache).to receive(:fetch).once.with(nested_resource_cache_key3).and_return(cached_data_converted) if defined?(cached_data_converted) | ||
end | ||
before { get :index, to_format: to_format, resource_key: resource_key } | ||
|
||
include_examples "resource_key-stubbed success for all from_format and to_format" | ||
end | ||
end # end valid resource_key | ||
|
||
context "invalid resource_key" do | ||
before { allow(Rails.cache).to receive(:fetch).once.with(resource_key).and_return(nil) } | ||
before { get :index, to_format: to_format, resource_key: resource_key } | ||
|
||
include_examples "bad_request for all from_format and to_format" | ||
end # end invalid resource_key | ||
end | ||
|
||
context "using openurl" do | ||
before { get :index, to_format: to_format, rft_val_fmt: "info:ofi/fmt:kev:mtx:book" } | ||
let(:data){ "http://test.host" + URI.decode(request.fullpath) } | ||
|
||
include_examples "book success for all to_format", "openurl" | ||
end | ||
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,28 @@ | ||
== README | ||
|
||
This README would normally document whatever steps are necessary to get the | ||
application up and running. | ||
|
||
Things you may want to cover: | ||
|
||
* Ruby version | ||
|
||
* System dependencies | ||
|
||
* Configuration | ||
|
||
* Database creation | ||
|
||
* Database initialization | ||
|
||
* How to run the test suite | ||
|
||
* Services (job queues, cache servers, search engines, etc.) | ||
|
||
* Deployment instructions | ||
|
||
* ... | ||
|
||
|
||
Please feel free to use a different markup language if you do not plan to run | ||
<tt>rake doc:app</tt>. |
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,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__) | ||
|
||
Rails.application.load_tasks |
Empty file.
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,13 @@ | ||
// This is a manifest file that'll be compiled into application.js, which will include all the files | ||
// listed below. | ||
// | ||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, | ||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. | ||
// | ||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | ||
// compiled file. | ||
// | ||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details | ||
// about supported directives. | ||
// | ||
//= require_tree . |
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,15 @@ | ||
/* | ||
* This is a manifest file that'll be compiled into application.css, which will include all the files | ||
* listed below. | ||
* | ||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, | ||
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. | ||
* | ||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the | ||
* compiled file so the styles you add here take precedence over styles defined in any styles | ||
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new | ||
* file per style scope. | ||
* | ||
*= require_tree . | ||
*= require_self | ||
*/ |
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 @@ | ||
class ApplicationController < ActionController::Base | ||
# Prevent CSRF attacks by raising an exception. | ||
# For APIs, you may want to use :null_session instead. | ||
protect_from_forgery with: :exception | ||
end |
Empty file.
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,2 @@ | ||
module ApplicationHelper | ||
end |
Empty file.
Empty file.
Empty file.
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,3 @@ | ||
class DummyPersistentCitation < ActiveRecord::Base | ||
acts_as_citable | ||
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,2 @@ | ||
class EmptyModel < ActiveRecord::Base | ||
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,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Dummy</title> | ||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> | ||
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> | ||
<%= csrf_meta_tags %> | ||
</head> | ||
<body> | ||
|
||
<%= yield %> | ||
|
||
</body> | ||
</html> |
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,3 @@ | ||
#!/usr/bin/env ruby | ||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) | ||
load Gem.bin_path('bundler', 'bundle') |
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,4 @@ | ||
#!/usr/bin/env ruby | ||
APP_PATH = File.expand_path('../../config/application', __FILE__) | ||
require_relative '../config/boot' | ||
require 'rails/commands' |
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,4 @@ | ||
#!/usr/bin/env ruby | ||
require_relative '../config/boot' | ||
require 'rake' | ||
Rake.application.run |
Oops, something went wrong.