Skip to content
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
2 changes: 1 addition & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--color
--format documentation
--require spec_helper
2 changes: 2 additions & 0 deletions app/views/guesses/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
</button>
</form>

asdasd

<hr>

<form action="/show_answer">
Expand Down
11 changes: 11 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
machine:
ruby:
version: 2.2.4

notify:
webhooks:
- url: https://grades.firstdraft.com/builds

test:
override:
- bundle exec rspec --order default --format documentation --format j --out $CIRCLE_ARTIFACTS/rspec_output.json
17 changes: 0 additions & 17 deletions spec/features/1_something_spec.rb

This file was deleted.

59 changes: 59 additions & 0 deletions spec/features/guesses_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
require "rails_helper"

feature "The index page" do
it "has a functional RCAV", points: 5 do
visit "/all_guesses"

expect(page).to have_selector("h1")
end

it "has the first sequence", points: 5 do
visit "/all_guesses"

expect(page).to have_selector("li", text: "2, 4, 8 Obeys the rule")
end

it "has two forms", points: 5 do
visit "/all_guesses"

expect(page).to have_selector("form", count: 2)
end

it "has a \"Check\" button", points: 5 do
visit "/all_guesses"

expect(page).to have_button("Check")
end

it "has a \"I think I know it\" button", points: 5 do
visit "/all_guesses"

expect(page).to have_button("I think I know it")
end

it "has a reset link", points: 5 do
visit "/all_guesses"

expect(page).to have_link("Reset")
end
end

feature "The answer form" do
it "goes to the answer page when submitted", points: 5 do
visit "/all_guesses"

click_on "I think I know it"

expect(current_path).to eq "/show_answer"
end

it "displays the user's answer on the answer page" do
visit "/all_guesses"

fill_in("rule", with: "A serviceable substitute for wit")

click_on "I think I know it"

expect(page).to have_content("A serviceable substitute for wit")
end
end
5 changes: 0 additions & 5 deletions spec/models/guess_spec.rb

This file was deleted.

21 changes: 9 additions & 12 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,6 @@
# as the one that triggered the failure.
Kernel.srand config.seed
=end
RSpec.configure do |config|
config.before(:suite) do
Percy.config.access_token = ENV["PERCY_TOKEN"]
# Percy.config.default_widths = [320, 768, 1280] # to test responsiveness
end

config.before(:suite) { Percy::Capybara.initialize_build }
config.after(:suite) { Percy::Capybara.finalize_build }
end

class RSpec::Core::Formatters::JsonFormatter
def dump_summary(summary)
Expand All @@ -106,7 +97,7 @@ def dump_summary(summary)
map { |example| example.metadata[:points] }.
sum

score = summary.
earned_points = summary.
examples.
select { |example| example.execution_result.status == :passed }.
map { |example| example.metadata[:points] }.
Expand All @@ -118,10 +109,16 @@ def dump_summary(summary)
:failure_count => summary.failure_count,
:pending_count => summary.pending_count,
:total_points => total_points,
:score => score,
:earned_points => earned_points,
:score => earned_points.to_f / total_points
}

@output_hash[:summary_line] = "#{summary.totals_line}, #{score}/#{total_points} points"
@output_hash[:summary_line] = [
"#{summary.example_count} tests",
"#{summary.failure_count} failures",
"#{earned_points}/#{total_points} points",
"#{score}%",
].join(", ")
end

private
Expand Down