Permalink
Browse files

Merge pull request #186 from ArturG/coverage

Increase test coverage
  • Loading branch information...
2 parents 211605c + 114bc62 commit b4f74ac2d3397eee2767a4ff0b022ccecf1d8aff @PragTob PragTob committed Feb 27, 2014
View
@@ -42,6 +42,7 @@ group :development do
end
group :development, :test do
+ gem 'debugger'
gem 'fabrication'
gem 'rspec-rails'
gem 'capybara'
View
@@ -64,6 +64,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.7.0)
+ columnize (0.3.6)
coveralls (0.7.0)
multi_json (~> 1.3)
rest-client
@@ -82,6 +83,12 @@ GEM
nokogiri (>= 1.5.0)
rails (>= 3.0.0)
database_cleaner (1.2.0)
+ debugger (1.6.5)
+ columnize (>= 0.3.1)
+ debugger-linecache (~> 1.2.0)
+ debugger-ruby_core_source (~> 1.3.1)
+ debugger-linecache (1.2.0)
+ debugger-ruby_core_source (1.3.2)
devise (2.2.8)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
@@ -249,6 +256,7 @@ DEPENDENCIES
coveralls
cucumber-rails
database_cleaner
+ debugger
devise (~> 2.2.2)
fabrication
faker
@@ -19,7 +19,5 @@ def update
format.html { redirect_to question_url(resource.question) }
end
end
-
-
end
@@ -23,18 +23,17 @@ def download
@other_platforms = ["mac", "windows", "linux"] - [@platform]
end
- def api_root; render :layout => "api"; end
+ def api_root
+ render :layout => "api"
+ end
+
def newest_version
render :json => {:version => "1.0.0"}
end
protected
def platform
- if Rails.env.test?
- "mac"
- else
- request.user_agent.match(/Mac|Linux|Windows/).try(:[], 0).try(:downcase)
- end
+ request.user_agent.nil? ? nil : request.user_agent.downcase
end
end
View
@@ -1,17 +1,17 @@
Feature: CRUD actions for answers
As a user of the site, I can perform standard CRUD actions on answers
-
+
Scenario: Create an answer
- Given a question exists
+ And a question exists
And I answer that question
Then I should be notified that my answer was submitted
And an email should be sent to the author
And I should be able to see my answer
And my answer should show on my profile page
Scenario: Edit an answer
- Given a question exists
+ And a question exists
And I answer that question
When I edit that answer
Then I should see the updated answer
View
@@ -0,0 +1,13 @@
+Feature: Hackety Lessons
+
+ As a user of the site, I can visit lessons page
+
+ Scenario: View the lessons
+ When I visit lessons path
+ Then I should see the list of lessons
+
+ Scenario: View specific lesson
+ When I visit lessons path
+ When I click on lesson's title
+ Then I should see lesson content
+
@@ -1,7 +1,7 @@
Feature: Access Programs
As a user of the site, I want to access users' programs
-
+
Scenario: View a featured program
Given there is a featured program
Then I should be able to view a highlighted program
View
@@ -1,7 +1,7 @@
Feature: Sign up for an account
As a new Hackety user, I want to create a new account and log in with it
-
+
Scenario: Create an account via the signup form
When I register a new account
Then I should be logged in with my new account
View
@@ -0,0 +1,19 @@
+Feature: Detect user's platform and provide download link
+
+ As a fresh Hackety user, I want to download software for my current OS
+
+ Scenario: MacOS User
+ Given "Mac" user agent
+ Then I should be able to download "mac" software
+
+ Scenario: Windows User
+ Given "Windows" user agent
+ Then I should be able to download "windows" software
+
+ Scenario: Linux User
+ Given "Linux" user agent
+ Then I should be able to download "linux" software
+
+ Scenario: Android User
+ Given "android" user agent
+ Then I should be able to download "android" software
@@ -0,0 +1,17 @@
+When(/^I visit lessons path$/) do
+ visit lessons_path
+end
+
+Then(/^I should see the list of lessons$/) do
+ page.should have_content("Lessons")
+ page.should have_content("A Tour of Hackety Hack")
+end
+
+When(/^I click on lesson's title$/) do
+ click_link("A Tour of Hackety Hack")
+end
+
+Then(/^I should see lesson content$/) do
+ expect(page).to have_title "A Tour of Hackety Hack"
+ page.should have_content("Welcome to the Hackety Hack tour!")
+end
@@ -0,0 +1,8 @@
+Given(/^"(.*?)" user agent$/) do |agent|
+ page.driver.header('User-Agent', agent)
+end
+
+Then(/^I should be able to download "(.*?)" software$/) do |system|
+ visit download_path
+ page.should have_content("Version 1.0.1 for #{system}")
+end
View
@@ -8,6 +8,7 @@
require_relative '../../spec/code_coverage'
require 'cucumber/rails'
+require 'ruby-debug'
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
# order to ease the transition to Capybara we set the default here. If you'd
View
@@ -2,7 +2,7 @@ Feature: Manage account
As a user of this site, I can view and update my profile, see my followers
- Background: The user is logged in
+ Background:
Given a logged in user
Scenario: View my profile

0 comments on commit b4f74ac

Please sign in to comment.