enju_ndl 0.1.0.pre7 → 0.1.0.pre8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,4 +21,21 @@ describe NdlBooksController do
21
21
  assigns(:books).should be_empty
22
22
  end
23
23
  end
24
+
25
+ describe "POST create" do
26
+ login_fixture_admin
27
+ use_vcr_cassette "enju_ndl/search", :record => :new_episodes
28
+
29
+ it "should create a bibliographic record if nbn is set" do
30
+ post :create, :book => {:nbn => '97024234'}
31
+ assigns(:manifestation).nbn.should eq '97024234'
32
+ response.should redirect_to manifestation_items_url(assigns(:manifestation))
33
+ end
34
+
35
+ it "should not create a bibliographic record if nbn is not set" do
36
+ post :create, :book => {:nbn => nil}
37
+ assigns(:manifestation).should be_nil
38
+ response.should redirect_to ndl_books_url
39
+ end
40
+ end
24
41
  end
@@ -4,6 +4,7 @@ require 'rails/all'
4
4
 
5
5
  Bundler.require
6
6
  require "enju_ndl"
7
+ require "enju_question"
7
8
  require "enju_subject"
8
9
 
9
10
  module Dummy
Binary file
@@ -0,0 +1,12 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe Manifestation do
5
+ fixtures :all
6
+ use_vcr_cassette "enju_ndl/search", :record => :new_episodes
7
+
8
+ it "should imporrt a bibliographic record" do
9
+ manifestation = Manifestation.import_isbn('406258087X')
10
+ manifestation.should be_valid
11
+ end
12
+ end
@@ -11,7 +11,7 @@ describe NdlBook do
11
11
  context "search" do
12
12
  use_vcr_cassette "enju_ndl/search", :record => :new_episodes
13
13
  it "should search bibliographic record" do
14
- NdlBook.search('library system')[:total_entries].should eq 5185
14
+ NdlBook.search('library system')[:total_entries].should eq 5188
15
15
  end
16
16
 
17
17
  it "should not distinguish double byte space from one-byte space in a query" do
@@ -0,0 +1,11 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe Question do
5
+ fixtures :all
6
+ use_vcr_cassette "enju_ndl/crd", :record => :new_episodes
7
+
8
+ it "should respond to search_crd" do
9
+ Question.search_crd(:query_01 => 'library')
10
+ end
11
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'simplecov'
2
+ SimpleCov.start 'rails'
3
+
1
4
  # This file is copied to spec/ when you run 'rails generate rspec:install'
2
5
  ENV["RAILS_ENV"] ||= 'test'
3
6
  require File.expand_path("../dummy/config/environment", __FILE__)