Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Missing set function #335

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/t/set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 link color has been updated."
end
end
end
15 changes: 15 additions & 0 deletions spec/set_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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