hackershout 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
data/lib/hackershout/base.rb
CHANGED
@@ -12,7 +12,7 @@ module Hackershout
|
|
12
12
|
|
13
13
|
def initialize(options = {})
|
14
14
|
@name = self.class.name.split("::").last
|
15
|
-
@url = options[:url]
|
15
|
+
@url = options[:url] << "&utm_medium=#{@name.downcase}"
|
16
16
|
@title = options[:title]
|
17
17
|
@tags = options[:tags]
|
18
18
|
@message = options[:message]
|
data/lib/hackershout/version.rb
CHANGED
@@ -53,10 +53,10 @@ module Hackershout
|
|
53
53
|
end
|
54
54
|
|
55
55
|
describe "#ask_for_url" do
|
56
|
-
it 'asks for the url and returns it' do
|
56
|
+
it 'asks for the url and returns it with appended metainformation' do
|
57
57
|
subject.should_receive(:print).with("Type the URL you want to share: ")
|
58
58
|
subject.should_receive(:gets).and_return ' http://rubygems.org/gems/my_gem '
|
59
|
-
subject.ask_for_url.should == 'http://rubygems.org/gems/my_gem'
|
59
|
+
subject.ask_for_url.should == 'http://rubygems.org/gems/my_gem?utm_source=hackershout'
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -23,6 +23,7 @@ module Hackershout
|
|
23
23
|
base.instance_variable_get(:@login).should eq('my.email@gmail.com')
|
24
24
|
base.instance_variable_get(:@password).should eq('mypassword')
|
25
25
|
base.instance_variable_get(:@agent).should be_a(Mechanize)
|
26
|
+
base.instance_variable_get(:@url).should == 'url&utm_medium=base'
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
@@ -3,14 +3,12 @@ require 'spec_helper'
|
|
3
3
|
module Hackershout
|
4
4
|
describe Provider do
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}
|
13
|
-
end
|
6
|
+
before do
|
7
|
+
subject.stub(:list).and_return({
|
8
|
+
:reddit => 'Ruby Reddit',
|
9
|
+
:hackernews => 'Hackernews',
|
10
|
+
:rubyflow => 'RubyFlow',
|
11
|
+
})
|
14
12
|
end
|
15
13
|
|
16
14
|
describe "#wants?(provider)" do
|
@@ -52,8 +50,8 @@ module Hackershout
|
|
52
50
|
|
53
51
|
context "if the file doesn't even exist" do
|
54
52
|
it 'asks for the credentials as well' do
|
55
|
-
File.stub(:
|
56
|
-
subject.should_receive(:ask_for_credentials).with(:reddit)
|
53
|
+
File.stub(:exists?).and_return false
|
54
|
+
subject.should_receive(:ask_for_credentials).with(:reddit).and_return({"reddit" => {"login" => "login", "password" => "password"}})
|
57
55
|
subject.send(:check_credentials_for, :reddit)
|
58
56
|
end
|
59
57
|
end
|
@@ -71,6 +69,7 @@ module Hackershout
|
|
71
69
|
file.should_receive(:write).with "\nreddit:"
|
72
70
|
file.should_receive(:write).with "\n login: my.email@gmail.com"
|
73
71
|
file.should_receive(:write).with "\n password: mypassword"
|
72
|
+
file.should_receive(:write).with "\n"
|
74
73
|
|
75
74
|
subject.send(:ask_for_credentials, :reddit)
|
76
75
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 2
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Josep M. Bach
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-02-
|
19
|
+
date: 2011-02-23 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|