singem 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/generators/foo.txt +284 -0
- data/lib/generators/twitter/templates/Rakefile +8 -2
- data/lib/generators/twitter/templates/features/adding_items_from_the_bookmarklet.feature +16 -0
- data/lib/generators/twitter/templates/features/adding_items_to_my_wishlist.feature +19 -0
- data/lib/generators/twitter/templates/features/basics.feature.erb +11 -0
- data/lib/generators/twitter/templates/features/step_definitions/basics.rb.erb +15 -0
- data/lib/generators/twitter/templates/features/support/env.rb.erb +63 -0
- data/lib/generators/twitter/templates/features/viewing_my_wish_list.feature +14 -0
- data/lib/generators/twitter/templates/features/viewing_the_site_for_the_first_time.feature +6 -0
- data/lib/generators/twitter/templates/lib/templates.rb.erb +0 -2
- data/lib/generators/twitter/twitter_generator.rb +8 -0
- metadata +13 -2
data/Rakefile
CHANGED
@@ -0,0 +1,284 @@
|
|
1
|
+
diff -ur twitter/USAGE cucumber/USAGE
|
2
|
+
--- twitter/USAGE 2009-05-06 23:36:10.000000000 -0600
|
3
|
+
+++ cucumber/USAGE 2009-05-20 01:51:20.000000000 -0600
|
4
|
+
@@ -1,5 +1,5 @@
|
5
|
+
Description:
|
6
|
+
-
|
7
|
+
-
|
8
|
+
+
|
9
|
+
+
|
10
|
+
Usage:
|
11
|
+
-
|
12
|
+
+
|
13
|
+
Only in cucumber: cucumber_generator.rb
|
14
|
+
diff -ur twitter/templates/README.md cucumber/templates/README.md
|
15
|
+
--- twitter/templates/README.md 2009-05-06 23:36:10.000000000 -0600
|
16
|
+
+++ cucumber/templates/README.md 2009-05-22 21:12:13.000000000 -0600
|
17
|
+
@@ -1,4 +1,4 @@
|
18
|
+
<%= name %>
|
19
|
+
<%= "=" * name.size %>
|
20
|
+
|
21
|
+
-A gem that provides...
|
22
|
+
+A sinatra app the provides a gem that...
|
23
|
+
diff -ur twitter/templates/Rakefile cucumber/templates/Rakefile
|
24
|
+
--- twitter/templates/Rakefile 2009-05-22 21:11:36.000000000 -0600
|
25
|
+
+++ cucumber/templates/Rakefile 2009-05-22 21:33:17.000000000 -0600
|
26
|
+
@@ -3,6 +3,7 @@
|
27
|
+
require 'rubygems/specification'
|
28
|
+
require 'date'
|
29
|
+
require 'spec/rake/spectask'
|
30
|
+
+require 'cucumber/rake/task'
|
31
|
+
|
32
|
+
GEM = "<%= name %>"
|
33
|
+
GEM_VERSION = "0.0.1"
|
34
|
+
@@ -32,7 +33,7 @@
|
35
|
+
|
36
|
+
s.require_path = 'lib'
|
37
|
+
s.autorequire = GEM
|
38
|
+
- s.files = %w(LICENSE README.md Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
|
39
|
+
+ s.files = %w(LICENSE README.md Rakefile TODO) + Dir.glob("{lib,features}/**/*")
|
40
|
+
end
|
41
|
+
|
42
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
43
|
+
@@ -51,7 +52,13 @@
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
-task :default => :spec
|
48
|
+
+task :default => :features
|
49
|
+
+
|
50
|
+
+desc "Run cucumber"
|
51
|
+
+Cucumber::Rake::Task.new do |t|
|
52
|
+
+ t.cucumber_opts = %w{--format pretty}
|
53
|
+
+end
|
54
|
+
+
|
55
|
+
|
56
|
+
desc "Run specs"
|
57
|
+
Spec::Rake::SpecTask.new do |t|
|
58
|
+
diff -ur twitter/templates/config.ru.erb cucumber/templates/config.ru.erb
|
59
|
+
--- twitter/templates/config.ru.erb 2009-05-20 01:59:02.000000000 -0600
|
60
|
+
+++ cucumber/templates/config.ru.erb 2009-07-05 13:03:25.000000000 -0600
|
61
|
+
@@ -1,9 +1,6 @@
|
62
|
+
require 'rubygems'
|
63
|
+
require '<%= name %>'
|
64
|
+
|
65
|
+
-ENV['<%= name.upcase %>_READKEY'] = /\w{18}/.gen # this should really be what twitter gives you
|
66
|
+
-ENV['<%= name.upcase %>_READSECRET'] = /\w{24}/.gen # this should really be what twitter gives you
|
67
|
+
-
|
68
|
+
#DataMapper.setup(:default, "mysql://atmos:fail@localhost/<%= name.capitalize %>_production")
|
69
|
+
|
70
|
+
class <%= name.camelize %>Site < <%= name.camelize %>::App
|
71
|
+
Only in cucumber/templates: features
|
72
|
+
Only in cucumber/templates/lib/templates: app.rb.erb
|
73
|
+
Only in twitter/templates/lib/templates: models
|
74
|
+
Only in twitter/templates/lib/templates: sinatra
|
75
|
+
Only in twitter/templates/lib/templates: views
|
76
|
+
diff -ur twitter/templates/lib/templates.rb.erb cucumber/templates/lib/templates.rb.erb
|
77
|
+
--- twitter/templates/lib/templates.rb.erb 2009-05-06 23:36:10.000000000 -0600
|
78
|
+
+++ cucumber/templates/lib/templates.rb.erb 2009-05-20 01:51:20.000000000 -0600
|
79
|
+
@@ -1,58 +1,9 @@
|
80
|
+
-gem 'oauth'
|
81
|
+
-require 'oauth'
|
82
|
+
-gem 'json'
|
83
|
+
-require 'json'
|
84
|
+
-gem 'haml', '~>2.0.9'
|
85
|
+
+require 'rubygems'
|
86
|
+
+require 'sinatra/base'
|
87
|
+
require 'haml/util'
|
88
|
+
require 'haml/engine'
|
89
|
+
-gem 'chronic'
|
90
|
+
-require 'chronic'
|
91
|
+
-gem 'curb'
|
92
|
+
-require 'curb'
|
93
|
+
-require 'logger'
|
94
|
+
-
|
95
|
+
-gem 'data_objects', '~>0.9.11'
|
96
|
+
-gem 'dm-core', '~>0.9.10'
|
97
|
+
-gem 'dm-types', '~>0.9.10'
|
98
|
+
-gem 'dm-validations', '~>0.9.10'
|
99
|
+
-gem 'dm-timestamps', '~>0.9.10'
|
100
|
+
-require 'dm-core'
|
101
|
+
-require 'dm-types'
|
102
|
+
-require 'dm-validations'
|
103
|
+
-require 'dm-timestamps'
|
104
|
+
-require 'sinatra/base'
|
105
|
+
|
106
|
+
module <%= name.camelize %>
|
107
|
+
- module Log
|
108
|
+
- def self.logger
|
109
|
+
- if @logger.nil?
|
110
|
+
- @logger = Logger.new("<%= name %>.log")
|
111
|
+
- @logger.level = Logger::INFO
|
112
|
+
- end
|
113
|
+
- @logger
|
114
|
+
- end
|
115
|
+
- end
|
116
|
+
-
|
117
|
+
- module OAuth
|
118
|
+
- def self.consumer
|
119
|
+
- ::OAuth::Consumer.new(ENV['<%= name.upcase %>_READKEY'],
|
120
|
+
- ENV['<%= name.upcase %>_READSECRET'],
|
121
|
+
- {:site => 'http://twitter.com'})
|
122
|
+
- end
|
123
|
+
- end
|
124
|
+
-
|
125
|
+
- def self.retryable(options = {}, &block)
|
126
|
+
- opts = { :tries => 1, :on => StandardError }.merge(options)
|
127
|
+
- retry_exception, retries = opts[:on], opts[:tries]
|
128
|
+
-
|
129
|
+
- begin
|
130
|
+
- return yield
|
131
|
+
- rescue retry_exception
|
132
|
+
- retry if (retries -= 1) > 0
|
133
|
+
- end
|
134
|
+
- yield
|
135
|
+
- end
|
136
|
+
end
|
137
|
+
|
138
|
+
-require File.dirname(__FILE__)+'/<%= name %>/models/user'
|
139
|
+
-require File.dirname(__FILE__)+'/<%= name %>/sinatra/app'
|
140
|
+
+require File.dirname(__FILE__)+'/<%= name %>/app'
|
141
|
+
diff -ur twitter/templates/spec/spec_helper.rb.erb cucumber/templates/spec/spec_helper.rb.erb
|
142
|
+
--- twitter/templates/spec/spec_helper.rb.erb 2009-05-22 21:29:00.000000000 -0600
|
143
|
+
+++ cucumber/templates/spec/spec_helper.rb.erb 2009-05-20 01:51:20.000000000 -0600
|
144
|
+
@@ -3,20 +3,17 @@
|
145
|
+
require 'rubygems'
|
146
|
+
require 'randexp'
|
147
|
+
require '<%= name %>'
|
148
|
+
-require 'dm-core'
|
149
|
+
+#require 'dm-core'
|
150
|
+
require 'rack/test'
|
151
|
+
-require 'webrat'
|
152
|
+
-require 'dm-sweatshop'
|
153
|
+
+require 'webrat/sinatra'
|
154
|
+
+#require 'dm-sweatshop'
|
155
|
+
require 'fakeweb'
|
156
|
+
require 'pp'
|
157
|
+
|
158
|
+
FakeWeb.allow_net_connect = false
|
159
|
+
-ENV['<%= name.upcase %>_READKEY'] = /\w{18}/.gen
|
160
|
+
-ENV['<%= name.upcase %>_READSECRET'] = /\w{18}/.gen
|
161
|
+
|
162
|
+
-require File.dirname(__FILE__)+'/fixtures'
|
163
|
+
-
|
164
|
+
-DataMapper.setup(:default, 'sqlite3::memory:')
|
165
|
+
+#require File.dirname(__FILE__)+'/fixtures'
|
166
|
+
+#DataMapper.setup(:default, 'sqlite3::memory:')
|
167
|
+
|
168
|
+
class Net::HTTPResponse
|
169
|
+
def body=(content)
|
170
|
+
@@ -31,14 +28,8 @@
|
171
|
+
config.include(Webrat::Matchers)
|
172
|
+
|
173
|
+
config.before(:each) do
|
174
|
+
- ::<%= name.camelize %>::App.environment = :development
|
175
|
+
- DataMapper.auto_migrate!
|
176
|
+
+ #DataMapper.auto_migrate!
|
177
|
+
FakeWeb.clean_registry
|
178
|
+
- FakeWeb.register_uri(:post, "http://twitter.com:80/oauth/request_token",
|
179
|
+
- [{:string => "oauth_token=requestkey&oauth_token_secret=requestsecret", :status => ["200", "OK"]},
|
180
|
+
- {:string => "", :status => ["401", "Unauthorized"]},
|
181
|
+
- {:string => "", :status => ["403", "Forbidden"]},
|
182
|
+
- {:string => "Bad Gateway", :status => ["502", "Bad Gateway"]} ])
|
183
|
+
end
|
184
|
+
|
185
|
+
def app
|
186
|
+
@@ -46,30 +37,4 @@
|
187
|
+
run <%= name.camelize %>::App
|
188
|
+
end
|
189
|
+
end
|
190
|
+
-
|
191
|
+
- def login_quentin
|
192
|
+
- response = Net::HTTPSuccess.new('1.0', 200, nil)
|
193
|
+
- response.body = "{\"description\":\"lulz\",\"profile_background_image_url\":\"http:\\/\\/static.twitter.com\\/images\\/themes\\/theme3\\/bg.gif\",\"utc_offset\":-25200,\"friends_count\":157,\"profile_background_color\":\"EDECE9\",\"profile_text_color\":\"634047\",\"url\":\"http:\\/\\/example.org\",\"name\":\"Quentin Blake\",\"favourites_count\":6,\"profile_link_color\":\"088253\",\"protected\":false,\"status\":{\"truncated\":false,\"in_reply_to_status_id\":null,\"text\":\"stu stu studio\",\"in_reply_to_user_id\":null,\"favorited\":false,\"created_at\":\"Tue Mar 31 19:02:12 +0000 2009\",\"id\":1426242614,\"source\":\"<a href=\\\"http:\\/\\/iconfactory.com\\/software\\/twitterrific\\\">twitterrific<\\/a>\"},\"created_at\":\"Sun Mar 18 20:07:13 +0000 2007\",\"statuses_count\":2560,\"profile_background_tile\":false,\"time_zone\":\"Mountain Time (US & Canada)\",\"profile_sidebar_fill_color\":\"E3E2DE\",\"profile_image_url\":\"http:\\/\\/static.twitter.com\\/images\\/default_profile_normal.png\",\"notifications\":false,\"profile_sidebar_border_color\":\"D3D2CF\",\"location\":\"Boulder, Colorado\",\"id\":1484261,\"following\":false,\"followers_count\":368,\"screen_name\":\"caboose\"}"
|
194
|
+
- login(response)
|
195
|
+
- last_response.headers['Location'].should eql('/')
|
196
|
+
- end
|
197
|
+
-
|
198
|
+
- def unauthorized_quentin
|
199
|
+
- response = Net::HTTPUnauthorized.new('1.0', 401, nil)
|
200
|
+
- response.body = "Unauthorized"
|
201
|
+
- lambda { login(response) }.should raise_error(ArgumentError)
|
202
|
+
- end
|
203
|
+
-
|
204
|
+
- def login(response)
|
205
|
+
- token = 'oU5W1XD2TTZhWT6Snfii9JbVBUkJOurCKhWQHz98765'
|
206
|
+
-
|
207
|
+
- consumer = mock('Consumer', {:request => response})
|
208
|
+
- request_token = mock('RequestToken', {:get_access_token => mock('AccessToken', {:token => 'foo', :secret => 'bar'})})
|
209
|
+
-
|
210
|
+
- OAuth::Consumer.stub!(:new).and_return(consumer)
|
211
|
+
- OAuth::RequestToken.stub!(:new).and_return(request_token)
|
212
|
+
-
|
213
|
+
- get '/callback', :oauth_token => token
|
214
|
+
- last_response
|
215
|
+
- end
|
216
|
+
end
|
217
|
+
diff -ur twitter/templates/spec/templates_spec.rb.erb cucumber/templates/spec/templates_spec.rb.erb
|
218
|
+
--- twitter/templates/spec/templates_spec.rb.erb 2009-05-06 23:36:10.000000000 -0600
|
219
|
+
+++ cucumber/templates/spec/templates_spec.rb.erb 2009-05-20 01:51:20.000000000 -0600
|
220
|
+
@@ -1,59 +1,8 @@
|
221
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
222
|
+
|
223
|
+
-describe "visiting /" do
|
224
|
+
- describe "when unauthenticated" do
|
225
|
+
- it "should display the about page" do
|
226
|
+
- get '/'
|
227
|
+
- last_response.should have_selector("h2:contains('Do you use twitter?')")
|
228
|
+
- end
|
229
|
+
- end
|
230
|
+
- describe "when unauthorized" do
|
231
|
+
- it "should raise an error" do
|
232
|
+
- lambda { unauthorized_quentin }.should raise_error
|
233
|
+
- end
|
234
|
+
- end
|
235
|
+
- describe "when authenticated" do
|
236
|
+
- it "should display a greeting" do
|
237
|
+
- login_quentin
|
238
|
+
- get '/'
|
239
|
+
- last_response.should have_selector("h2:contains('Hello There, you little twitterer!')")
|
240
|
+
- end
|
241
|
+
- end
|
242
|
+
-end
|
243
|
+
-
|
244
|
+
-describe "visiting /peace" do
|
245
|
+
- describe "when authenticated" do
|
246
|
+
- it "should clear the session and redirect to the home page" do
|
247
|
+
- login_quentin
|
248
|
+
- get '/peace'
|
249
|
+
- last_response.headers['Location'].should eql('/')
|
250
|
+
-
|
251
|
+
- get last_response.headers['Location']
|
252
|
+
- last_response.should have_selector("h2:contains('Do you use twitter?')")
|
253
|
+
- end
|
254
|
+
- end
|
255
|
+
-end
|
256
|
+
-
|
257
|
+
-describe "triggering a 404" do
|
258
|
+
- it "should display the failed page" do
|
259
|
+
- pending
|
260
|
+
- get '/lost'
|
261
|
+
- last_response.should have_selector("p:contains('Something went wonky.')")
|
262
|
+
- end
|
263
|
+
-end
|
264
|
+
-
|
265
|
+
-describe "visiting /authenticate" do
|
266
|
+
- it "should redirect to twitter for authentication" do
|
267
|
+
- get '/authenticate'
|
268
|
+
- last_response.headers['Location'].should eql('http://twitter.com/oauth/authorize?oauth_token=requestkey')
|
269
|
+
- end
|
270
|
+
-end
|
271
|
+
-
|
272
|
+
-describe "<%= name.camelize %>::User" do
|
273
|
+
- it "can create users from twitter ids that exist" do
|
274
|
+
- lambda { <%= name.camelize %>::User.create_twitter_user('atmos') }.should_not raise_error
|
275
|
+
- end
|
276
|
+
- it "can't create users from twitter ids that do not exist" do
|
277
|
+
- lambda { <%= name.camelize %>::User.create_twitter_user(/\w{18}/.gen) }.should raise_error(<%= name.camelize %>::User::UserCreationError)
|
278
|
+
+describe "<%= name.camelize %>" do
|
279
|
+
+ it "should do nothing" do
|
280
|
+
+ get '/'
|
281
|
+
+ last_response.should have_selector("h2:contains('Hello There, buddy!')")
|
282
|
+
end
|
283
|
+
end
|
284
|
+
Only in twitter: twitter_generator.rb
|
@@ -2,7 +2,6 @@ require 'rubygems'
|
|
2
2
|
require 'rake/gempackagetask'
|
3
3
|
require 'rubygems/specification'
|
4
4
|
require 'date'
|
5
|
-
require 'spec/rake/spectask'
|
6
5
|
|
7
6
|
GEM = "<%= name %>"
|
8
7
|
GEM_VERSION = "0.0.1"
|
@@ -51,8 +50,15 @@ task :make_spec do
|
|
51
50
|
end
|
52
51
|
end
|
53
52
|
|
54
|
-
task :default => :
|
53
|
+
task :default => :features
|
54
|
+
|
55
|
+
require 'cucumber/rake/task'
|
56
|
+
desc "Run cucumber"
|
57
|
+
Cucumber::Rake::Task.new do |t|
|
58
|
+
t.cucumber_opts = %w{--format pretty}
|
59
|
+
end
|
55
60
|
|
61
|
+
require 'spec/rake/spectask'
|
56
62
|
desc "Run specs"
|
57
63
|
Spec::Rake::SpecTask.new do |t|
|
58
64
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: Viewing my wish list
|
2
|
+
In order to display a users' preferences
|
3
|
+
As a twitter user
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given I am logged in
|
7
|
+
And I have created a "53cm Pistas" category
|
8
|
+
And I have created a "54cm Cyclocross" category
|
9
|
+
|
10
|
+
Scenario: After Authenticating
|
11
|
+
When I visit the bookmarklet page
|
12
|
+
And I set the category to "53cm Pistas"
|
13
|
+
And the "description" is set to "Bianchi Pista Size 53cm Medium - $500 (Downtown Denver)"
|
14
|
+
And the "url" is set to "http://denver.craigslist.org/bik/1195971789.html"
|
15
|
+
When I click submit
|
16
|
+
Then I should see the window close
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Feature: Viewing my wish list
|
2
|
+
In order to display a users' preferences
|
3
|
+
As a twitter user
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given I am logged in
|
7
|
+
And I have created a "53cm Pistas" category
|
8
|
+
|
9
|
+
Scenario: Posting to an existing category
|
10
|
+
When I post "Bianchi Pista Size 53cm Medium - $500 (Downtown Denver)" with a url of "http://denver.craigslist.org/bik/1195971789.html" to the "53cm Pistas" category
|
11
|
+
And I visit the "53cm Pistas" page
|
12
|
+
Then I should see the "Bianchi Pista Size 53cm Medium - $500 (Downtown Denver)" in the list
|
13
|
+
And the url should be set to "http://denver.craigslist.org/bik/1195971789.html"
|
14
|
+
|
15
|
+
Scenario: Posting to a new category
|
16
|
+
When I post "Bianchi Pista Size 54cm Medium - $500 (Downtown Denver)" with a url of "http://denver.craigslist.org/bik/1195971789.html" to the "54cm Pistas" category
|
17
|
+
And I visit the "54cm Pistas" page
|
18
|
+
Then I should see the "Bianchi Pista Size 54cm Medium - $500 (Downtown Denver)" in the list
|
19
|
+
And the url should be set to "http://denver.craigslist.org/bik/1195971789.html"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Feature: Visiting the Home Page
|
2
|
+
In order to display a splash page
|
3
|
+
|
4
|
+
Scenario: Seeing the splash page unauthenticated
|
5
|
+
When I visit the home page
|
6
|
+
Then I should be prompted to try the app
|
7
|
+
|
8
|
+
Scenario: Seeing the splash page authenticated
|
9
|
+
Given I am logged in
|
10
|
+
When I visit the home page
|
11
|
+
Then I should be greeted
|
@@ -0,0 +1,15 @@
|
|
1
|
+
When /^I visit the home page$/ do
|
2
|
+
get '/'
|
3
|
+
end
|
4
|
+
|
5
|
+
Then /^I should be greeted$/ do
|
6
|
+
last_response.should have_selector("h2:contains('Hello There, you little twitterer!')")
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^I should be prompted to try the app$/ do
|
10
|
+
last_response.should have_selector("p:contains('Would you mind trying out my new app')")
|
11
|
+
end
|
12
|
+
|
13
|
+
Given /^I am logged in$/ do
|
14
|
+
login_quentin
|
15
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec'
|
2
|
+
require 'spec/mocks'
|
3
|
+
require 'webrat'
|
4
|
+
require 'rack/test'
|
5
|
+
require 'dm-sweatshop'
|
6
|
+
require 'pp'
|
7
|
+
|
8
|
+
require File.dirname(__FILE__)+'/../../lib/<%= name %>'
|
9
|
+
|
10
|
+
module <%= name.camelize %>::AppHelpers
|
11
|
+
def app
|
12
|
+
@app = Rack::Builder.new do
|
13
|
+
run <%= name.camelize %>::App
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def login_quentin
|
18
|
+
response = Net::HTTPSuccess.new('1.0', 200, nil)
|
19
|
+
response.body = "{\"description\":\"lulz\",\"profile_background_image_url\":\"http:\\/\\/static.twitter.com\\/images\\/themes\\/theme3\\/bg.gif\",\"utc_offset\":-25200,\"friends_count\":157,\"profile_background_color\":\"EDECE9\",\"profile_text_color\":\"634047\",\"url\":\"http:\\/\\/example.org\",\"name\":\"Quentin Blake\",\"favourites_count\":6,\"profile_link_color\":\"088253\",\"protected\":false,\"status\":{\"truncated\":false,\"in_reply_to_status_id\":null,\"text\":\"stu stu studio\",\"in_reply_to_user_id\":null,\"favorited\":false,\"created_at\":\"Tue Mar 31 19:02:12 +0000 2009\",\"id\":1426242614,\"source\":\"<a href=\\\"http:\\/\\/iconfactory.com\\/software\\/twitterrific\\\">twitterrific<\\/a>\"},\"created_at\":\"Sun Mar 18 20:07:13 +0000 2007\",\"statuses_count\":2560,\"profile_background_tile\":false,\"time_zone\":\"Mountain Time (US & Canada)\",\"profile_sidebar_fill_color\":\"E3E2DE\",\"profile_image_url\":\"http:\\/\\/static.twitter.com\\/images\\/default_profile_normal.png\",\"notifications\":false,\"profile_sidebar_border_color\":\"D3D2CF\",\"location\":\"Boulder, Colorado\",\"id\":1484261,\"following\":false,\"followers_count\":368,\"screen_name\":\"caboose\"}"
|
20
|
+
login(response)
|
21
|
+
end
|
22
|
+
|
23
|
+
def unauthorized_quentin
|
24
|
+
response = Net::HTTPUnauthorized.new('1.0', 401, nil)
|
25
|
+
response.body = "Unauthorized"
|
26
|
+
lambda { login(response) }.should raise_error(ArgumentError)
|
27
|
+
end
|
28
|
+
|
29
|
+
def login(response)
|
30
|
+
token = 'oU5W1XD2TTZhWT6Snfii9JbVBUkJOurCKhWQHz98765'
|
31
|
+
|
32
|
+
consumer = mock('Consumer', {:request => response})
|
33
|
+
request_token = mock('RequestToken', {:get_access_token => mock('AccessToken', {:token => 'foo', :secret => 'bar'})})
|
34
|
+
|
35
|
+
OAuth::Consumer.stub!(:new).and_return(consumer)
|
36
|
+
OAuth::RequestToken.stub!(:new).and_return(request_token)
|
37
|
+
|
38
|
+
visit "/callback?oauth_token=#{token}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
Webrat.configure do |config|
|
43
|
+
config.mode = :rack_test
|
44
|
+
config.application_port = 4567
|
45
|
+
end
|
46
|
+
|
47
|
+
class Net::HTTPResponse
|
48
|
+
def body=(content)
|
49
|
+
@body = content
|
50
|
+
@read = true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
World(Rack::Test::Methods)
|
55
|
+
World(Spec::Mocks::ExampleMethods)
|
56
|
+
World(Webrat::Methods)
|
57
|
+
World(Webrat::Matchers)
|
58
|
+
World(<%= name.camelize %>::AppHelpers)
|
59
|
+
|
60
|
+
Before do
|
61
|
+
DataMapper.setup(:default, "sqlite3://:memory:")
|
62
|
+
DataMapper.auto_migrate!
|
63
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Viewing my wish list
|
2
|
+
In order to display a users' preferences
|
3
|
+
As a twitter user
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given I am logged in
|
7
|
+
And I have created a "53cm Pistas" category
|
8
|
+
|
9
|
+
Scenario: After Authenticating
|
10
|
+
When I visit the home page
|
11
|
+
Then I should see my list of categories
|
12
|
+
When I enter "Prostitutes" for a new category
|
13
|
+
And I click submit
|
14
|
+
Then I should see the "Prostitutes" list
|
@@ -19,6 +19,8 @@ class TwitterGenerator < RubiGen::Base
|
|
19
19
|
m.directory ''
|
20
20
|
BASEDIRS.each { |path| m.directory path }
|
21
21
|
m.directory "lib/#{name}"
|
22
|
+
m.directory "features/support"
|
23
|
+
m.directory "features/step_definitions"
|
22
24
|
m.directory "lib/#{name}/sinatra"
|
23
25
|
m.directory "lib/#{name}/models"
|
24
26
|
m.directory "lib/#{name}/views"
|
@@ -29,6 +31,12 @@ class TwitterGenerator < RubiGen::Base
|
|
29
31
|
m.template "lib/templates/sinatra/app.rb.erb", "lib/#{name}/sinatra/app.rb"
|
30
32
|
m.template "lib/templates/models/user.rb.erb", "lib/#{name}/models/user.rb"
|
31
33
|
|
34
|
+
# cucumber stubs
|
35
|
+
m.template "features/support/env.rb.erb", "features/support/env.rb"
|
36
|
+
m.template "features/basics.feature.erb", "features/#{name}.feature"
|
37
|
+
m.template "features/step_definitions/basics.rb.erb", "features/step_definitions/#{name}.rb"
|
38
|
+
|
39
|
+
# rspec stubs
|
32
40
|
m.template "spec/spec_helper.rb.erb", "spec/spec_helper.rb"
|
33
41
|
m.template "spec/templates_spec.rb.erb", "spec/#{name}_spec.rb"
|
34
42
|
m.template "spec/fixtures.rb.erb", "spec/fixtures.rb"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: singem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Donohoe
|
@@ -9,7 +9,7 @@ autorequire: singem
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05
|
12
|
+
date: 2009-07-05 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- lib/generators/cucumber/templates/spec/templates_spec.rb.erb
|
111
111
|
- lib/generators/cucumber/templates/TODO
|
112
112
|
- lib/generators/cucumber/USAGE
|
113
|
+
- lib/generators/foo.txt
|
113
114
|
- lib/generators/singem
|
114
115
|
- lib/generators/singem/singem_generator.rb
|
115
116
|
- lib/generators/singem/templates
|
@@ -130,6 +131,16 @@ files:
|
|
130
131
|
- lib/generators/twitter
|
131
132
|
- lib/generators/twitter/templates
|
132
133
|
- lib/generators/twitter/templates/config.ru.erb
|
134
|
+
- lib/generators/twitter/templates/features
|
135
|
+
- lib/generators/twitter/templates/features/adding_items_from_the_bookmarklet.feature
|
136
|
+
- lib/generators/twitter/templates/features/adding_items_to_my_wishlist.feature
|
137
|
+
- lib/generators/twitter/templates/features/basics.feature.erb
|
138
|
+
- lib/generators/twitter/templates/features/step_definitions
|
139
|
+
- lib/generators/twitter/templates/features/step_definitions/basics.rb.erb
|
140
|
+
- lib/generators/twitter/templates/features/support
|
141
|
+
- lib/generators/twitter/templates/features/support/env.rb.erb
|
142
|
+
- lib/generators/twitter/templates/features/viewing_my_wish_list.feature
|
143
|
+
- lib/generators/twitter/templates/features/viewing_the_site_for_the_first_time.feature
|
133
144
|
- lib/generators/twitter/templates/lib
|
134
145
|
- lib/generators/twitter/templates/lib/templates
|
135
146
|
- lib/generators/twitter/templates/lib/templates/models
|