Skip to content

Commit

Permalink
adding feature test for additional contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
klieber committed May 8, 2014
1 parent 174c6ce commit 112139b
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ gem 'nokogiri'
gem 'relish'
gem 'capybara', '~> 2.0.2'
gem 'rake'
gem 'selenium-webdriver', '~> 2.39.0'
gem 'selenium-webdriver', '~> 2.41.0'
#gem 'ruby-debug19'

12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GEM
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 1.0.0)
childprocess (0.3.9)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
cucumber (1.3.8)
builder (>= 2.1.2)
Expand All @@ -25,7 +25,7 @@ GEM
json (1.8.0)
mime-types (1.25)
mini_portile (0.5.1)
multi_json (1.8.4)
multi_json (1.10.0)
multi_test (0.0.2)
nokogiri (1.6.0)
mini_portile (~> 0.5.0)
Expand All @@ -47,9 +47,9 @@ GEM
rspec-expectations (2.14.3)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.3)
rubyzip (1.1.0)
selenium-webdriver (2.39.0)
childprocess (>= 0.2.5)
rubyzip (1.1.3)
selenium-webdriver (2.41.0)
childprocess (>= 0.5.0)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0.4)
Expand All @@ -67,4 +67,4 @@ DEPENDENCIES
rake
relish
rspec
selenium-webdriver (~> 2.39.0)
selenium-webdriver (~> 2.41.0)
19 changes: 19 additions & 0 deletions features/additional_contexts.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Feature: Additional contexts can be configured.

In order to reference javascript files outside of the standard source and spec directories
I want to be able to configure additional contexts

Scenario: Reference a vendor script outside of the source directory

Given I am currently in the "jasmine-webapp-additional-contexts" project
When I run "mvn clean install"
Then the build should succeed
And I should see "Results: 1 specs, 0 failures"

@server
Scenario: Reference a vendor script outside of the source directory in browser

Given I am currently in the "jasmine-webapp-additional-contexts" project
When I run "mvn clean jasmine:bdd" in a new process
And I load "http://localhost:8234" in a browser
Then the page should contain "Passing 1 spec"
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-example-superpom</artifactId>
<version>%{project.version}</version>
</parent>
<artifactId>jasmine-webapp-passing</artifactId>
<packaging>war</packaging>
<name>Example Webapp using Jasmine Maven Plugin</name>

<build>
<plugins>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>%{project.version}</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<additionalContexts>
<context>
<contextRoot>vendor</contextRoot>
<directory>src/main/vendor</directory>
</context>
</additionalContexts>
<preloadSources>
<source>vendor/math.js</source>
</preloadSources>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(function(window) {
window.app = {
calculate : function() {
return math.add(15,35);
}
};
})(this);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(function(window) {
window.math = {
add : function(a,b) {
return a+b;
}
};
})(this);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe('app',function(){

it('should calculate to 50',function(){
expect(app.calculate()).toBe(50);
});

});

0 comments on commit 112139b

Please sign in to comment.