Sha256: e532b1e3c99493609dca0681c48c1820eb9adf4a9cab8f0b5255652edd85e768
Contents?: true
Size: 1.46 KB
Versions: 4
Compression:
Stored size: 1.46 KB
Contents
require "spec_helper" describe NPR::Configuration do describe "NPR.configure" do after :each do NPR.instance_variable_set :@config, nil end it "takes a block to set global configuration" do NPR.configure do |config| config.sort = "cool sorting, bro" end NPR.config.sort.should eq "cool sorting, bro" NPR.config.apiKey.should eq nil end end describe "NPR.config" do it "creates a new NPR::Configure object" do config = NPR.config config.should be_a NPR::Configuration NPR.config.should equal config end end #------------------ describe "with options" do it "assigns the passed-in options using the setter" do config = NPR::Configuration.new(:apiKey => "hello") config.apiKey.should eq "hello" end end #------------------ describe "#to_hash" do it "converts the config to a hash" do config = NPR::Configuration.new config.sort = "date" config.apiKey = "key" config.to_hash.should eq Hash[:sort => "date", :apiKey => "key"] end end #------------------ describe "#merge" do it "turns it into a hash and merges it with the passed-in hash" do config = NPR::Configuration.new config.sort = "date" config.apiKey = "key" config.merge(:title => "List").should eq Hash[ :title => "List", :sort => "date", :apiKey => "key" ] end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
npr-1.1.0 | spec/unit/configuration_spec.rb |
npr-0.1.2 | spec/unit/configuration_spec.rb |
npr-0.1.1 | spec/unit/configuration_spec.rb |
npr-0.1.0 | spec/unit/configuration_spec.rb |