Skip to content

Commit 0353881

Browse files
committed
Fix flaky configuration test
Is the oembed test (which sets the user agent setting) runs first, the config test would fail. Now we always ensure an empty config.
1 parent 2950544 commit 0353881

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

spec/article_json/configuration_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
subject(:configuration) { described_class.new }
33

44
describe 'configuration block' do
5+
# make sure we test with a fresh config...
6+
before { ArticleJSON.configuration = configuration }
57
it 'should set the configuration values correctly' do
68
expect { ArticleJSON.configure { |c| c.oembed_user_agent = 'foo' } }.to(
79
change { ArticleJSON.configuration.oembed_user_agent }
@@ -19,7 +21,7 @@
1921
end
2022

2123
context 'when it has a value' do
22-
before { configuration.instance_variable_set(:@oembed_user_agent, 'foo') }
24+
before { configuration.oembed_user_agent = 'foo' }
2325
it { should eq 'foo' }
2426
end
2527
end

0 commit comments

Comments
 (0)