Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adjusted testing setup to work with travis-ci (environment differences)

  • Loading branch information...
commit 5f176533e5b43c9c35cce2006a636c00221a9348 1 parent ad5b173
Yves Senn authored
9 spec/integration/corner_stones/flash_messages_spec.rb
View
@@ -3,7 +3,10 @@
require 'corner_stones/flash_messages'
describe CornerStones::FlashMessages do
- given_the_html <<-HTML
+
+ stub_capybara_response
+
+ let(:html) { <<-HTML
<div class="alert">
<p>Article was not saved. Please correct the errors.</p>
</div>
@@ -14,6 +17,7 @@
<p>Successfully logged in</p>
</div>
HTML
+ }
subject { CornerStones::FlashMessages.new}
@@ -57,7 +61,7 @@
end
describe 'custom message types' do
- given_the_html <<-HTML
+ let(:html) { <<-HTML
<div class="alert-error">
<p>Article was not saved. Please correct the errors.</p>
</div>
@@ -68,6 +72,7 @@
<p>Successfully logged in</p>
</div>
HTML
+ }
subject { CornerStones::FlashMessages.new(:message_types => [:'alert-info', :'alert-error', :'alert-warning'])}
28 spec/integration/corner_stones/form_spec.rb
View
@@ -5,7 +5,9 @@
describe CornerStones::Form do
- given_the_html <<-HTML
+ stub_capybara_response
+
+ let(:html) {<<-HTML
<form action="/articles" method="post" class="article-form">
<label for="title">Title</label>
<input type="text" name="title" id="title">
@@ -38,6 +40,7 @@
</form>
HTML
+ }
subject { CornerStones::Form.new('.article-form') }
@@ -113,12 +116,14 @@
end
describe 'form with an unknown field type' do
- given_the_html <<-HTML
+ let(:html) {<<-HTML
<form action="/articles" method="post" class="form-with-errors article-form">
<label for="unknown">Unknown</label>
<a id="unknown">Link</a>
</form>
HTML
+ }
+
it 'raises an error when filling the form' do
assert_raises(CornerStones::Form::UnknownFieldError) { subject.fill_in_with('Unknown' => '123456') }
end
@@ -132,7 +137,7 @@
end
describe 'with errors' do
- given_the_html <<-HTML
+ let(:html) {<<-HTML
<form action="/articles" method="post" class="form-with-errors article-form">
<div>
<label for="title">Title</label>
@@ -168,6 +173,7 @@
</form>
HTML
+ }
it 'assembles the errors into a hash' do
subject.errors.must_equal([{"Field" => "Author", "Value" => "Robert C. Martin", "Error" => "The author is not active"},
@@ -193,7 +199,7 @@
end
describe 'without errors' do
- given_the_html <<-HTML
+ let(:html) {<<-HTML
<form action="/articles" method="post" class="form-without-errors article-form">
<label for="title">Title</label>
<input type="text" name="title" id="title">
@@ -201,15 +207,17 @@
<input type="submit" value="Save">
<form>
HTML
- end
+ }
- it '#assert_has_no_errors passes' do
- subject.assert_has_no_errors
- end
+ it '#assert_has_no_errors passes' do
+ subject.assert_has_no_errors
+ end
- it 'allows you to submit the form' do
- subject.submit
+ it 'allows you to submit the form' do
+ subject.submit
+ end
end
+
end
end
end
8 spec/integration/corner_stones/table_form_spec.rb
View
@@ -3,7 +3,9 @@
require 'corner_stones/table_form'
describe CornerStones::TableForm do
- given_the_html <<-HTML
+
+ stub_capybara_response
+ let(:html) {<<-HTML
<form action="/movies" method="post" class="movie-form">
<table class="movies">
<thead>
@@ -58,6 +60,7 @@
<input type="submit" name="button" value="Save movies">
</form>
HTML
+ }
subject { CornerStones::TableForm.new('.movie-form') }
@@ -114,7 +117,7 @@
end
describe 'colspans' do
- given_the_html <<-HTML
+ let(:html) {<<-HTML
<table class="movie-form">
<thead>
<tr>
@@ -131,6 +134,7 @@
</tbody>
</table>
HTML
+ }
it 'ignores empty cells' do
expected_data = [{'Title' => 'Indiana Jones', 'Duration' => '210 minutes', 'Time' => nil}]
21 spec/integration/corner_stones/table_spec.rb
View
@@ -6,7 +6,8 @@
describe CornerStones::Table do
- given_the_html <<-HTML
+ stub_capybara_response
+ let(:html) { <<-HTML
<table class="articles">
<thead>
<tr>
@@ -29,6 +30,7 @@
</tbody>
</table
HTML
+ }
subject { CornerStones::Table.new('.articles') }
@@ -84,7 +86,7 @@
describe 'custom tables' do
describe 'inline headers' do
- given_the_html <<-HTML
+ let(:html) { <<-HTML
<table class="articles">
<tbody>
<tr>
@@ -98,6 +100,7 @@
</tbody>
</table>
HTML
+ }
subject { CornerStones::Table.new('.articles', :headers => ['Book', 'Author'], :data_selector => 'th,td') }
@@ -117,7 +120,7 @@
end
describe 'colspans' do
- given_the_html <<-HTML
+ let(:html) { <<-HTML
<table class="articles">
<thead>
<tr>
@@ -134,6 +137,7 @@
</tbody>
</table>
HTML
+ }
it 'ignores empty cells' do
expected_data = [{'ID' => '1', 'Title' => 'Clean Code', 'Author' => nil}]
@@ -145,7 +149,7 @@
describe 'mixins' do
describe 'deletable rows' do
- given_the_html <<-HTML
+ let(:html) {<<-HTML
<table class="articles">
<thead>
<tr>
@@ -175,7 +179,7 @@
</tbody>
</table>
HTML
-
+ }
before do
subject.extend(CornerStones::Table::DeletableRows)
end
@@ -201,7 +205,7 @@
end
describe 'selectable rows' do
- given_the_html <<-HTML
+ let(:html) { <<-HTML
<table class="articles">
<thead>
<tr>
@@ -224,6 +228,7 @@
</tbody>
</table>
HTML
+ }
before do
subject.extend(CornerStones::Table::SelectableRows)
@@ -242,7 +247,7 @@
end
describe 'whitespace filter' do
- given_the_html <<-HTML
+ let(:html) { <<-HTML
<table class="articles">
<thead>
<tr>
@@ -263,7 +268,7 @@
</tbody>
</table>
HTML
-
+ }
before do
subject.extend(CornerStones::Table::WhitespaceFilter)
end
4 spec/integration/corner_stones/tabs_spec.rb
View
@@ -5,13 +5,15 @@
describe CornerStones::Tabs do
- given_the_html <<-HTML
+ stub_capybara_response
+ let(:html) {<<-HTML
<ul class="main-tabs-nav">
<li class="active"><a href='/main'>Main</a></li>
<li><a href='/details'>Details</a></li>
<li><a href='/more_stuff'>More Stuff</a></li>
</ul>
HTML
+ }
subject { CornerStones::Tabs.new('.main-tabs-nav') }
2  spec/integration/support/response_macros.rb
View
@@ -1,6 +1,6 @@
module ResponseMacros
- def given_the_html(html)
+ def stub_capybara_response
before do
Capybara.app = lambda do |env|
[200, {}, html]
Please sign in to comment.
Something went wrong with that request. Please try again.