From 645f25d44667494dfa9ab6afdfb9dfe3ced5af25 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Thu, 22 Nov 2012 16:34:20 +0800 Subject: [PATCH] make fake data --- Gemfile | 3 ++- .../javascripts/desktop/journal_pages.js.erb | 1 + config/mongoid.yml | 2 +- db/seeds.rb | 19 +++++++++++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 30dd9e67..c893a899 100644 --- a/Gemfile +++ b/Gemfile @@ -76,7 +76,8 @@ group :test, :development do gem 'pry-remote' gem 'pry-stack_explorer' gem 'pry-debugger' - + gem 'faker' + gem "sunspot-rails-tester" gem 'spork' gem 'database_cleaner' #Strategies for cleaning databases. Can be used to ensure a clean state for testing. diff --git a/app/assets/javascripts/desktop/journal_pages.js.erb b/app/assets/javascripts/desktop/journal_pages.js.erb index 139f94fc..2c6821da 100644 --- a/app/assets/javascripts/desktop/journal_pages.js.erb +++ b/app/assets/javascripts/desktop/journal_pages.js.erb @@ -1,5 +1,6 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ // this init journal papers this.initializeJournalPapers.formCallback = function(data){ + if(data.success){ o.notify(data.msg,"success"); o.sub_menu_item($("div[content-type=menu] a").eq(0)); }else{ diff --git a/config/mongoid.yml b/config/mongoid.yml index 75c5ef80..a809bc06 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -2,7 +2,7 @@ defaults: &defaults host: localhost # slaves: # - host: slave1.local - port: 37017 + port: 27017 # - host: slave2.local # port: 27019 diff --git a/db/seeds.rb b/db/seeds.rb index b53fb7b7..1a909bed 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -32,3 +32,22 @@ end FactoryGirl.create(:custom_record, journal_title_translations: {zh_tw: "tw_test A", en: "en_test A"}) FactoryGirl.create(:custom_record, journal_title_translations: {zh_tw: "tw_test B", en: "en_test B"}) +abstract_file = "./icml2011_abstract" +abstracts = File.open(file).readlines + +bibtex_file = "./icml2011.bibtex" +bibtex = File.open(file).readlines + + +FactoryGirl.define do + factory :paper_record, class: "WritingJournal" do |f| + f.sequence(:paper_title_translations) {|n|{zh_tw: "[tw]_test #{n}", en: "en_test #{n}" }} + f.sequence(:journal_title_translations) {|n| {zh_tw: "tw_test #{n}", en: "en_test #{n}"}} + f.sequence(:keywords) {|n| "keywords #{n}"} + f.sequence(:abstract) {|n| "abstract #{n}"} + f.sequence(:isbn) {|n| "0714312#{n}#{n}#{n}"} + f.sequence(:year) {|n| "201#{n}"} + f.create_user_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account + f.update_user_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account + end +end