test/unit/etsy_test.rb in etsy-0.2.5 vs test/unit/etsy_test.rb in etsy-0.2.6

- old
+ new

@@ -2,10 +2,11 @@ class EtsyTest < Test::Unit::TestCase context "The Etsy module" do setup do + Etsy.instance_variable_set(:@protocol, nil) Etsy.instance_variable_set(:@environment, nil) Etsy.instance_variable_set(:@access_mode, nil) Etsy.instance_variable_set(:@callback_url, nil) Etsy.instance_variable_set(:@host, nil) Etsy.instance_variable_set(:@api_key, nil) @@ -23,10 +24,23 @@ Etsy::User.expects(:find).with('littletjane').returns(user) Etsy.user('littletjane').should == user end + should "use the https protocol by default" do + Etsy.protocol.should == "https" + end + + should "be able to set the protocol to a valid value" do + Etsy.protocol = 'http' + Etsy.protocol.should == 'http' + end + + should "raise an exception when attempting to set an invalid protocol" do + lambda { Etsy.protocol = :invalid }.should raise_error(ArgumentError) + end + should "use the sandbox environment by default" do Etsy.environment.should == :sandbox end should "be able to set the environment to a valid value" do @@ -76,9 +90,10 @@ end end context "The Etsy module when set up properly" do setup do + Etsy.instance_variable_set(:@protocol, 'https') Etsy.instance_variable_set(:@environment, :sandbox) Etsy.instance_variable_set(:@access_mode, :read_write) Etsy.instance_variable_set(:@api_key, 'key') Etsy.instance_variable_set(:@api_secret, 'secret') Etsy.instance_variable_set(:@verification_request, nil)