Skip to content

Commit b4f74ac

Browse files
committed
Merge pull request #186 from ArturG/coverage
Increase test coverage
2 parents 211605c + 114bc62 commit b4f74ac

13 files changed

Lines changed: 78 additions & 14 deletions

File tree

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ group :development do
4242
end
4343

4444
group :development, :test do
45+
gem 'debugger'
4546
gem 'fabrication'
4647
gem 'rspec-rails'
4748
gem 'capybara'

Gemfile.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ GEM
6464
coffee-script-source
6565
execjs
6666
coffee-script-source (1.7.0)
67+
columnize (0.3.6)
6768
coveralls (0.7.0)
6869
multi_json (~> 1.3)
6970
rest-client
@@ -82,6 +83,12 @@ GEM
8283
nokogiri (>= 1.5.0)
8384
rails (>= 3.0.0)
8485
database_cleaner (1.2.0)
86+
debugger (1.6.5)
87+
columnize (>= 0.3.1)
88+
debugger-linecache (~> 1.2.0)
89+
debugger-ruby_core_source (~> 1.3.1)
90+
debugger-linecache (1.2.0)
91+
debugger-ruby_core_source (1.3.2)
8592
devise (2.2.8)
8693
bcrypt-ruby (~> 3.0)
8794
orm_adapter (~> 0.1)
@@ -249,6 +256,7 @@ DEPENDENCIES
249256
coveralls
250257
cucumber-rails
251258
database_cleaner
259+
debugger
252260
devise (~> 2.2.2)
253261
fabrication
254262
faker

app/controllers/answers_controller.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,5 @@ def update
1919
format.html { redirect_to question_url(resource.question) }
2020
end
2121
end
22-
23-
2422
end
2523

app/controllers/static_controller.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,17 @@ def download
2323
@other_platforms = ["mac", "windows", "linux"] - [@platform]
2424
end
2525

26-
def api_root; render :layout => "api"; end
26+
def api_root
27+
render :layout => "api"
28+
end
29+
2730
def newest_version
2831
render :json => {:version => "1.0.0"}
2932
end
3033

3134
protected
3235

3336
def platform
34-
if Rails.env.test?
35-
"mac"
36-
else
37-
request.user_agent.match(/Mac|Linux|Windows/).try(:[], 0).try(:downcase)
38-
end
37+
request.user_agent.nil? ? nil : request.user_agent.downcase
3938
end
4039
end

features/answers.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
Feature: CRUD actions for answers
22

33
As a user of the site, I can perform standard CRUD actions on answers
4-
4+
55
Scenario: Create an answer
6-
Given a question exists
6+
And a question exists
77
And I answer that question
88
Then I should be notified that my answer was submitted
99
And an email should be sent to the author
1010
And I should be able to see my answer
1111
And my answer should show on my profile page
1212

1313
Scenario: Edit an answer
14-
Given a question exists
14+
And a question exists
1515
And I answer that question
1616
When I edit that answer
1717
Then I should see the updated answer

features/lessons.feature

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Feature: Hackety Lessons
2+
3+
As a user of the site, I can visit lessons page
4+
5+
Scenario: View the lessons
6+
When I visit lessons path
7+
Then I should see the list of lessons
8+
9+
Scenario: View specific lesson
10+
When I visit lessons path
11+
When I click on lesson's title
12+
Then I should see lesson content
13+

features/programs.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Feature: Access Programs
22

33
As a user of the site, I want to access users' programs
4-
4+
55
Scenario: View a featured program
66
Given there is a featured program
77
Then I should be able to view a highlighted program

features/signup.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Feature: Sign up for an account
22

33
As a new Hackety user, I want to create a new account and log in with it
4-
4+
55
Scenario: Create an account via the signup form
66
When I register a new account
77
Then I should be logged in with my new account

features/statics.feature

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Feature: Detect user's platform and provide download link
2+
3+
As a fresh Hackety user, I want to download software for my current OS
4+
5+
Scenario: MacOS User
6+
Given "Mac" user agent
7+
Then I should be able to download "mac" software
8+
9+
Scenario: Windows User
10+
Given "Windows" user agent
11+
Then I should be able to download "windows" software
12+
13+
Scenario: Linux User
14+
Given "Linux" user agent
15+
Then I should be able to download "linux" software
16+
17+
Scenario: Android User
18+
Given "android" user agent
19+
Then I should be able to download "android" software
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
When(/^I visit lessons path$/) do
2+
visit lessons_path
3+
end
4+
5+
Then(/^I should see the list of lessons$/) do
6+
page.should have_content("Lessons")
7+
page.should have_content("A Tour of Hackety Hack")
8+
end
9+
10+
When(/^I click on lesson's title$/) do
11+
click_link("A Tour of Hackety Hack")
12+
end
13+
14+
Then(/^I should see lesson content$/) do
15+
expect(page).to have_title "A Tour of Hackety Hack"
16+
page.should have_content("Welcome to the Hackety Hack tour!")
17+
end

0 commit comments

Comments
 (0)