Sha256: 24bac218e2a84da9564fa86a00b09e7bf9f4066c0a1fe8a0bd8ec789b54f0fe3

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

require 'helper'

describe Twitter::ActionFactory do

  describe ".new" do
    it "generates a Favorite" do
      action = Twitter::ActionFactory.fetch_or_new(:action => 'favorite')
      expect(action).to be_a Twitter::Action::Favorite
    end
    it "generates a Follow" do
      action = Twitter::ActionFactory.fetch_or_new(: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')
      expect(action).to be_a Twitter::Action::ListMemberAdded
    end
    it "generates a Mention" do
      action = Twitter::ActionFactory.fetch_or_new(:action => 'mention')
      expect(action).to be_a Twitter::Action::Mention
    end
    it "generates a Reply" do
      action = Twitter::ActionFactory.fetch_or_new(:action => 'reply')
      expect(action).to be_a Twitter::Action::Reply
    end
    it "generates a Retweet" do
      action = Twitter::ActionFactory.fetch_or_new(:action => 'retweet')
      expect(action).to be_a Twitter::Action::Retweet
    end
    it "raises an ArgumentError when action is not specified" do
      expect{Twitter::ActionFactory.fetch_or_new}.to raise_error(ArgumentError, "argument must have :action key")
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twitter-4.3.0 spec/twitter/action_factory_spec.rb
twitter-4.2.0 spec/twitter/action_factory_spec.rb
twitter-4.1.2 spec/twitter/action_factory_spec.rb
twitter-4.1.1 spec/twitter/action_factory_spec.rb