spec/steam_spec.rb in steam-api-1.0.1 vs spec/steam_spec.rb in steam-api-1.0.2
- old
+ new
@@ -8,21 +8,31 @@
after(:each) do
Steam.apikey = @apikey
end
it 'should return a Steam API key if one is defined' do
- Steam.apikey.should_not be_nil
+ expect(Steam.apikey).to_not be_nil
end
it 'should return an error if the Steam Key is missing' do
Steam.apikey = nil
- lambda { Steam.apikey }
- .should raise_error(ArgumentError, /Please set your Steam API key/)
+ ENV['STEAM_API_KEY'] = nil
+ expect(lambda { Steam.apikey })
+ .to raise_error(ArgumentError, /Please set your Steam API key/)
end
it 'should return a new value if set to a different API key' do
old = Steam.apikey
Steam.apikey = 'blah'
- Steam.apikey.should_not == old
- Steam.apikey.should == 'blah'
+ expect(Steam.apikey).to_not eq(old)
+ expect(Steam.apikey).to eq('blah')
+ end
+
+ it 'should allow users to set the apikey post init using ENV' do
+ Steam.apikey = nil
+ ENV['STEAM_API_KEY'] = nil
+ expect(lambda { Steam.apikey })
+ .to raise_error(ArgumentError, /Please set your Steam API key/)
+ ENV['STEAM_API_KEY'] = @apikey
+ expect(Steam.apikey).to eq(@apikey)
end
end