Skip to content

Commit

Permalink
Prevent namespace scoping bugs in Entity classes
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Jul 18, 2012
1 parent 979ed71 commit def9e9b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -160,9 +160,9 @@ vulnerabilities are discovered.

Here are some fun facts about the 3.0 release:

* The entire library is implemented in just 2,254 lines of code
* The entire library is implemented in just 2,264 lines of code
* With over 5,000 lines of specs, the spec-to-code ratio is well over 2:1
* The spec suite contains 658 examples and runs in under 2 seconds on a MacBook
* The spec suite contains 661 examples and runs in under 2 seconds on a MacBook
* This project has 100% C0 code coverage (the tests execute every line of
source code at least once)
* At the time of release, this library is comprehensive: you can request all
Expand Down
6 changes: 4 additions & 2 deletions lib/twitter/entity/hashtag.rb
@@ -1,7 +1,9 @@
require 'twitter/entity'

module Twitter
class Entity::Hashtag < Twitter::Entity
attr_reader :text
class Entity
class Hashtag < Twitter::Entity
attr_reader :text
end
end
end
6 changes: 4 additions & 2 deletions lib/twitter/entity/url.rb
@@ -1,7 +1,9 @@
require 'twitter/entity'

module Twitter
class Entity::Url < Twitter::Entity
attr_reader :display_url, :expanded_url, :url
class Entity
class Url < Twitter::Entity
attr_reader :display_url, :expanded_url, :url
end
end
end
6 changes: 4 additions & 2 deletions lib/twitter/entity/user_mention.rb
@@ -1,7 +1,9 @@
require 'twitter/entity'

module Twitter
class Entity::UserMention < Twitter::Entity
attr_reader :id, :name, :screen_name
class Entity
class UserMention < Twitter::Entity
attr_reader :id, :name, :screen_name
end
end
end
4 changes: 4 additions & 0 deletions spec/twitter/action_factory_spec.rb
Expand Up @@ -27,6 +27,10 @@
action = Twitter::ActionFactory.fetch_or_new(:action => 'retweet')
action.should be_a Twitter::Action::Retweet
end
it "generates a Status" do
action = Twitter::ActionFactory.fetch_or_new(:action => 'status')
action.should be_a Twitter::Action::Status
end
it "raises an ArgumentError when action is not specified" do
lambda do
Twitter::ActionFactory.fetch_or_new
Expand Down

0 comments on commit def9e9b

Please sign in to comment.