Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating the twitter generator to use cucumber by default now too
- Loading branch information
Showing
10 changed files
with
160 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
lib/generators/twitter/templates/features/adding_items_from_the_bookmarklet.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Feature: Viewing my wish list | ||
In order to display a users' preferences | ||
As a twitter user | ||
|
||
Background: | ||
Given I am logged in | ||
And I have created a "53cm Pistas" category | ||
And I have created a "54cm Cyclocross" category | ||
|
||
Scenario: After Authenticating | ||
When I visit the bookmarklet page | ||
And I set the category to "53cm Pistas" | ||
And the "description" is set to "Bianchi Pista Size 53cm Medium - $500 (Downtown Denver)" | ||
And the "url" is set to "http://denver.craigslist.org/bik/1195971789.html" | ||
When I click submit | ||
Then I should see the window close |
19 changes: 19 additions & 0 deletions
19
lib/generators/twitter/templates/features/adding_items_to_my_wishlist.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Feature: Viewing my wish list | ||
In order to display a users' preferences | ||
As a twitter user | ||
|
||
Background: | ||
Given I am logged in | ||
And I have created a "53cm Pistas" category | ||
|
||
Scenario: Posting to an existing category | ||
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 | ||
And I visit the "53cm Pistas" page | ||
Then I should see the "Bianchi Pista Size 53cm Medium - $500 (Downtown Denver)" in the list | ||
And the url should be set to "http://denver.craigslist.org/bik/1195971789.html" | ||
|
||
Scenario: Posting to a new category | ||
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 | ||
And I visit the "54cm Pistas" page | ||
Then I should see the "Bianchi Pista Size 54cm Medium - $500 (Downtown Denver)" in the list | ||
And the url should be set to "http://denver.craigslist.org/bik/1195971789.html" |
11 changes: 11 additions & 0 deletions
11
lib/generators/twitter/templates/features/basics.feature.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Feature: Visiting the Home Page | ||
In order to display a splash page | ||
|
||
Scenario: Seeing the splash page unauthenticated | ||
When I visit the home page | ||
Then I should be prompted to try the app | ||
|
||
Scenario: Seeing the splash page authenticated | ||
Given I am logged in | ||
When I visit the home page | ||
Then I should be greeted |
15 changes: 15 additions & 0 deletions
15
lib/generators/twitter/templates/features/step_definitions/basics.rb.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
When /^I visit the home page$/ do | ||
get '/' | ||
end | ||
|
||
Then /^I should be greeted$/ do | ||
last_response.should have_selector("h2:contains('Hello There, you little twitterer!')") | ||
end | ||
|
||
Then /^I should be prompted to try the app$/ do | ||
last_response.should have_selector("p:contains('Would you mind trying out my new app')") | ||
end | ||
|
||
Given /^I am logged in$/ do | ||
login_quentin | ||
end |
63 changes: 63 additions & 0 deletions
63
lib/generators/twitter/templates/features/support/env.rb.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
require 'spec' | ||
require 'spec/mocks' | ||
require 'webrat' | ||
require 'rack/test' | ||
require 'dm-sweatshop' | ||
require 'pp' | ||
|
||
require File.dirname(__FILE__)+'/../../lib/<%= name %>' | ||
|
||
module <%= name.camelize %>::AppHelpers | ||
def app | ||
@app = Rack::Builder.new do | ||
run <%= name.camelize %>::App | ||
end | ||
end | ||
|
||
def login_quentin | ||
response = Net::HTTPSuccess.new('1.0', 200, nil) | ||
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\"}" | ||
login(response) | ||
end | ||
|
||
def unauthorized_quentin | ||
response = Net::HTTPUnauthorized.new('1.0', 401, nil) | ||
response.body = "Unauthorized" | ||
lambda { login(response) }.should raise_error(ArgumentError) | ||
end | ||
|
||
def login(response) | ||
token = 'oU5W1XD2TTZhWT6Snfii9JbVBUkJOurCKhWQHz98765' | ||
|
||
consumer = mock('Consumer', {:request => response}) | ||
request_token = mock('RequestToken', {:get_access_token => mock('AccessToken', {:token => 'foo', :secret => 'bar'})}) | ||
|
||
OAuth::Consumer.stub!(:new).and_return(consumer) | ||
OAuth::RequestToken.stub!(:new).and_return(request_token) | ||
|
||
visit "/callback?oauth_token=#{token}" | ||
end | ||
end | ||
|
||
Webrat.configure do |config| | ||
config.mode = :rack_test | ||
config.application_port = 4567 | ||
end | ||
|
||
class Net::HTTPResponse | ||
def body=(content) | ||
@body = content | ||
@read = true | ||
end | ||
end | ||
|
||
World(Rack::Test::Methods) | ||
World(Spec::Mocks::ExampleMethods) | ||
World(Webrat::Methods) | ||
World(Webrat::Matchers) | ||
World(<%= name.camelize %>::AppHelpers) | ||
|
||
Before do | ||
DataMapper.setup(:default, "sqlite3://:memory:") | ||
DataMapper.auto_migrate! | ||
end |
14 changes: 14 additions & 0 deletions
14
lib/generators/twitter/templates/features/viewing_my_wish_list.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Feature: Viewing my wish list | ||
In order to display a users' preferences | ||
As a twitter user | ||
|
||
Background: | ||
Given I am logged in | ||
And I have created a "53cm Pistas" category | ||
|
||
Scenario: After Authenticating | ||
When I visit the home page | ||
Then I should see my list of categories | ||
When I enter "Prostitutes" for a new category | ||
And I click submit | ||
Then I should see the "Prostitutes" list |
6 changes: 6 additions & 0 deletions
6
lib/generators/twitter/templates/features/viewing_the_site_for_the_first_time.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Feature: Visiting the Home Page | ||
In order to display a splash page | ||
As an anonymous user | ||
Scenario: Seeing the splash page | ||
When I visit the home page | ||
Then I should be greeted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters