extraextra 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/extraextra.gemspec +1 -1
- data/lib/extraextra.rb +1 -0
- data/spec/extraextra_spec.rb +48 -3
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/extraextra.gemspec
CHANGED
data/lib/extraextra.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
require "extra/extra.rb"
|
data/spec/extraextra_spec.rb
CHANGED
@@ -1,7 +1,52 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
5
|
-
|
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
|
-
-
|
9
|
-
version: 0.1.
|
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:
|
91
|
+
hash: -1570624595924975839
|
92
92
|
segments:
|
93
93
|
- 0
|
94
94
|
version: "0"
|