Skip to content

Instantly share code, notes, and snippets.

context "when a user exists" do
before { @user = Factory :user }
context "when I visit the page for editing that user" do
before { visit "/users/#{@user.id}/edit" }
it {should let_me_edit_the_user}
end
end
with_existing :user do
on_visiting edit_user_path do
it {should let_me_edit_the_user}
end
end
Scenario: Search by topic
Given a topic exists
And some courses exist covering that topic
And other courses exist that do not cover the topic
When I search for that topic
Then I should see the courses that cover the topic
And I should not see the courses that do not cover the topic
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 |
| A001 |
| B205 |
with_existing :article do
on_visiting edit_article_path do
it { lets_me_edit_the(:article) }
it { shows_failure_on_invalid_update_of(:article) }
end
where it_is_unpublished do
on_visiting articles_path do
specify { page.should_not have_content(@article.name) }
end
def self.role_perms(role_name)
if role_name == :anybody
"return true"
else
"user.acts_as_if? '#{role_name}'"
end
end
def self.access_func(method_name, info)
<?xml version="1.1"?>
<!DOCTYPE smil PUBLIC "-//W3C//DTD SMIL 3.0 Language//EN"
"http://www.w3.org/2008/SMIL30/SMIL30Language.dtd">
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0" baseProfile="Language">
<head>
<layout>
<root-layout width="150" height="200"/>
<region xml:id="b" left="0" width="150" top="0" height="150" backgroundColor="purple"/>
<region xml:id="t" left="0" width="150" top="150" height="50"/>
</layout>`