Skip to content

Commit e54a48e

Browse files
committed
Increase tests coverage
1 parent 211605c commit e54a48e

16 files changed

+95
-14
lines changed

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.downcase
3938
end
4039
end

features/answers.feature

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

33
As a user of the site, I can perform standard CRUD actions on answers
4+
5+
Background:
6+
Given "Mac" user agent
47

58
Scenario: Create an answer
6-
Given a question exists
9+
And a question exists
710
And I answer that question
811
Then I should be notified that my answer was submitted
912
And an email should be sent to the author
1013
And I should be able to see my answer
1114
And my answer should show on my profile page
1215

1316
Scenario: Edit an answer
14-
Given a question exists
17+
And a question exists
1518
And I answer that question
1619
When I edit that answer
1720
Then I should see the updated answer

features/blog.feature

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
Feature: Hackety Blog
22

33
As an admin, I can post to the hackety blog.
4-
4+
5+
Background:
6+
Given "Mac" user agent
7+
58
Scenario: Read the blog
69
Given a blog post exists
710
When I visit the blog

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/moderator.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ Feature: Moderate questions
33
As a moderator, I should be able to delete questions from the site.
44

55
Background:
6-
Given there is a question from someone else
6+
Given "Mac" user agent
7+
And there is a question from someone else
78

89
Scenario: Delete a question
910
Given I am a moderator

features/programs.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Feature: Access Programs
22

33
As a user of the site, I want to access users' programs
4+
5+
Background:
6+
Given "Mac" user agent
47

58
Scenario: View a featured program
69
Given there is a featured program

features/questions.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ Feature: CRUD actions for question
22

33
As a user of the site, I can perform standard CRUD actions on questions
44

5+
Background:
6+
Given "Mac" user agent
7+
58
Scenario: Create a question
69
When I create a new question
710
Then I should be told the question was created

0 commit comments

Comments
 (0)