Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cucumber specs #87

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ group :test do
gem 'database_cleaner'
gem 'shoulda-matchers'
gem 'factory_girl_rails', '1.4.0'
gem "cucumber-rails"
gem 'simplecov', :require => false
gem "capybara"
gem "selenium"
gem "selenium-client"
gem "selenium-webdriver"
gem "watir-webdriver", "~> 0.6.1"
end

# To use ActiveModel has_secure_password
Expand All @@ -61,4 +68,5 @@ gem 'newrelic_rpm'
group :development do
gem 'heroku'
gem 'passenger'
gem 'webrat', '0.7.3'
end
85 changes: 85 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,28 @@ GEM
arel (3.0.2)
bootstrap-sass (2.0.2)
builder (3.0.0)
capybara (1.1.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
childprocess (0.3.2)
ffi (~> 1.0.6)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.3.1)
cucumber (1.2.0)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.10.0)
json (>= 1.4.6)
cucumber-rails (1.3.0)
capybara (>= 1.1.2)
cucumber (>= 1.1.8)
nokogiri (>= 1.5.0)
daemon_controller (1.0.0)
database_cleaner (0.7.2)
diff-lcs (1.1.3)
Expand All @@ -101,7 +119,26 @@ GEM
multipart-post (~> 1.1)
rack (~> 1.1)
fastthread (1.0.7)
<<<<<<< HEAD
ffi (1.0.11)
gherkin (2.10.0)
json (>= 1.4.6)
git (1.2.5)
<<<<<<< Updated upstream
<<<<<<< Updated upstream
<<<<<<< Updated upstream
=======
feather_cms (0.0.4)
>>>>>>> 3823ac637ad425ca6e2c09ba6b09e6f4100f9d49
=======
feather_cms (0.0.4)
>>>>>>> Stashed changes
=======
feather_cms (0.0.4)
>>>>>>> Stashed changes
=======
feather_cms (0.0.4)
>>>>>>> Stashed changes
haml (3.1.4)
haml-rails (0.3.4)
actionpack (~> 3.0)
Expand All @@ -116,12 +153,23 @@ GEM
rubyzip
hike (1.2.1)
i18n (0.6.0)
jar_wrapper (0.1.2)
jeweler
jeweler
zip
zip
jeweler (1.6.4)
bundler (~> 1.0)
git (>= 1.2.5)
rake
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.6.6)
launchy (2.1.0)
addressable (~> 2.2.6)
libwebsocket (0.1.3)
addressable
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
Expand All @@ -132,6 +180,7 @@ GEM
mysql2 (0.3.11)
netrc (0.7.1)
newrelic_rpm (3.3.3)
nokogiri (1.5.2)
oauth (0.4.5)
omniauth (1.1.0)
hashie (~> 1.2)
Expand Down Expand Up @@ -175,11 +224,27 @@ GEM
rspec (~> 2.9.0)
rubyzip (0.9.8)
sass (3.1.15)
selenium (0.2.1)
jar_wrapper
jar_wrapper
jeweler
jeweler
selenium-client (1.2.18)
selenium-webdriver (2.21.2)
childprocess (>= 0.2.5)
ffi (~> 1.0)
libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
rubyzip
shoulda-matchers (1.0.0)
simple_form (2.0.1)
actionpack (~> 3.0)
activemodel (~> 3.0)
simple_oauth (0.1.5)
simplecov (0.6.4)
multi_json (~> 1.0)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
Expand All @@ -199,6 +264,15 @@ GEM
uglifier (1.2.4)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
watir-webdriver (0.6.1)
selenium-webdriver (>= 2.18.0)
webrat (0.7.3)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
xpath (0.1.4)
nokogiri (~> 1.3)
zip (2.0.2)

PLATFORMS
ruby
Expand All @@ -207,7 +281,9 @@ DEPENDENCIES
RedCloth
arel (= 3.0.2)
bootstrap-sass
capybara
coffee-rails!
cucumber-rails
database_cleaner
factory_girl_rails (= 1.4.0)
faker
Expand All @@ -226,8 +302,17 @@ DEPENDENCIES
rails!
rspec-rails (>= 2.8.0rc1)
sass-rails!
selenium
selenium-client
selenium-webdriver
shoulda-matchers
simple_form
<<<<<<< HEAD
simplecov
=======
tweet-button
>>>>>>> 3823ac637ad425ca6e2c09ba6b09e6f4100f9d49
twitter
uglifier (>= 1.0.3)
watir-webdriver (~> 0.6.1)
webrat (= 0.7.3)
24 changes: 24 additions & 0 deletions features/create_idea_page.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Feature: User should create an idea
In order to create an idea
As a user
I should be able fill the information


Background:
Given I am logged in

Scenario: Fill in details to create idea
Given I am on the home page
When I click "Create Idea" or "Create" link
Then I should see Details page
When I fill in "Title" with "Test Idea"
And I fill in "Github" with "http://github.com/"
And I fill in "Description" with "Test description"
And I fill in "Categories" with "Misc"
And I click "Create Idea"
Then I should see created ideas

Scenario: Should be able to browse ideas
Given I am on the home page
When I click "Browse Ideas" or "Browse" link
Then I should see created ideas
47 changes: 47 additions & 0 deletions features/home_page.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Feature: User visits the Home Page
In order to use the site
As a user
I should be able to see the home page of Ideahub

Background:
Given I am not logged in

Scenario: Find the link to the form to browse ideas
Given I am on the home page
Then I should see "Browse Ideas" button

Scenario: Find the link to the form to create idea
Given I am on the home page
Then I should see "Create Idea" button

Scenario: Find the twitter link to the form to login through twitter
Given I am on the home page
Then I should see "twitter" link

Scenario: Find the link to the form
Given I am on the home page
Then I should see "About" link

Scenario: User views ideas
Given I am on the home page
When I click "Browse Ideas" link
Then I should see created ideas

Scenario: User views login page
Given I am on the home page
When I click "Create Idea" link
Then I should see login page

Scenario: User views login page
Given I am on the home page
When I click "twitter" link
Then I should see login page

Scenario: User views drop down list
Given I am on the home page
When I click on "About" link
Then I should see drop down list

Scenario: User should see only 4 ideas
Given I am on the home page
Then I should see only 4 ideas
14 changes: 14 additions & 0 deletions features/sign_in.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Feature: Sign in
In order to get access to protected sections of the site
As a user
I Should be able to sign in


Background:
Given I am not logged in


Scenario: View home page
Given I am on a login page
When I sign in with valid credentials
Then I should visit home page
13 changes: 13 additions & 0 deletions features/sign_out.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Feature: Sign out
To protect my account from unauthorized access
As a signed in user
I Should be able to sign out


Background:
Given I am logged in

Scenario: User signs out
When I Sign out
Then I should see the home page

16 changes: 16 additions & 0 deletions features/step_definitions/create_idea_page_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

Given /^I am logged in$/ do
visit '/'
end

Then /^I should see Details page$/ do
visit '/ideas/new'
end

When /^I fill in "(.*?)" with "(.*?)"$/ do |arg1, arg2|
page.should have_xpath('/html/body/div[2]')
end

When /^I click "(.*?)"$/ do |arg1|
find_link('Create Idea').visible?
end
44 changes: 44 additions & 0 deletions features/step_definitions/home_page_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

Given /^I am not logged in$/ do
visit '/'
end

Given /^I am on the home page$/ do
visit '/'
end

Then /^I should see "(.*?)" link$/ do |arg1|
page.should have_xpath('/html/body/div/div/div/ul[2]/li[2]/a')
end

Then /^I should see "(.*?)" button$/ do |arg1|
page.should have_xpath('/html/body/div[2]/header/div/a')
end

When /^I click "(.*?)" link$/ do |arg1|
page.should have_xpath('/html/body/div[2]/header/div/a')
end

Then /^I should see created ideas$/ do
visit "/ideas"
end

Then /^I should see login page$/ do
page.has_content?('Authorize JoshIdeaHub to use your account')
#session = Capybara::Session.new(:selenium)
#session.visit('https://api.twitter.com/oauth/authenticate')
#visit('https://api.twitter.com/oauth/authenticate?oauth_token=uo1ACcxNq3GptOGxxVIVTRS2fMGN8LK1tHHkvIXHk')
#visit('https://api.twitter.com')
end

When /^I click on "(.*?)" link$/ do |arg1|
page.should have_link arg1
end

Then /^I should see drop down list$/ do
page.should have_xpath('/html/body/div/div/div/ul[2]/li/ul')
end

Then /^I should see only (\d+) ideas$/ do |arg1|
page.should have_xpath('/html/body/div[2]/div')
end
12 changes: 12 additions & 0 deletions features/step_definitions/sign_in_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Given /^I am on a login page$/ do
page.has_content?('Authorize JoshIdeaHub to use your account')
end

When /^I sign in with valid credentials$/ do
page.has_content?('Authorize JoshIdeaHub to use your account')
end

Then /^I should visit home page$/ do
visit '/'
end

10 changes: 10 additions & 0 deletions features/step_definitions/sign_out_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

When /^I Sign out$/ do
page.has_content?('Sign out')
end


Then /^I should see the home page$/ do
visit '/'
end

Loading