From 9fd58c4ce1460d921a18d3f9b44553a2eb074faa Mon Sep 17 00:00:00 2001 From: Shweta Date: Thu, 30 Jun 2016 00:17:49 +0530 Subject: [PATCH 1/2] Added "set profile_link_color" refs #333 --- lib/t/set.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/t/set.rb b/lib/t/set.rb index 67ac79d7..27d67af0 100644 --- a/lib/t/set.rb +++ b/lib/t/set.rb @@ -68,5 +68,12 @@ def website(uri) client.update_profile(url: uri) say "@#{@rcfile.active_profile[0]}'s website has been updated." end + + desc 'profile link color', 'Sets a hex value that controls the color scheme of links used on the + authenticating user’s profile page on twitter.com. ' + def profile_link_color(color_code) + client.update_profile(profile_link_color: color_code) + say "@#{@rcfile.active_profile[0]}'s profile color code has been updated." + end end end From 5088985dbd4c7c0ff67955972759d07565580e9b Mon Sep 17 00:00:00 2001 From: Shweta Date: Thu, 30 Jun 2016 00:29:59 +0530 Subject: [PATCH 2/2] Test cases for set profile link color[#333] --- lib/t/set.rb | 2 +- spec/set_spec.rb | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/t/set.rb b/lib/t/set.rb index 27d67af0..a89f8014 100644 --- a/lib/t/set.rb +++ b/lib/t/set.rb @@ -73,7 +73,7 @@ def website(uri) authenticating user’s profile page on twitter.com. ' def profile_link_color(color_code) client.update_profile(profile_link_color: color_code) - say "@#{@rcfile.active_profile[0]}'s profile color code has been updated." + say "@#{@rcfile.active_profile[0]}'s profile link color has been updated." end end end diff --git a/spec/set_spec.rb b/spec/set_spec.rb index a819545b..85f56484 100644 --- a/spec/set_spec.rb +++ b/spec/set_spec.rb @@ -149,4 +149,19 @@ expect($stdout.string.chomp).to eq "@testcli's website has been updated." end end + + describe 'profile_link_color' do + before do + @set.options = @set.options.merge('profile' => fixture_path + '/.trc') + stub_post('/1.1/account/update_profile.json').with(body: {profile_link_color: '0084B4'}).to_return(body: fixture('sferik.json'), headers: {content_type: 'application/json; charset=utf-8'}) + end + it 'requests the correct resource' do + @set.profile_link_color('0084B4') + expect(a_post('/1.1/account/update_profile.json').with(body: {profile_link_color: '0084B4'})).to have_been_made + end + it 'has the correct output' do + @set.profile_link_color('0084B4') + expect($stdout.string.chomp).to eq "@testcli's profile link color has been updated." + end + end end