Skip to content

Remove the dependency on OpenStruct in the test code #382

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

Merged
merged 2 commits into from
Jun 19, 2025
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog
## HEAD
* Remove the dependency on OpenStruct in the test code [#382](https://github.com/Sorcery/sorcery/pull/382)
* Add Ruby 3.4 to CI matrix [#381](https://github.com/Sorcery/sorcery/pull/381)
* Fix CI failures [#379](https://github.com/Sorcery/sorcery/pull/379)
* Fixed minor issues with test to get all green so that we can continue development [#377](https://github.com/Sorcery/sorcery/pull/377)
Expand Down
55 changes: 28 additions & 27 deletions spec/controllers/controller_oauth_spec.rb
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
require 'spec_helper'

# require 'shared_examples/controller_oauth_shared_examples'
require 'ostruct'

def stub_all_oauth_requests!
consumer = OAuth::Consumer.new('key', 'secret', site: 'http://myapi.com')
req_token = OAuth::RequestToken.new(consumer)
acc_token = OAuth::AccessToken.new(consumer)

response = OpenStruct.new
response.body = {
'following' => false, 'listed_count' => 0, 'profile_link_color' => '0084B4',
'profile_image_url' => 'http://a1.twimg.com/profile_images/536178575/noamb_normal.jpg',
'description' => 'Programmer/Heavy Metal Fan/New Father',
'status' => {
'text' => 'coming soon to sorcery gem: twitter and facebook authentication support.',
'truncated' => false, 'favorited' => false, 'source' => 'web', 'geo' => nil,
'in_reply_to_screen_name' => nil, 'in_reply_to_user_id' => nil,
'in_reply_to_status_id_str' => nil, 'created_at' => 'Sun Mar 06 23:01:12 +0000 2011',
'contributors' => nil, 'place' => nil, 'retweeted' => false, 'in_reply_to_status_id' => nil,
'in_reply_to_user_id_str' => nil, 'coordinates' => nil, 'retweet_count' => 0,
'id' => 44_533_012_284_706_816, 'id_str' => '44533012284706816'
},
'show_all_inline_media' => false, 'geo_enabled' => true,
'profile_sidebar_border_color' => 'a8c7f7', 'url' => nil, 'followers_count' => 10,
'screen_name' => 'nbenari', 'profile_use_background_image' => true, 'location' => 'Israel',
'statuses_count' => 25, 'profile_background_color' => '022330', 'lang' => 'en',
'verified' => false, 'notifications' => false,
'profile_background_image_url' => 'http://a3.twimg.com/profile_background_images/104087198/04042010339.jpg',
'favourites_count' => 5, 'created_at' => 'Fri Nov 20 21:58:19 +0000 2009',
'is_translator' => false, 'contributors_enabled' => false, 'protected' => false,
'follow_request_sent' => false, 'time_zone' => 'Greenland', 'profile_text_color' => '333333',
'name' => 'Noam Ben Ari', 'friends_count' => 10, 'profile_sidebar_fill_color' => 'C0DFEC',
'id' => 123, 'id_str' => '91434812', 'profile_background_tile' => false, 'utc_offset' => -10_800
}.to_json
response = Object.new
def response.body
{
'following' => false, 'listed_count' => 0, 'profile_link_color' => '0084B4',
'profile_image_url' => 'http://a1.twimg.com/profile_images/536178575/noamb_normal.jpg',
'description' => 'Programmer/Heavy Metal Fan/New Father',
'status' => {
'text' => 'coming soon to sorcery gem: twitter and facebook authentication support.',
'truncated' => false, 'favorited' => false, 'source' => 'web', 'geo' => nil,
'in_reply_to_screen_name' => nil, 'in_reply_to_user_id' => nil,
'in_reply_to_status_id_str' => nil, 'created_at' => 'Sun Mar 06 23:01:12 +0000 2011',
'contributors' => nil, 'place' => nil, 'retweeted' => false, 'in_reply_to_status_id' => nil,
'in_reply_to_user_id_str' => nil, 'coordinates' => nil, 'retweet_count' => 0,
'id' => 44_533_012_284_706_816, 'id_str' => '44533012284706816'
},
'show_all_inline_media' => false, 'geo_enabled' => true,
'profile_sidebar_border_color' => 'a8c7f7', 'url' => nil, 'followers_count' => 10,
'screen_name' => 'nbenari', 'profile_use_background_image' => true, 'location' => 'Israel',
'statuses_count' => 25, 'profile_background_color' => '022330', 'lang' => 'en',
'verified' => false, 'notifications' => false,
'profile_background_image_url' => 'http://a3.twimg.com/profile_background_images/104087198/04042010339.jpg',
'favourites_count' => 5, 'created_at' => 'Fri Nov 20 21:58:19 +0000 2009',
'is_translator' => false, 'contributors_enabled' => false, 'protected' => false,
'follow_request_sent' => false, 'time_zone' => 'Greenland', 'profile_text_color' => '333333',
'name' => 'Noam Ben Ari', 'friends_count' => 10, 'profile_sidebar_fill_color' => 'C0DFEC',
'id' => 123, 'id_str' => '91434812', 'profile_background_tile' => false, 'utc_offset' => -10_800
}.to_json
end

session[:request_token] = req_token.token
session[:request_token_secret] = req_token.secret
Expand Down