HyakuninIssyu 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0203186a1ced637afb58f7b73592b3bd629c5f7
4
- data.tar.gz: 86aa0267d2063a56513da3dd59ef5779bae5a8c1
3
+ metadata.gz: 2214af5c58a42bb813be72ea9a34c02da9973dbb
4
+ data.tar.gz: cad44c16e6f338ac192b14ac75cec43016e62855
5
5
  SHA512:
6
- metadata.gz: be342dd00e9e00bbe61bfc3e4816f77c135720a2366bf685dd6fbbc51ad4c5b09f49d22bda63d89c41ba5fcc659c3058f32fe7b475c7126b5659bf78e5f85820
7
- data.tar.gz: 6b9802364d9ca8bf3877f187ee18d59aa4ddc5dd48ebe6ddedfa4c01209da1f401031d826a09efdb40fa4125fb5b396d41e3bc1b895cec200265008ea5383a21
6
+ metadata.gz: 8a9d25c01f007619c7a6524b066ba727ac16335f04ae9543f269e53f323612d8a4b2517a0075b262fa31d587599fd9c05e25f379b84ea1b0369001f6ee2b1a84
7
+ data.tar.gz: 044eb98a584fad6cb3a85f5347209c5a9608704243c59869ddc92832b86821bbbbe7972619d3d9e3806041f8ab93496b56ad26707a08cb4e95f2650bc3ce7a9e
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
23
24
  end
data/README.md CHANGED
@@ -43,7 +43,7 @@ To retrieve the poem info,
43
43
 
44
44
  data.poem.comment #=> "「朝ぼらけ」は夜明けであたりがほのぼのと明るくなってくる頃..."
45
45
 
46
- data.poem.list #=> ["秋の田の かりほの庵の 苫をあらみ わが衣手は 露にぬれつつ", "春過ぎて..."]
46
+ data.poem.list #=> ["秋の田の かりほの庵の 苫をあらみ わが衣手は 露にぬれつつ", "春過ぎて..."]
47
47
 
48
48
  "list" method returns all the poem data in array.
49
49
 
@@ -53,7 +53,7 @@ To retrieve the poet info for the same poem,
53
53
  data.poet.name #=> "権中納言定頼"
54
54
  data.poet.period #=> "995-1045"
55
55
  data.poet.info #=> "本名は藤原定頼(ふじわらの さだより)。平安時代中期の公家・歌人..."
56
- data.poet.list #=> ["天智天皇", "持統天皇", "柿本人麻呂", ... "]
56
+ data.poet.list #=> ["天智天皇", "持統天皇", "柿本人麻呂", ... "]
57
57
 
58
58
  "list" method returns all the poet names in array.
59
59
 
@@ -1,3 +1,3 @@
1
1
  class HyakuninIssyu
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -0,0 +1,64 @@
1
+ require "HyakuninIssyu"
2
+
3
+ describe HyakuninIssyu do
4
+ describe 'show the particular poem when the id is specified' do
5
+ before do
6
+ @id = rand(100)+1
7
+ @test_poem = HyakuninIssyu.new(@id)
8
+
9
+ @poems = YAML.load_file(File.expand_path(File.join('..', '..', 'lib', 'data', 'poems.yml'), __FILE__))
10
+ @poets = YAML.load_file(File.expand_path(File.join('..', '..', 'lib', 'data', 'poets.yml'), __FILE__))
11
+ end
12
+
13
+ it "should return poem" do
14
+ @test_poem.poem.kanji.should_not be_nil
15
+ end
16
+
17
+ it "should return poet" do
18
+ @test_poem.poet.name.should_not be_nil
19
+ end
20
+
21
+ it "should return correct poem" do
22
+ correct_poem = @poems[@id-1]["poem"]
23
+ @test_poem.poem.kanji.should eq(correct_poem)
24
+ end
25
+
26
+ it "should return correct poet" do
27
+ correct_poet = @poets[@id-1]["name"]
28
+ @test_poem.poet.name.should eq(correct_poet)
29
+ end
30
+
31
+ it "should return first half of poem" do
32
+ first = @test_poem.poem.first.kanji
33
+ first.should_not be_nil
34
+ end
35
+
36
+ it "should return last half of poem" do
37
+ last = @test_poem.poem.last.kanji
38
+ last.should_not be_nil
39
+ end
40
+
41
+ it "should return kana without first/last option" do
42
+ kana = @test_poem.poem.kana
43
+ kana.should_not be_nil
44
+ end
45
+ end
46
+
47
+ describe 'create the instance without poem_id' do
48
+ before do
49
+ @test_poem = HyakuninIssyu.new
50
+ end
51
+
52
+ it "should return poem[0]" do
53
+ @test_poem.poem.kanji.should eq('秋の田の かりほの庵の 苫をあらみ わが衣手は 露にぬれつつ')
54
+ end
55
+
56
+ it "should return the list of all poems" do
57
+ @test_poem.poem.list.size.should eq(100)
58
+ end
59
+
60
+ it "should return the list of all poets" do
61
+ @test_poem.poet.list.size.should eq(100)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,5 @@
1
+ require "rubygems"
2
+
3
+ RSpec.configure do |config|
4
+ config.mock_framework = :rspec
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HyakuninIssyu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - tomomichi
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: This Gem offer all the information about Hyakunin-issyu, the One Hundred
42
56
  Poems by One Hundred Poets.
43
57
  email:
@@ -56,6 +70,8 @@ files:
56
70
  - lib/HyakuninIssyu/version.rb
57
71
  - lib/data/poems.yml
58
72
  - lib/data/poets.yml
73
+ - spec/hyakuninissyu_spec.rb
74
+ - spec/spec_helper.rb
59
75
  homepage: https://github.com/Tomomichi/HyakuninIssyu
60
76
  licenses:
61
77
  - MIT
@@ -81,4 +97,6 @@ signing_key:
81
97
  specification_version: 4
82
98
  summary: This Gem offer all the information about Hyakunin-issyu, the One Hundred
83
99
  Poems by One Hundred Poets.
84
- test_files: []
100
+ test_files:
101
+ - spec/hyakuninissyu_spec.rb
102
+ - spec/spec_helper.rb