extraextra 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/extraextra.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{extraextra}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Steve Klabnik"]
data/lib/extraextra.rb CHANGED
@@ -0,0 +1 @@
1
+ require "extra/extra.rb"
@@ -1,7 +1,52 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
- describe "Extraextra" do
4
- it "fails" do
5
- fail "hey buddy, you should probably rename this file and start specing for real"
3
+ describe Extra::Extra do
4
+ describe "#source" do
5
+ it "should exist" do
6
+ Extra::Extra.respond_to?(:source).should == true
7
+ end
8
+
9
+ it "should set up a connection" do
10
+ obj = mock("Connection")
11
+ db = mock("db")
12
+ db.should_receive(:[])
13
+ obj.should_receive(:db).with("extraextra").and_return(db)
14
+ Mongo::Connection.should_receive(:new).with("localhost", 1337).and_return(obj)
15
+ Extra::Extra.should_receive(:db=).and_return(db)
16
+ Extra::Extra.should_receive(:db).and_return(db)
17
+
18
+ Extra::Extra.source :host => "localhost", :port => 1337
19
+ end
20
+ end
21
+
22
+ describe "self#!" do
23
+
24
+ it "should take three args and save them" do
25
+ #holy setup batman
26
+ collection = mock("collection")
27
+ Extra::Extra.should_receive(:collection).and_return(collection)
28
+ collection.should_receive(:insert).with(:category => :breaking, :who_id => 1, :who_name => "steve", :who_class => 'User', :what => "hit a home run", :when => Time.now.to_s)
29
+
30
+ user = mock("User", :id => 1, :class => 'User', :username => "steve")
31
+ Extra::Extra::! :breaking, user, "hit a home run"
32
+ end
33
+ end
34
+
35
+ describe "#read_all_about_it" do
36
+
37
+ it "should exist" do
38
+ Extra::Extra.respond_to?(:read_all_about_it).should == true
39
+ end
40
+
41
+ it "should return Extras for the user" do
42
+ user = mock("User", :id => 1, :class => "User")
43
+ extra = mock("Extra")
44
+ collection = mock("collection")
45
+ collection.should_receive(:find).with(:who_id=>1, :who_class=>"User").and_return([extra])
46
+ Extra::Extra.should_receive(:collection).and_return(collection)
47
+
48
+ extras = Extra::Extra.read_all_about_it(user)
49
+ extras.should == [extra]
50
+ end
6
51
  end
7
52
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Steve Klabnik
@@ -88,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - ">="
90
90
  - !ruby/object:Gem::Version
91
- hash: 4012342464942348992
91
+ hash: -1570624595924975839
92
92
  segments:
93
93
  - 0
94
94
  version: "0"