Skip to content

Commit 21b3933

Browse files
committed
spec: prevent frozen string error
1 parent 624511a commit 21b3933

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

spec/support/shared_examples/config.yml_spec.rb

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@
1212
let(:global_config) do
1313
{
1414
'headers' => {
15-
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:67.0) Gecko/20100101 Firefox/67.0'
15+
'User-Agent': <<~UA.delete("\n")
16+
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)
17+
AppleWebKit/537.36 (KHTML, like Gecko)
18+
Chrome/134.0.0.0
19+
Safari/537.36'
20+
UA
1621
}
1722
}
1823
end
1924
let(:config) do
2025
feed_name = file_path.split(File::Separator)[-2..].join(File::Separator)
2126
config = {}.merge Html2rss::Configs.find_by_name(feed_name)
2227

23-
config.merge!(global_config)
28+
config.merge!(global_config.dup)
2429
config[:params] = params if params
2530
config
2631
end
@@ -63,17 +68,6 @@
6368
end
6469
end
6570

66-
context 'with sanitize_html post_processor' do
67-
it 'is used for description selector' do
68-
if (description_selector = yaml['selectors']['description'])
69-
post_processors = [description_selector['post_process']].flatten.compact
70-
sanitize_html = post_processors.select { |p| p['name'] == 'sanitize_html' }
71-
72-
expect(sanitize_html).not_to be_nil
73-
end
74-
end
75-
end
76-
7771
context 'with template post_processor' do
7872
it 'references available selectors only', :aggregate_failures do
7973
Helper.referenced_selectors_in_template(yaml['selectors']).each do |referenced_selector|
@@ -97,7 +91,7 @@
9791
end
9892

9993
context "when fetching #{params}", :fetch do
100-
subject(:feed) { Html2rss.feed(config) }
94+
subject(:feed) { Html2rss.feed(config.dup) }
10195

10296
it 'has positive amount of items' do
10397
expect(feed.items.count).to be_positive, <<~MSG
@@ -115,7 +109,7 @@
115109

116110
context "when fetching #{params} / item", :fetch do
117111
subject(:item) do
118-
items = Html2rss.feed(config).items
112+
items = Html2rss.feed(config.dup).items
119113

120114
expect(items.count).not_to be_zero, "Zero items fetched for `#{file_name}`"
121115

0 commit comments

Comments
 (0)