Skip to content

Instantly share code, notes, and snippets.

View greggroth's full-sized avatar

Greggory Rothmeier greggroth

  • GitHub
  • San Francisco, CA
View GitHub Profile
class Foo
def test
2 + 2
end
end
describe "Search courses" do
it "by topic" do
create_course_catalog
create_biology_courses("A001", "B205")
search_for('biology')
page.should have_content "A001"
page.should have_content "B205"
end
end
describe "Search courses" do
it "by topic" do
240.times { Course.create! }
Course.create!(topic: "biology", name: "A001")
Course.create!(topic: "biology", name: "B205")
visit search_path
fill_in "Search", with: "biology"
click_button "Search"
page.should have_content "A001"
page.should have_content "B205"
fill_in "Username", with: "test_user"
fill_in "Password", with: "secret"
click_button "Login"
page.should have_content "Signed in!"
@greggroth
greggroth / gist:3498652
Created August 28, 2012 14:46
step def
Given /there are (.*) courses which do not have the topic \"(.*)\"/ do |number, topic|
number.times { |n| Course.create!(topic: 'something else' }
end
Feature: Search courses
In order to ensure better utilization of courses
Potential students should be able to search for courses
Scenario: Search by topic
Given there are 240 courses which do not have the topic "biology"
And there are 2 courses A001, B205 that each have "biology" as one of the topics
When I search for "biology"
Then I should see the following courses:
| Course code |
diff --git a/db/schema.rb b/db/schema.rb
index 609c0a0..d37e32d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -97,18 +97,18 @@ ActiveRecord::Schema.define(:version => 20120614194043) do
t.date "due"
t.text "notes"
t.integer "customer_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
state :sleeping do
def hungry?
false
end
end
state all - [:sleeping] do
def hungry?
true
end
> gonzo.wake_up
=> true
> gonzo.walk
=> true
> gonzo.state
=> "walking"
> gonzo.can_walk?
=> false
> gonzo.walk
=> false
> gonzo.state
=> "sleeping"