changeset 424:b601a9e472f3 feature_36

Fixed minor bugs with the publications controller Started creating tests and fixtures.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 25 May 2011 17:46:49 +0100
parents 50474139cad4
children 4ecbc22579e2
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/views/publications/index.html.erb vendor/plugins/redmine_bibliography/test/fixtures/authors.yml vendor/plugins/redmine_bibliography/test/fixtures/authorships.yml vendor/plugins/redmine_bibliography/test/fixtures/bibtex_entries.yml vendor/plugins/redmine_bibliography/test/fixtures/publications.yml vendor/plugins/redmine_bibliography/test/test_helper.rb
diffstat 7 files changed, 69 insertions(+), 70 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Fri Apr 15 19:02:51 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Wed May 25 17:46:49 2011 +0100
@@ -22,8 +22,10 @@
     bibtex_entry = params[:bibtex_entry]
 
     # method for creating "pasted" bibtex entries
-    if bibtex_entry      
+    if bibtex_entry
+      logger.error "ANTES PARSE"      
       parse_bibtex_list bibtex_entry    
+      logger.error "DEPOIS PARSE"
     end
 
     # form's flow control
@@ -110,7 +112,8 @@
     @publication.bibtex_entry = @bentry
     @publication.save
 
-    @created_publications << @publication.id
+    # what is this for??? 
+    # @created_publications << @publication.id
 
     # need to save all authors
     #   and establish the author-publication association 
--- a/vendor/plugins/redmine_bibliography/app/views/publications/index.html.erb	Fri Apr 15 19:02:51 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/index.html.erb	Wed May 25 17:46:49 2011 +0100
@@ -1,7 +1,16 @@
 <h2>Publications#index</h2>
 
+
+<table>
+  <tr>
+    <th>Number</th>
+    <th>Title</th> 
+  </tr>
+
 <% @publications.each do |publication| %>
-	
-	<p><%= publication.id %>: <%=publication.title %></p>
+	<tr>
+	  <td><%= publication.id %></td>
+	  <td><%= publication.title %></td>
+	 	</tr>
 	
 <% end %>
\ No newline at end of file
--- a/vendor/plugins/redmine_bibliography/test/fixtures/authors.yml	Fri Apr 15 19:02:51 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/test/fixtures/authors.yml	Wed May 25 17:46:49 2011 +0100
@@ -1,11 +1,17 @@
 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
 one:
   id: 1
-  user_id: 1
-  firstname: MyString
-  lastname: MyString
+  user_id: 
+  name: MyString
 two:
   id: 2
-  user_id: 1
-  firstname: MyString
-  lastname: MyString
+  user_id: 
+  name: MyString
+one:
+  id: 3
+  user_id: 
+  name: MyString
+two:
+  id: 4
+  user_id: 
+  name: MyString
--- a/vendor/plugins/redmine_bibliography/test/fixtures/authorships.yml	Fri Apr 15 19:02:51 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/test/fixtures/authorships.yml	Wed May 25 17:46:49 2011 +0100
@@ -1,17 +1,33 @@
 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
 one:
   id: 1
-  author_id: 
-  publication_id: 
-  name_on_paper: 
-  order: 
+  author_id: 1
+  publication_id: 1
+  name_on_paper: Yih-Farn R. Chen
+  order: 1
   institution: 
   email: MyString
 two:
   id: 2
-  author_id: 
-  publication_id: 
-  name_on_paper: 
-  order: 
+  author_id: 2
+  publication_id: 1
+  name_on_paper: Glenn S. Fowler
+  order: 2
   institution: 
   email: MyString
+three:
+  id: 3
+  author_id: 1
+  publication_id: 1
+  name_on_paper: Yih-Farn R. Chen
+  order: 1
+  institution: 
+  email: MyString
+four:
+  id: 4
+  author_id: 2
+  publication_id: 1
+  name_on_paper: Glenn S. Fowler
+  order: 2
+  institution: 
+  email: MyString
--- a/vendor/plugins/redmine_bibliography/test/fixtures/bibtex_entries.yml	Fri Apr 15 19:02:51 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/test/fixtures/bibtex_entries.yml	Wed May 25 17:46:49 2011 +0100
@@ -1,53 +1,6 @@
 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
 one:
   id: 1
-  entry_type: 
-  address: 
-  annote: 
-  booktitle: 
-  chapter: 
-  crossref: 
-  edition: 
-  editor: 
-  eprint: 
-  howpublished: 
-  journal: 
-  key: 
-  month: 
-  note: 
-  number: 
-  organization: 
-  pages: 
-  publisher: 
-  school: 
-  series: 
-  type: 
-  url: 
-  volume: 
-  year: 1
-two:
-  id: 2
-  entry_type: 
-  address: 
-  annote: 
-  booktitle: 
-  chapter: 
-  crossref: 
-  edition: 
-  editor: 
-  eprint: 
-  howpublished: 
-  journal: 
-  key: 
-  month: 
-  note: 
-  number: 
-  organization: 
-  pages: 
-  publisher: 
-  school: 
-  series: 
-  type: 
-  url: 
-  volume: 
-  year: 1
+  entry_type: InProceedings
+  booktitle: International Conference on Software Maintenance
+  year: 1995
--- a/vendor/plugins/redmine_bibliography/test/fixtures/publications.yml	Fri Apr 15 19:02:51 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/test/fixtures/publications.yml	Wed May 25 17:46:49 2011 +0100
@@ -1,8 +1,8 @@
 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
 one:
   id: 1
-  title: MyString
-  bibtex_entry_id: MyString
+  title: Test Fixture Title No1
+  bibtex_entry_id: 1
 two:
   id: 2
   title: MyString
--- a/vendor/plugins/redmine_bibliography/test/test_helper.rb	Fri Apr 15 19:02:51 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/test/test_helper.rb	Wed May 25 17:46:49 2011 +0100
@@ -1,5 +1,17 @@
 # Load the normal Rails helper
 require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper')
+require 'publications_controller'
 
 # Ensure that we are using the temporary fixture path
 Engines::Testing.set_fixture_path
+
+class PublicationsControllerTest < ActionController::TestCase
+  fixtures :publications, :authors, :bibtex_entries, :authorships
+
+  def setup
+  end
+
+  def test_routing
+    assert_routing(
+        )
+  end