test/unit/etsy_test.rb in etsy-0.2.0 vs test/unit/etsy_test.rb in etsy-0.2.1

- old
+ new

@@ -5,12 +5,14 @@ context "The Etsy module" do setup do 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) Etsy.instance_variable_set(:@api_secret, nil) + Etsy.instance_variable_set(:@permission_scopes, nil) end should "be able to set and retrieve the API key" do Etsy.api_key = 'key' Etsy.api_key.should == 'key' @@ -39,29 +41,39 @@ should "be able to set and retrieve the API secret" do Etsy.api_secret = 'secret' Etsy.api_secret.should == 'secret' end - should "be in read-mode by default" do - Etsy.access_mode.should == :read_only + should "know the host for the sandbox environment" do + Etsy.environment = :sandbox + Etsy.host.should == 'sandbox.openapi.etsy.com' end - should "be able to set the access mode to a read-write" do - Etsy.access_mode = :read_write - Etsy.access_mode.should == :read_write + should "know the host for the production environment" do + Etsy.environment = :production + Etsy.host.should == 'openapi.etsy.com' end - should "raise an exception when attempting to set an invalid access mode" do - lambda { Etsy.access_mode = :invalid }.should raise_error(ArgumentError) + should "default to sandbox host" do + Etsy.host.should == 'sandbox.openapi.etsy.com' end should "be able to set the callback url" do Etsy.callback_url = 'http://localhost' Etsy.callback_url.should == 'http://localhost' end should "default callback to out-of-band" do Etsy.callback_url.should == 'oob' + end + + should "default permission scopes to an empty array" do + Etsy.permission_scopes.should == [] + end + + should "be able to set the scopes" do + Etsy.permission_scopes = %w(a_scope another_scope) + Etsy.permission_scopes.should == ['a_scope', 'another_scope'] end end context "The Etsy module when set up properly" do setup do