Skip to content

Commit

Permalink
Convert specs to RSpec 2.99.2 syntax with Transpec
Browse files Browse the repository at this point in the history
This conversion is done by Transpec 3.3.0 with the following command:
    transpec --force --convert stub_with_hash

* 899 conversions
    from: obj.should
      to: expect(obj).to

* 61 conversions
    from: be_false
      to: be_falsey

* 37 conversions
    from: be_true
      to: be_truthy

* 11 conversions
    from: lambda { }.should
      to: expect { }.to

* 4 conversions
    from: =~ /pattern/
      to: match(/pattern/)

* 3 conversions
    from: == expected
      to: eq(expected)

* 2 conversions
    from: obj.should_not
      to: expect(obj).not_to

* 2 conversions
    from: obj.stub!(:message)
      to: allow(obj).to receive(:message)

For more details: https://github.com/yujinakayama/transpec#supported-conversions
  • Loading branch information
yujinakayama committed Jan 21, 2018
1 parent 33f11db commit 3feab9a
Show file tree
Hide file tree
Showing 54 changed files with 1,288 additions and 1,288 deletions.
12 changes: 6 additions & 6 deletions spec/twitter/action/favorite_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
describe "#sources" do
it "returns a collection of users who favorited a Tweet" do
sources = Twitter::Action::Favorite.new(:sources => [{:id => 7505382}]).sources
sources.should be_an Array
sources.first.should be_a Twitter::User
expect(sources).to be_an Array
expect(sources.first).to be_a Twitter::User
end
it "is empty when not set" do
sources = Twitter::Action::Favorite.new.sources
sources.should be_empty
expect(sources).to be_empty
end
end

describe "#targets" do
it "returns a collection containing the favorited Tweet" do
targets = Twitter::Action::Favorite.new(:targets => [{:id => 25938088801}]).targets
targets.should be_an Array
targets.first.should be_a Twitter::Tweet
expect(targets).to be_an Array
expect(targets.first).to be_a Twitter::Tweet
end
it "is empty when not set" do
targets = Twitter::Action::Favorite.new.targets
targets.should be_empty
expect(targets).to be_empty
end
end

Expand Down
12 changes: 6 additions & 6 deletions spec/twitter/action/follow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
describe "#sources" do
it "returns a collection of users who followed a user" do
sources = Twitter::Action::Follow.new(:sources => [{:id => 7505382}]).sources
sources.should be_an Array
sources.first.should be_a Twitter::User
expect(sources).to be_an Array
expect(sources.first).to be_a Twitter::User
end
it "is empty when not set" do
sources = Twitter::Action::Follow.new.sources
sources.should be_empty
expect(sources).to be_empty
end
end

describe "#targets" do
it "returns a collection containing the followed user" do
targets = Twitter::Action::Follow.new(:targets => [{:id => 7505382}]).targets
targets.should be_an Array
targets.first.should be_a Twitter::User
expect(targets).to be_an Array
expect(targets.first).to be_a Twitter::User
end
it "is empty when not set" do
targets = Twitter::Action::Follow.new.targets
targets.should be_empty
expect(targets).to be_empty
end
end

Expand Down
18 changes: 9 additions & 9 deletions spec/twitter/action/list_member_added_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@
describe "#sources" do
it "returns a collection of users who added a user to a list" do
sources = Twitter::Action::ListMemberAdded.new(:sources => [{:id => 7505382}]).sources
sources.should be_an Array
sources.first.should be_a Twitter::User
expect(sources).to be_an Array
expect(sources.first).to be_a Twitter::User
end
it "is empty when not set" do
sources = Twitter::Action::ListMemberAdded.new.sources
sources.should be_empty
expect(sources).to be_empty
end
end

describe "#target_objects" do
it "returns a collection of lists that were added to" do
targets = Twitter::Action::ListMemberAdded.new(:target_objects => [{:id => 8863586}]).target_objects
targets.should be_an Array
targets.first.should be_a Twitter::List
expect(targets).to be_an Array
expect(targets.first).to be_a Twitter::List
end
it "is empty when not set" do
targets = Twitter::Action::ListMemberAdded.new.target_objects
targets.should be_empty
expect(targets).to be_empty
end
end

describe "#targets" do
it "returns a collection of users who were added to a list" do
targets = Twitter::Action::ListMemberAdded.new(:targets => [{:id => 7505382}]).targets
targets.should be_an Array
targets.first.should be_a Twitter::User
expect(targets).to be_an Array
expect(targets.first).to be_a Twitter::User
end
it "is empty when not set" do
targets = Twitter::Action::ListMemberAdded.new.targets
targets.should be_empty
expect(targets).to be_empty
end
end

Expand Down
22 changes: 11 additions & 11 deletions spec/twitter/action/mention_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,47 @@
describe "#sources" do
it "returns a collection of users who mentioned a user" do
sources = Twitter::Action::Mention.new(:sources => [{:id => 7505382}]).sources
sources.should be_an Array
sources.first.should be_a Twitter::User
expect(sources).to be_an Array
expect(sources.first).to be_a Twitter::User
end
it "is empty when not set" do
sources = Twitter::Action::Mention.new.sources
sources.should be_empty
expect(sources).to be_empty
end
end

describe "#source" do
it "returns the user who mentioned a user" do
source = Twitter::Action::Mention.new(:sources => [{:id => 7505382}]).source
source.should be_a Twitter::User
expect(source).to be_a Twitter::User
end
it "returns nil when not set" do
source = Twitter::Action::Mention.new.source
source.should be_nil
expect(source).to be_nil
end
end

describe "#target_objects" do
it "returns a collection of Tweets that mention a user" do
targets = Twitter::Action::Mention.new(:target_objects => [{:id => 25938088801}]).target_objects
targets.should be_an Array
targets.first.should be_a Twitter::Tweet
expect(targets).to be_an Array
expect(targets.first).to be_a Twitter::Tweet
end
it "is empty when not set" do
targets = Twitter::Action::Mention.new.target_objects
targets.should be_empty
expect(targets).to be_empty
end
end

describe "#targets" do
it "returns a collection containing the mentioned user" do
targets = Twitter::Action::Mention.new(:targets => [{:id => 7505382}]).targets
targets.should be_an Array
targets.first.should be_a Twitter::User
expect(targets).to be_an Array
expect(targets.first).to be_a Twitter::User
end
it "is empty when not set" do
targets = Twitter::Action::Mention.new.targets
targets.should be_empty
expect(targets).to be_empty
end
end

Expand Down
18 changes: 9 additions & 9 deletions spec/twitter/action/reply_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@
describe "#sources" do
it "returns a collection of users who replied to a user" do
sources = Twitter::Action::Reply.new(:sources => [{:id => 7505382}]).sources
sources.should be_an Array
sources.first.should be_a Twitter::User
expect(sources).to be_an Array
expect(sources.first).to be_a Twitter::User
end
it "is empty when not set" do
sources = Twitter::Action::Reply.new.sources
sources.should be_empty
expect(sources).to be_empty
end
end

describe "#target_objects" do
it "returns a collection of Tweets that reply to a user" do
targets = Twitter::Action::Reply.new(:target_objects => [{:id => 25938088801}]).target_objects
targets.should be_an Array
targets.first.should be_a Twitter::Tweet
expect(targets).to be_an Array
expect(targets.first).to be_a Twitter::Tweet
end
it "is empty when not set" do
targets = Twitter::Action::Reply.new.target_objects
targets.should be_empty
expect(targets).to be_empty
end
end

describe "#targets" do
it "returns a collection that contains the replied-to status" do
targets = Twitter::Action::Reply.new(:targets => [{:id => 25938088801}]).targets
targets.should be_an Array
targets.first.should be_a Twitter::Tweet
expect(targets).to be_an Array
expect(targets.first).to be_a Twitter::Tweet
end
it "is empty when not set" do
targets = Twitter::Action::Reply.new.targets
targets.should be_empty
expect(targets).to be_empty
end
end

Expand Down
18 changes: 9 additions & 9 deletions spec/twitter/action/retweet_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@
describe "#sources" do
it "returns a collection of users who retweeted a user" do
sources = Twitter::Action::Retweet.new(:sources => [{:id => 7505382}]).sources
sources.should be_an Array
sources.first.should be_a Twitter::User
expect(sources).to be_an Array
expect(sources.first).to be_a Twitter::User
end
it "is empty when not set" do
sources = Twitter::Action::Retweet.new.sources
sources.should be_empty
expect(sources).to be_empty
end
end

describe "#target_objects" do
it "returns a collection of retweets" do
targets = Twitter::Action::Retweet.new(:target_objects => [{:id => 25938088801}]).target_objects
targets.should be_an Array
targets.first.should be_a Twitter::Tweet
expect(targets).to be_an Array
expect(targets.first).to be_a Twitter::Tweet
end
it "is empty when not set" do
targets = Twitter::Action::Retweet.new.target_objects
targets.should be_empty
expect(targets).to be_empty
end
end

describe "#targets" do
it "returns a collection containing the retweeted user" do
targets = Twitter::Action::Retweet.new(:targets => [{:id => 7505382}]).targets
targets.should be_an Array
targets.first.should be_a Twitter::User
expect(targets).to be_an Array
expect(targets.first).to be_a Twitter::User
end
it "is empty when not set" do
targets = Twitter::Action::Retweet.new.targets
targets.should be_empty
expect(targets).to be_empty
end
end

Expand Down
16 changes: 8 additions & 8 deletions spec/twitter/action_factory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@
describe ".new" do
it "generates a Favorite" do
action = Twitter::ActionFactory.fetch_or_new(:action => 'favorite')
action.should be_a Twitter::Action::Favorite
expect(action).to be_a Twitter::Action::Favorite
end
it "generates a Follow" do
action = Twitter::ActionFactory.fetch_or_new(:action => 'follow')
action.should be_a Twitter::Action::Follow
expect(action).to be_a Twitter::Action::Follow
end
it "generates a ListMemberAdded" do
action = Twitter::ActionFactory.fetch_or_new(:action => 'list_member_added')
action.should be_a Twitter::Action::ListMemberAdded
expect(action).to be_a Twitter::Action::ListMemberAdded
end
it "generates a Mention" do
action = Twitter::ActionFactory.fetch_or_new(:action => 'mention')
action.should be_a Twitter::Action::Mention
expect(action).to be_a Twitter::Action::Mention
end
it "generates a Reply" do
action = Twitter::ActionFactory.fetch_or_new(:action => 'reply')
action.should be_a Twitter::Action::Reply
expect(action).to be_a Twitter::Action::Reply
end
it "generates a Retweet" do
action = Twitter::ActionFactory.fetch_or_new(:action => 'retweet')
action.should be_a Twitter::Action::Retweet
expect(action).to be_a Twitter::Action::Retweet
end
it "raises an ArgumentError when action is not specified" do
lambda do
expect do
Twitter::ActionFactory.fetch_or_new
end.should raise_error(ArgumentError, "argument must have :action key")
end.to raise_error(ArgumentError, "argument must have :action key")
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/twitter/action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
describe "#created_at" do
it "returns a Time when created_at is set" do
user = Twitter::User.new(:id => 7505382, :created_at => "Mon Jul 16 12:59:01 +0000 2007")
user.created_at.should be_a Time
expect(user.created_at).to be_a Time
end
it "returns nil when created_at is not set" do
user = Twitter::User.new(:id => 7505382)
user.created_at.should be_nil
expect(user.created_at).to be_nil
end
end

Expand Down
Loading

0 comments on commit 3feab9a

Please sign in to comment.