Skip to content

Commit

Permalink
Fix Style/HashSyntax
Browse files Browse the repository at this point in the history
  • Loading branch information
kimoto committed Jul 5, 2018
1 parent bfd5b1e commit 2f728b3
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 58 deletions.
2 changes: 0 additions & 2 deletions .rubocop.yml
Expand Up @@ -16,8 +16,6 @@ Style/NumericLiterals:
Enabled: false
Style/BlockDelimiters:
Enabled: false
Style/HashSyntax:
Enabled: false
Style/MutableConstant:
Enabled: false
Style/StringLiterals:
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -3,4 +3,4 @@ require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
task default: :spec
12 changes: 6 additions & 6 deletions spec/line/bot/client_get_group_or_room_member_spec.rb
Expand Up @@ -53,10 +53,10 @@ def generate_client

it 'gets room member ids' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/room/{roomId}/members/ids'
stub_request(:get, uri_template).to_return { |request| {:body => MEMBER_ID_CONTENT, :status => 200} }
stub_request(:get, uri_template).to_return { |request| {body: MEMBER_ID_CONTENT, status: 200} }

uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/room/{roomId}/members/ids?start={continuationToken}'
stub_request(:get, uri_template).to_return { |request| {:body => NEXT_MEMBER_ID_CONTENT, :status => 200} }
stub_request(:get, uri_template).to_return { |request| {body: NEXT_MEMBER_ID_CONTENT, status: 200} }

client = generate_client
room_id = "room_id"
Expand All @@ -80,10 +80,10 @@ def generate_client

it 'gets group member ids' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/group/{groupId}/members/ids'
stub_request(:get, uri_template).to_return { |request| {:body => MEMBER_ID_CONTENT, :status => 200} }
stub_request(:get, uri_template).to_return { |request| {body: MEMBER_ID_CONTENT, status: 200} }

uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/group/{groupId}/members/ids?start={continuationToken}'
stub_request(:get, uri_template).to_return { |request| {:body => NEXT_MEMBER_ID_CONTENT, :status => 200} }
stub_request(:get, uri_template).to_return { |request| {body: NEXT_MEMBER_ID_CONTENT, status: 200} }

client = generate_client
group_id = "group_id"
Expand All @@ -107,7 +107,7 @@ def generate_client

it 'gets room member profile' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/room/{roomId}/member/{userId}'
stub_request(:get, uri_template).to_return { |request| {:body => GROUP_ROOM_MEMBER_PROFILE_CONTENT, :status => 200} }
stub_request(:get, uri_template).to_return { |request| {body: GROUP_ROOM_MEMBER_PROFILE_CONTENT, status: 200} }

client = generate_client
room_id = "room_id"
Expand All @@ -123,7 +123,7 @@ def generate_client

it 'gets group member profile' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/group/{groupId}/member/{userId}'
stub_request(:get, uri_template).to_return { |request| {:body => GROUP_ROOM_MEMBER_PROFILE_CONTENT, :status => 200} }
stub_request(:get, uri_template).to_return { |request| {body: GROUP_ROOM_MEMBER_PROFILE_CONTENT, status: 200} }

client = generate_client
group_id = "group_id"
Expand Down
6 changes: 3 additions & 3 deletions spec/line/bot/client_get_spec.rb
Expand Up @@ -42,7 +42,7 @@ def generate_client

it 'gets message content' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/{identifier}/content'
stub_request(:get, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:get, uri_template).to_return { |request| {body: request.body, status: 200} }

client = generate_client

Expand All @@ -52,7 +52,7 @@ def generate_client

it 'gets profile' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/profile/{user_id}'
stub_request(:get, uri_template).to_return { |request| {:body => PROFILE_CONTENT, :status => 200} }
stub_request(:get, uri_template).to_return { |request| {body: PROFILE_CONTENT, status: 200} }

client = generate_client

Expand All @@ -67,7 +67,7 @@ def generate_client

it 'gets other path' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/profile'
stub_request(:get, uri_template).to_return { |request| {:body => OTHER_PROFILE_CONTENT, :status => 200} }
stub_request(:get, uri_template).to_return { |request| {body: OTHER_PROFILE_CONTENT, status: 200} }

client = generate_client

Expand Down
2 changes: 1 addition & 1 deletion spec/line/bot/client_spec.rb
Expand Up @@ -36,7 +36,7 @@ def generate_client
end

before do
stub_request(:post, Line::Bot::API::DEFAULT_ENDPOINT).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, Line::Bot::API::DEFAULT_ENDPOINT).to_return { |request| {body: request.body, status: 200} }
end

it 'checks user-agent' do
Expand Down
24 changes: 12 additions & 12 deletions spec/line/bot/rich_menu_spec.rb
Expand Up @@ -53,7 +53,7 @@

it 'gets a list of rich menus' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/list'
stub_request(:get, uri_template).to_return(:body => RICH_MENU_LIST_CONTENT, :status => 200)
stub_request(:get, uri_template).to_return(body: RICH_MENU_LIST_CONTENT, status: 200)

response = client.get_rich_menus
expect(WebMock).to have_requested(:get, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/list')
Expand All @@ -62,7 +62,7 @@

it 'gets a rich menu' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/1234567'
stub_request(:get, uri_template).to_return(:body => RICH_MENU_CONTENT, :status => 200)
stub_request(:get, uri_template).to_return(body: RICH_MENU_CONTENT, status: 200)

response = client.get_rich_menu('1234567')
expect(WebMock).to have_requested(:get, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/1234567')
Expand All @@ -71,24 +71,24 @@

it 'creates a rich menu' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu'
stub_request(:post, uri_template).to_return(:body => RICH_MENU_CONTENT, :status => 200)
stub_request(:post, uri_template).to_return(body: RICH_MENU_CONTENT, status: 200)

client.create_rich_menu(JSON.parse(RICH_MENU_CONTENT))
expect(WebMock).to have_requested(:post, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu')
.with(:body => JSON.parse(RICH_MENU_CONTENT).to_json)
.with(body: JSON.parse(RICH_MENU_CONTENT).to_json)
end

it 'deletes a rich menu' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/1234567'
stub_request(:delete, uri_template).to_return(:body => '{}', :status => 200)
stub_request(:delete, uri_template).to_return(body: '{}', status: 200)

client.delete_rich_menu('1234567')
expect(WebMock).to have_requested(:delete, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/1234567')
end

it 'gets rich menu linked to a user' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/user/1234567/richmenu'
stub_request(:get, uri_template).to_return(:body => '{"richMenuId":"7654321"}', :status => 200)
stub_request(:get, uri_template).to_return(body: '{"richMenuId":"7654321"}', status: 200)

response = client.get_user_rich_menu('1234567')
expect(WebMock).to have_requested(:get, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/user/1234567/richmenu')
Expand All @@ -97,23 +97,23 @@

it 'links a rich menu to a user' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/user/1234567/richmenu/7654321'
stub_request(:post, uri_template).to_return(:body => '{}', :status => 200)
stub_request(:post, uri_template).to_return(body: '{}', status: 200)

client.link_user_rich_menu('1234567', '7654321')
expect(WebMock).to have_requested(:post, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/user/1234567/richmenu/7654321')
end

it 'unlinks a rich menu from a user' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/user/1234567/richmenu'
stub_request(:delete, uri_template).to_return(:body => '{}', :status => 200)
stub_request(:delete, uri_template).to_return(body: '{}', status: 200)

client.unlink_user_rich_menu('1234567')
expect(WebMock).to have_requested(:delete, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/user/1234567/richmenu')
end

it 'gets an image associated with a rich menu' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/1234567/content'
stub_request(:get, uri_template).to_return(:body => File.open(RICH_MENU_IMAGE_FILE_PATH).read, :status => 200)
stub_request(:get, uri_template).to_return(body: File.open(RICH_MENU_IMAGE_FILE_PATH).read, status: 200)

response = client.get_rich_menu_image('1234567')
expect(WebMock).to have_requested(:get, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/1234567/content')
Expand All @@ -123,7 +123,7 @@
it 'uploads and attaches an image to a rich menu' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/1234567/content'

stub_request(:post, uri_template).to_return(:body => '{}', :status => 200).with { |request|
stub_request(:post, uri_template).to_return(body: '{}', status: 200).with { |request|
expect(request.headers["Content-Type"]).to eq('image/png')
}

Expand All @@ -132,12 +132,12 @@
end

expect(WebMock).to have_requested(:post, Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/1234567/content')
.with(:body => File.open(RICH_MENU_IMAGE_FILE_PATH).read)
.with(body: File.open(RICH_MENU_IMAGE_FILE_PATH).read)
end

it "uploads invalid extension's file" do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/richmenu/1234567/content'
stub_request(:post, uri_template).to_return(:body => '{}', :status => 200)
stub_request(:post, uri_template).to_return(body: '{}', status: 200)
expect {
File.open(RICH_MENU_INVALID_FILE_EXTENSION_PATH) do |file|
client.create_rich_menu_image('1234567', file)
Expand Down
6 changes: 3 additions & 3 deletions spec/line/bot/send_message_01_text_spec.rb
Expand Up @@ -7,7 +7,7 @@
describe Line::Bot::Client do
it 'pushes the text message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/push'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand All @@ -31,7 +31,7 @@

it 'replies the text message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/reply'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand All @@ -55,7 +55,7 @@

it 'multicasts the text message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/multicast'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand Down
6 changes: 3 additions & 3 deletions spec/line/bot/send_message_02_image_spec.rb
Expand Up @@ -7,7 +7,7 @@
describe Line::Bot::Client do
it 'pushes the image message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/push'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand All @@ -32,7 +32,7 @@

it 'replies the image message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/reply'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand All @@ -57,7 +57,7 @@

it 'multicasts the image message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/multicast'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand Down
6 changes: 3 additions & 3 deletions spec/line/bot/send_message_03_video_spec.rb
Expand Up @@ -7,7 +7,7 @@
describe Line::Bot::Client do
it 'pushes the video message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/push'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand All @@ -32,7 +32,7 @@

it 'replies the video message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/reply'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand All @@ -57,7 +57,7 @@

it 'multicasts the video message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/multicast'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand Down
6 changes: 3 additions & 3 deletions spec/line/bot/send_message_04_audio_spec.rb
Expand Up @@ -7,7 +7,7 @@
describe Line::Bot::Client do
it 'pushes the audio message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/push'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand All @@ -32,7 +32,7 @@

it 'replies the audio message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/reply'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand All @@ -57,7 +57,7 @@

it 'multicasts the audio message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/multicast'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand Down
6 changes: 3 additions & 3 deletions spec/line/bot/send_message_05_location_spec.rb
Expand Up @@ -7,7 +7,7 @@
describe Line::Bot::Client do
it 'pushes the location message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/push'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand All @@ -34,7 +34,7 @@

it 'replies the location message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/reply'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand All @@ -61,7 +61,7 @@

it 'multicasts the location message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/multicast'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand Down
6 changes: 3 additions & 3 deletions spec/line/bot/send_message_06_sticker_spec.rb
Expand Up @@ -7,7 +7,7 @@
describe Line::Bot::Client do
it 'pushes the sticker message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/push'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand All @@ -32,7 +32,7 @@

it 'replies the sticker message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/reply'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand All @@ -57,7 +57,7 @@

it 'multicasts the sticker message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/multicast'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand Down
6 changes: 3 additions & 3 deletions spec/line/bot/send_message_07_imagemap_spec.rb
Expand Up @@ -7,7 +7,7 @@
describe Line::Bot::Client do
it 'pushes the imagemap message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/push'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand Down Expand Up @@ -58,7 +58,7 @@

it 'replies the imagemap message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/reply'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand Down Expand Up @@ -109,7 +109,7 @@

it 'multicasts the imagemap message' do
uri_template = Addressable::Template.new Line::Bot::API::DEFAULT_ENDPOINT + '/bot/message/multicast'
stub_request(:post, uri_template).to_return { |request| {:body => request.body, :status => 200} }
stub_request(:post, uri_template).to_return { |request| {body: request.body, status: 200} }

client = Line::Bot::Client.new do |config|
config.channel_token = 'channel_token'
Expand Down

0 comments on commit 2f728b3

Please sign in to comment.