Sha256: 0592694c5a5210e6e9d94e43257e62e4b1ae10f49204925f9c9eb12a392f2293
Contents?: true
Size: 1.36 KB
Versions: 3
Compression:
Stored size: 1.36 KB
Contents
require 'spec_helper' describe Namba do before(:each) do Namba.configure do |config| config.username = nil config.password = nil config.locale = nil end end it "should set configuration information" do Namba.configure do |config| config.username = "name" config.password = "secret" config.locale = :kz end n = Namba.new() n.username.should == "name" n.password.should == "secret" n.locale.should == :kz end it "should set defaults when it is not set in configuration block" do Namba.configure do |config| end n = Namba.new() n.username.should == "" n.password.should == "" n.locale.should == :kg end it "should not allow to set any locale except :kg or :kz" do expect { Namba.configure do |config| config.locale = :ru end }.should raise_error(Namba::ConfigurationError, "Available locales are only 'kg' and 'kz'") end it "should raise Invalid Response Error when status code is not 200" do Namba.configure do |config| config.username = "name" config.password = "secret" config.locale = :kz end n = Namba.new() expect { n.send(:get_response_from, "http://api.namba.#{n.locale}/404") }.should raise_error(Namba::InvalidResponseError, "Invalid response from service") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
namba-1.2.0 | spec/namba/namba_spec.rb |
namba-1.1.0 | spec/namba/namba_spec.rb |
namba-1.0.1 | spec/namba/namba_spec.rb |