sermonaudio 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rubocop.yml +15 -0
- data/.travis.yml +11 -0
- data/Gemfile +24 -0
- data/Gemfile.lock +127 -0
- data/README.md +258 -0
- data/Rakefile +13 -0
- data/lib/sermonaudio/actions.rb +99 -0
- data/lib/sermonaudio/client.rb +13 -0
- data/lib/sermonaudio/configuration.rb +37 -0
- data/lib/sermonaudio/version.rb +5 -0
- data/lib/sermonaudio.rb +13 -0
- data/sermonaudio.gemspec +22 -0
- data/spec/actions_spec.rb +236 -0
- data/spec/cassettes/SermonAudio_Actions/_favorite_broadcasters/should_return_the_correct_result.yml +508 -0
- data/spec/cassettes/SermonAudio_Actions/_favorite_sermons/should_return_the_correct_result.yml +509 -0
- data/spec/cassettes/SermonAudio_Actions/_favorite_speakers/should_return_the_correct_result.yml +508 -0
- data/spec/cassettes/SermonAudio_Actions/_get_event_types/should_return_a_larger_set_of_results.yml +521 -0
- data/spec/cassettes/SermonAudio_Actions/_get_event_types/should_return_a_single_result.yml +508 -0
- data/spec/cassettes/SermonAudio_Actions/_get_event_types/should_return_the_correct_results.yml +513 -0
- data/spec/cassettes/SermonAudio_Actions/_get_languages/should_return_the_correct_results.yml +506 -0
- data/spec/cassettes/SermonAudio_Actions/_get_newest_series_by_member_id/should_return_the_correct_results.yml +508 -0
- data/spec/cassettes/SermonAudio_Actions/_get_series_by_member_id/should_return_the_correct_results.yml +508 -0
- data/spec/cassettes/SermonAudio_Actions/_get_sermon_info/should_return_the_correct_result.yml +513 -0
- data/spec/cassettes/SermonAudio_Actions/_get_speakers_by_keyword/should_return_a_larger_set_of_results.yml +521 -0
- data/spec/cassettes/SermonAudio_Actions/_get_speakers_by_keyword/should_return_a_single_result.yml +508 -0
- data/spec/cassettes/SermonAudio_Actions/_get_speakers_by_member_id/should_return_the_correct_results.yml +508 -0
- data/spec/cassettes/SermonAudio_Actions/_newest_sermons_by_member_id/should_return_the_correct_results.yml +598 -0
- data/spec/cassettes/SermonAudio_Actions/_newest_sermons_by_speaker/should_return_the_correct_results.yml +599 -0
- data/spec/cassettes/SermonAudio_Actions/_sermon_list/should_return_a_list_of_sermons_for_the_specified_church.yml +1189 -0
- data/spec/cassettes/SermonAudio_Sermon/_find_newest_/success/should_find_newest_sermons_by_SpeakerName.yml +599 -0
- data/spec/client_spec.rb +15 -0
- data/spec/configuration_spec.rb +43 -0
- data/spec/fixtures/submit_sermon.xml +8 -0
- data/spec/fixtures/update_sermon.xml +6 -0
- data/spec/fixtures/wsdl.xml +740 -0
- data/spec/spec_helper.rb +46 -0
- metadata +134 -0
@@ -0,0 +1,236 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'savon/mock/spec_helper'
|
3
|
+
|
4
|
+
module SermonAudio
|
5
|
+
describe Actions do
|
6
|
+
include Savon::SpecHelper
|
7
|
+
|
8
|
+
subject(:action) { Class.new.extend(Actions) }
|
9
|
+
|
10
|
+
CURRENT_SA_LANGS = %w[
|
11
|
+
Afrikaans Arabic Burundi Catalan Chinese
|
12
|
+
Choctaw Czech Danish Dutch Finnish
|
13
|
+
French German Greek Haitian-Creole Hebrew
|
14
|
+
Hindi Hungarian Indonesian Italian Japanese
|
15
|
+
Khmer Korean Mongolian Persian Portuguese
|
16
|
+
Punjabi Romanian Russian Scots-Gaelic Sign-ASL
|
17
|
+
Sign-Mexico Spanish Tagalog Tamil Telugu
|
18
|
+
Ukrainian Urdu Vietnamese Zulu
|
19
|
+
]
|
20
|
+
|
21
|
+
describe 'stubbed expectations' do
|
22
|
+
|
23
|
+
before(:all) { savon.mock! }
|
24
|
+
after(:all) { savon.unmock! }
|
25
|
+
|
26
|
+
before do
|
27
|
+
allow(SermonAudio).to receive(:client) do
|
28
|
+
Savon.client {
|
29
|
+
wsdl 'spec/fixtures/wsdl.xml'
|
30
|
+
soap_version 2
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#submit_sermon' do
|
36
|
+
it "should send the correct message and return the expected results" do
|
37
|
+
info = {
|
38
|
+
'MemberID' => 'cbcelgin',
|
39
|
+
'Password' => 'password',
|
40
|
+
'Title' => 'Example Sermon',
|
41
|
+
'ShortTitle' => 'Even Shorter',
|
42
|
+
'SubTitle' => 'Series Name',
|
43
|
+
'EventType' => 'Sunday Service',
|
44
|
+
'DatePreached' => DateTime.new(2014, 7, 24),
|
45
|
+
'Speaker' => 'Mitchell Jones',
|
46
|
+
'BibleText' => '1 Peter 2:21-25',
|
47
|
+
'Language' => 'English',
|
48
|
+
'Keywords' => 'bible jesus gospel',
|
49
|
+
'MoreInfoText' => 'This is more info about the sermon'
|
50
|
+
}
|
51
|
+
|
52
|
+
fixture = File.read('spec/fixtures/submit_sermon.xml')
|
53
|
+
savon.expects(:submit_sermon).with(message: info).returns fixture
|
54
|
+
|
55
|
+
result = action.submit_sermon(info)
|
56
|
+
expect(result).to eq "Response Value"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#update_sermon' do
|
61
|
+
it "should send the correct message and return the expected results" do
|
62
|
+
info = {
|
63
|
+
'MemberID' => 'cbcelgin',
|
64
|
+
'Password' => 'password',
|
65
|
+
'SermonID' => '9827374839872',
|
66
|
+
'Title' => 'Example Sermon',
|
67
|
+
'ShortTitle' => 'Even Shorter',
|
68
|
+
'SubTitle' => 'Series Name',
|
69
|
+
'EventType' => 'Sunday Service',
|
70
|
+
'DatePreached' => DateTime.new(2014, 7, 24),
|
71
|
+
'Speaker' => 'Mitchell Jones',
|
72
|
+
'BibleText' => '1 Peter 2:21-25',
|
73
|
+
'Language' => 'English',
|
74
|
+
'Keywords' => 'bible jesus gospel',
|
75
|
+
'MoreInfoText' => 'This is more info about the sermon'
|
76
|
+
}
|
77
|
+
|
78
|
+
fixture = File.read('spec/fixtures/update_sermon.xml')
|
79
|
+
savon.expects(:update_sermon).with(message: info).returns fixture
|
80
|
+
|
81
|
+
result = action.update_sermon(info)
|
82
|
+
expect(result).to eq nil
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
describe '#sermon_list' do
|
89
|
+
it "should return a list of sermons for the specified church", vcr: true do
|
90
|
+
result = action.sermon_list(:cbcelgin)
|
91
|
+
expect(result.last[:sermon_id]).to eq "515111348415"
|
92
|
+
expect(result.last[:title]).to eq "A Faith To Die With"
|
93
|
+
expect(result.last[:sub_title]).to be_nil
|
94
|
+
expect(result.last[:speaker]).to eq "Mitchell Jones"
|
95
|
+
expect(result.last[:event_type]).to eq "Sunday - AM"
|
96
|
+
expect(result.last[:bible_text]).to eq "Hebrews"
|
97
|
+
expect(result.last[:download_count]).to eq "62"
|
98
|
+
expect(result.last[:mp3_duration]).to eq "64 minutes"
|
99
|
+
expect(result.last[:mp3_filename]).to eq "http://mp3.sa-media.com/filearea/515111348415/515111348415.mp3"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe '#get_sermon_info' do
|
104
|
+
it "should return the correct result", vcr: true do
|
105
|
+
result = action.get_sermon_info(720141933368)
|
106
|
+
expect(result[:sermon_id]).to eq "720141933368"
|
107
|
+
expect(result[:speaker]).to eq "Mitchell Jones"
|
108
|
+
expect(result[:bible_text]).to eq "Psalm 23:4"
|
109
|
+
expect(result[:sub_title]).to eq "Psalm 23"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe '#favorite_sermons' do
|
114
|
+
it "should return the correct result", vcr: true do
|
115
|
+
result = action.favorite_sermons
|
116
|
+
expect(result[0][:sermon_id]).to eq "7101111626"
|
117
|
+
expect(result[0][:title]).to eq "This Is My Comfort"
|
118
|
+
expect(result[0][:sub_title]).to eq nil
|
119
|
+
expect(result[0][:speaker]).to eq "Mitchell Jones"
|
120
|
+
expect(result[0][:event_type]).to eq "Sunday Service"
|
121
|
+
expect(result[0][:bible_text]).to eq nil
|
122
|
+
expect(result[0][:download_count]).to eq "0"
|
123
|
+
expect(result[0][:mp3_duration]).to eq nil
|
124
|
+
expect(result[0][:mp3_filename]).to eq nil
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '#favorite_speakers' do
|
129
|
+
it "should return the correct result", vcr: true do
|
130
|
+
result = action.favorite_speakers
|
131
|
+
expect(result[0]).to eq({speaker_name: "Pastor Tim Goad", sort_name: "Goad, Tim", counter: "470"})
|
132
|
+
expect(result[1]).to eq({speaker_name: "Mitchell Jones", sort_name: "Jones, Mitchell", counter: "216"})
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
describe '#favorite_broadcasters' do
|
137
|
+
it "should return the correct result", vcr: true do
|
138
|
+
result = action.favorite_broadcasters
|
139
|
+
expect(result[0][:source_id]).to eq "cbcelgin"
|
140
|
+
expect(result[0][:source_desc]).to eq "Cornerstone Baptist Church"
|
141
|
+
expect(result[0][:source_location]).to eq "Elgin, Texas"
|
142
|
+
expect(result[0][:minister]).to eq "Pastor Mitchell Jones"
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
describe '#get_speakers_by_member_id' do
|
147
|
+
it "should return the correct results", vcr: true do
|
148
|
+
result = action.get_speakers_by_member_id(:cbcelgin)
|
149
|
+
expect(result).to include "Mitchell Jones"
|
150
|
+
expect(result).to include "Kevin Bridges"
|
151
|
+
expect(result).to include "Pastor Tim Goad"
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
describe '#get_series_by_member_id' do
|
156
|
+
it "should return the correct results", vcr: true do
|
157
|
+
result = action.get_series_by_member_id(:cbcelgin)
|
158
|
+
expect(result).to eq [
|
159
|
+
"1 Corinthians 13", "1 Peter", "Psalm 23",
|
160
|
+
"The Beatitudes", "The Nature Of Repentance"
|
161
|
+
]
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe '#get_newest_series_by_member_id' do
|
166
|
+
it "should return the correct results", vcr: true do
|
167
|
+
result = action.get_newest_series_by_member_id(:cbcelgin)
|
168
|
+
expect(result[0]).to eq "Psalm 23"
|
169
|
+
expect(result[1]).to eq "1 Peter"
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
describe '#newest_sermons_by_member_id' do
|
174
|
+
it "should return the correct results", vcr: true do
|
175
|
+
result = action.newest_sermons_by_member_id(:cbcelgin)
|
176
|
+
expect(result[0][:sermon_id]).to eq "720141933368"
|
177
|
+
expect(result[0][:title]).to eq "Facing Death"
|
178
|
+
expect(result[0][:sub_title]).to eq "Psalm 23"
|
179
|
+
expect(result[0][:speaker]).to eq "Mitchell Jones"
|
180
|
+
expect(result[0][:event_type]).to eq "Sunday - PM"
|
181
|
+
expect(result[0][:bible_text]).to eq "Psalm 23:4"
|
182
|
+
expect(result[0][:download_count]).to eq "9"
|
183
|
+
expect(result[0][:mp3_duration]).to eq "39 minutes"
|
184
|
+
expect(result[0][:mp3_filename]).to eq "http://mp3.sa-media.com/filearea/720141933368/720141933368.mp3"
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
describe '#newest_sermons_by_speaker' do
|
189
|
+
it "should return the correct results", vcr: true do
|
190
|
+
result = action.newest_sermons_by_speaker("Mitchell Jones")
|
191
|
+
expect(result[0][:sermon_id]).to eq "720141933368"
|
192
|
+
expect(result[0][:title]).to eq "Facing Death"
|
193
|
+
expect(result[0][:sub_title]).to eq "Psalm 23"
|
194
|
+
expect(result[0][:speaker]).to eq "Mitchell Jones"
|
195
|
+
expect(result[0][:event_type]).to eq "Sunday - PM"
|
196
|
+
expect(result[0][:bible_text]).to eq "Psalm 23:4"
|
197
|
+
expect(result[0][:download_count]).to eq "9"
|
198
|
+
expect(result[0][:mp3_duration]).to eq "39 minutes"
|
199
|
+
expect(result[0][:mp3_filename]).to eq "http://mp3.sa-media.com/filearea/720141933368/720141933368.mp3"
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
describe '#get_event_types' do
|
204
|
+
it "should return the correct results", vcr: true do
|
205
|
+
result = action.get_event_types
|
206
|
+
expect(result).to include "Audio Book"
|
207
|
+
expect(result).to include "Bible Study"
|
208
|
+
expect(result).to include "Camp Meeting"
|
209
|
+
expect(result).to include "Sunday - PM"
|
210
|
+
expect(result).to include "Youth"
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
describe '#get_languages' do
|
215
|
+
it "should return the correct results", vcr: true do
|
216
|
+
result = action.get_languages
|
217
|
+
expect(result.sort).to eq CURRENT_SA_LANGS.sort
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
describe '#get_speakers_by_keyword' do
|
222
|
+
it "should return a larger set of results", vcr: true do
|
223
|
+
result = action.get_speakers_by_keyword("Mitchell")
|
224
|
+
expect(result.count).to be > 30
|
225
|
+
expect(result).to include "Mitchell Jones"
|
226
|
+
expect(result).to include "Timothy Mitchell"
|
227
|
+
end
|
228
|
+
|
229
|
+
it "should return a single result", vcr: true do
|
230
|
+
result = action.get_speakers_by_keyword("Mitchell Jones")
|
231
|
+
expect(result).to eq "Mitchell Jones"
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
end
|