spec/support/shared_examples.rb in omniauth-bookingsync-0.2.0 vs spec/support/shared_examples.rb in omniauth-bookingsync-0.3.0

- old
+ new

@@ -1,36 +1,59 @@ -shared_examples 'an oauth2 strategy' do +shared_examples "an oauth2 strategy" do describe '#client' do - it 'should be initialized with symbolized client_options' do - @options = { :client_options => { 'authorize_url' => 'https://example.com' } } - subject.client.options[:authorize_url].should == 'https://example.com' + let(:options) do + { client_options: { "authorize_url" => "https://example.com" } } end + + it "is initialized with symbolized client_options" do + expect(subject.client.options[:authorize_url]).to eq "https://example.com" + end end describe '#authorize_params' do - it 'should include any authorize params passed in the :authorize_params option' do - @options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } } - subject.authorize_params['foo'].should eq('bar') - subject.authorize_params['baz'].should eq('zip') + context "when passed as authorize_params" do + let(:options) do + { authorize_params: { foo: "bar", baz: "zip" } } + end + + it "includes any authorize params passed in the :authorize_params option" do + expect(subject.authorize_params["foo"]).to eq("bar") + expect(subject.authorize_params["baz"]).to eq("zip") + end end - it 'should include top-level options that are marked as :authorize_options' do - @options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' } - subject.authorize_params['scope'].should eq('bar') - subject.authorize_params['foo'].should eq('baz') + context "when passed as authorize_options" do + let(:options) do + { authorize_options: [:scope, :foo], scope: "bar", foo: "baz" } + end + + it "includes top-level options that are marked as :authorize_options" do + expect(subject.authorize_params["scope"]).to eq("bar") + expect(subject.authorize_params["foo"]).to eq("baz") + end end end describe '#token_params' do - it 'should include any token params passed in the :token_params option' do - @options = { :token_params => { :foo => 'bar', :baz => 'zip' } } - subject.token_params['foo'].should eq('bar') - subject.token_params['baz'].should eq('zip') + context "when passed as token_params" do + let(:options) do + { token_params: { foo: "bar", baz: "zip" } } + end + + it "includes any token params passed in the :token_params option" do + expect(subject.token_params["foo"]).to eq("bar") + expect(subject.token_params["baz"]).to eq("zip") + end end - it 'should include top-level options that are marked as :token_options' do - @options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' } - subject.token_params['scope'].should eq('bar') - subject.token_params['foo'].should eq('baz') + context "when passed as token_options" do + let(:options) do + { token_options: [:scope, :foo], scope: "bar", foo: "baz" } + end + + it "includes top-level options that are marked as :token_options" do + expect(subject.token_params["scope"]).to eq("bar") + expect(subject.token_params["foo"]).to eq("baz") + end end end -end \ No newline at end of file +end